Giter Club home page Giter Club logo

rethinkingcam's Introduction

Rethinking Class Activation Mapping for Weakly Supervised Object Localization [Paper][Project Page]

Datasets

Create symlinks for datasets: CUB-200-2011 and ImageNet-1k. Note that the name of the directory for CUB should be 'CUB_200_2011'.

cd /path/to/this/repo
mkdir data && cd data
ln -s /path/to/cub/dataset
ln -s /path/to/imagenet/dataset

Setup

Setup the pipeline by installing dependencies, pretrained models and utils.

cd /path/to/this/repo
bash scripts/setup.sh --data_setup

Train

To train a model, use the command below. Tag can be an arbitrary string.

cd /path/to/this/repo
bash scripts/run_train.sh --config_path configs/vgg16_tap.yml --tag vgg16_tap --train_dir /path/to/train/dir

Eval

To eval a model, use the command below. Note that checkpoint dir has to be synchronized with train_dir used for training.

cd /path/to/this/repo
bash scripts/run_eval.sh --config_path configs/baseline/vgg16_tap.yml --tag vgg16_tap --checkpoint_dir /path/to/checkpoint/dir

NOTE: NWC and PaS can be used in evaluation time. In configs/vgg16_tap.yml, NWC and PaS can be employed simply changing paraameters under 'eval'. For NWC, change 'truncate' to True. For PaS, change 'percentile' to 90 and 'loc_threshold' to 0.35.

TODO

Model and configs for the other backbones such as Resnet50-SE, Inception need to be added.

Citation

If you use this code or model for your research, please cite:

@InProceedings{bae2020rethinkingCAM,
  author = {Wonho Bae and Junhyug Noh and Gunhee Kim},
  title = {Rethinking Class Activation Mapping for Weakly Supervised Object Localization},
  booktitle = {The European Conference on Computer Vision (ECCV)},
  month = {August},
  year = {2020}
}

Acknowledgment

Many of core functions are borrowed from ADL.

rethinkingcam's People

Contributors

won-bae avatar

Stargazers

 avatar Sungjoon Park avatar Huy Manh avatar xiexy avatar Dongjun Hwang avatar Khai Loong Aw avatar fikry102 avatar Minhyun Lee avatar Yiping Wang avatar WonyoungLee avatar mllx01161110 avatar kevin avatar Lingfeng(Rinn) Zhang avatar  avatar Nicolò Pinciroli avatar  avatar Khanh-Toan Nguyen avatar Junsuk Choe avatar jackz avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

umairjavaid

rethinkingcam's Issues

the log file

Hi, nice work!

When I use the "bash scripts/setup.sh --data_setup", I met the following error,
ImportError: cannot import name 'log'

I think maybe lack of the log file
Thank you very much!

Inception

Thanks for your efforts, this work is good.
Could you please provide some models such as Inception or ResNet ?
Because when I apply the 'TAP' in my model, it seems not work well...
I don't sure whether the configuration of 'TAP' is suitable for me.
So, can you help me ? Thank you very much !

Resnet

nice work, could you please release the resnet as the backbone, I notice you mentioned that in 'TODO'

RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.

Hi, my name is Yuen.

Thank you for sharing this wonderful work.

So far I followed steps and trained the vgg16 model.

However, when I tried "eval" command, it showed the following errors:

python eval.py --config_path=configs/vgg16_tap.yml --tag=vgg16_tap --checkpoint_dir=data
[2022-03-27 15:36:24,223 - data\eval_vgg16_tap] GPU is not available.
[2022-03-27 15:36:24,268 - data\eval_vgg16_tap] VGG network structure: [64, 64, 'M', 128, 128, 'M', 256, 256, 256, 'M', 512, 512, 512, 'M', 512, 512, 512, 1024]
[2022-03-27 15:36:24,452 - data\eval_vgg16_tap] Checkpointer is built.
[2022-03-27 15:36:24,453 - data\eval_vgg16_tap] Loading checkpoint from data\checkpoint_191_1150014.pth
Traceback (most recent call last):
  File "eval.py", line 31, in <module>
    engine.evaluate()
  File "D:\xxxx\rethinkingCAM\src\engine.py", line 175, in evaluate
    epoch, num_step, **self.eval_config)
  File "D:\xxxx\rethinkingCAM\src\engine.py", line 208, in _eval_one_epoch
    top1_cls, top5_cls = metrics.topk_accuracy(predictions, labels, topk=(1,5))
  File "D:\xxxx\rethinkingCAM\src\utils\metrics.py", line 22, in topk_accuracy
    correct_k = correct[:k].view(-1).float().sum(0, keepdim=False)
RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.

Can I know how to resolve it ?

I am using the pytorch 1.11

Thank you

Best regads,
Yuen

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.