GithubHelp home page GithubHelp logo

dynamo13 / fcam-wsol Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sbelharbi/fcam-wsol

0.0 0.0 0.0 112.27 MB

Pytorch implementation of F-CAM. Paper: "F-CAM: Full Resolution Class Activation Maps via Guided Parametric Upscaling".

License: GNU Lesser General Public License v2.1

Shell 0.25% C++ 2.16% Python 88.51% C 9.01% SWIG 0.05%

fcam-wsol's Introduction

Pytorch 1.9.0 code for:

F-CAM: Full Resolution Class Activation Maps via Guided Parametric Upscaling (https://arxiv. org/abs/2109.07069)

Citation:

@InProceedings{belharbi2022fcam,
  title={F-CAM: Full Resolution Class Activation Maps via Guided Parametric Upscaling},
  author={Belharbi, S. and Sarraf, A. and Pedersoli, M. and Ben Ayed, I. and McCaffrey, L. and Granger, E.},
  booktitle = {WACV},
  year={2022}
}

Issues:

Please create a github issue.

Content:

cd dlib/crf/crfwrapper/bilateralfilter
swig -python -c++ bilateralfilter.i
python setup.py install

See folds/wsol-done-right-splits/dataset-scripts. For more details, see wsol-done-right repo.

Once you download the datasets, you need to adjust the paths in get_root_wsol_dataset().

  • WSOL baselines: CAM over CUB using ResNet50:
time python main_wsol.py --task STD_CL \
                         --encoder_name resnet50 \
                         --arch STDClassifier \
                         --opt__name_optimizer sgd \
                         --batch_size 32 \
                         --opt__step_size 15 \
                         --opt__gamma 0.1 \
                         --max_epochs 50 \
                         --freeze_cl False \
                         --support_background True \
                         --method CAM \
                         --spatial_pooling WGAP \
                         --dataset CUB \
                         --box_v2_metric False \
                         --cudaid $cudaid \
                         --debug_subfolder None \
                         --opt__lr 0.0017 \
                         --exp_id 08_19_2021_14_05_20_620912__6229687
  • Once you trained a WSOL baseline, copy the best model from the exp folder into the folder ./pretrained. The best model is located in a folder with the form name CUB-resnet50-CAM-WGAP-cp_best-boxv2_False. Copy the whole folder.
  • F-CAM: to train with F-CAM, a pretrained WSOL model needs to be prepared as in the previous step. Run for training with F-CAM:
time python main_wsol.py --task F_CL \
                        --encoder_name resnet50 \
                        --arch UnetFCAM \
                        --opt__name_optimizer sgd \
                        --batch_size 32 \
                        --eval_checkpoint_type best \
                        --opt__step_size 1000 \
                        --opt__gamma 0.1 \
                        --max_epochs 50 \
                        --freeze_cl True \
                        --support_background True \
                        --method CAM \
                        --spatial_pooling WGAP \
                        --dataset CUB \
                        --box_v2_metric False \
                        --cudaid $cudaid \
                        --debug_subfolder None \
                        --opt__lr 0.01 \
                        --elb_init_t 1.0 \
                        --elb_max_t 10.0 \
                        --elb_mulcoef 1.01 \
                        --sl_fc True \
                        --sl_fc_lambda 1.0 \
                        --sl_start_ep 0 \
                        --sl_end_ep -1 \
                        --sl_min 1 \
                        --sl_max 1 \
                        --sl_ksz 3 \
                        --sl_min_p 0.1 \
                        --sl_fg_erode_k 11 \
                        --sl_fg_erode_iter 1 \
                        --crf_fc True \
                        --crf_lambda 2e-09 \
                        --crf_sigma_rgb 15.0 \
                        --crf_sigma_xy 100.0 \
                        --crf_scale 1.0 \
                        --crf_start_ep 0 \
                        --crf_end_ep -1 \
                        --max_sizepos_fc True \
                        --max_sizepos_fc_lambda 0.1 \
                        --max_sizepos_fc_start_ep 0 \
                        --max_sizepos_fc_end_ep -1 \
                        --entropy_fc False \
                        --exp_id 08_19_2021_14_09_48_915565__1492324

fcam-intuition

fcam-method

fcam-cub-results

fcam-openimages-results

fcam-taux-sensitivity

fcam-cam-distribution

fcam-wsol's People

Contributors

sbelharbi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.