Skip to content

thucth-qt/CenterNet-Grad-CAM

 
 

Repository files navigation

CenterNet Grad-CAM/++

Show cam for CenterNet, support task ctdet.

Thanks

https://github.com/xingyizhou/CenterNet
https://github.com/jinfagang/DCNv2_latest
https://github.com/yizt/Grad-CAM.pytorch

Prepare

  1. Install Pytorch 1.9
  2. git clone https://github.com/JasperMorrison/CenterNet -b grad_cam
  3. cd src/lib/models/networks/DCNv2/;rm-rf *;
  4. git clone https://github.com/tteepe/DCNv2.git dcn_v2
  5. cd dcn_v2; python setup.py develop
  6. Download CenterNet pretrained model (refs to branch master);

Set hook layers

Add layer name to self.cam_layers in base_detector.py

    self.cam_layers = [
      # "conv1",
      # "layer1.0.conv1",
      # "layer2.0",
      # "layer3.0",
      "layer4.0",
      # "layer4.0.conv1",
      # "layer4.0.conv2",
      # "layer4.1",
      # "deconv_layers.15",
      # "hm.0", #set inplace=True as inplace=False in the model py
    ]

Example

  1. cd src
  2. python demo.py ctdet --demo ./images/ --load_model ./models/ctdet_coco_resdcn18.pth --arch resdcn_18 --grad_cam

About

hot fix for id occluded detection

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • Python 80.6%
  • C++ 14.7%
  • Shell 2.1%
  • Cython 1.5%
  • Cuda 1.1%