Code Monkey home page Code Monkey logo

visual-for-mmdetection's Introduction

visual-for-mmdetection

a simple code for visualize the heat map from backbone and fpn while test with mmdetection

if you use two-stage detector, such as faster rcnn,please change the codes :

1. mmdet/models/detectors/two_stage.py

def extract_feat(self, img):
    x_backbone = self.backbone(img)
    if self.with_neck:
        x_fpn = self.neck(x_backbone)
    return x_backbone,x_fpn

and:

def simple_test(self, img, img_metas, proposals=None, rescale=False):
    """Test without augmentation."""
    assert self.with_bbox, 'Bbox head must be implemented.'

    x_backbone,x_fpn = self.extract_feat(img)

    if proposals is None:
        proposal_list = self.simple_test_rpn(x_fpn, img_metas)
    else:
        proposal_list = proposals

    return self.roi_head.simple_test(
        x_fpn, proposal_list, img_metas, rescale=rescale),x_backbone,x_fpn

2.mmdet/apis/inference.py

def inference_detector(model, img):
.......
        # forward the model
    with torch.no_grad():
        result,x_backbone,x_fpn= model(return_loss=False, rescale=True, **data)
    return result,x_backbone,x_fpn

if you use other detectors, it is easy to change it like this

useage:

1:change the config,checkpoint,img
2: run the code

I refer to some codes , this code is rough and not rigorous

visual-for-mmdetection's People

Contributors

heboyong avatar

Stargazers

ML-Dengxun avatar chenshanliang avatar 张岳琪 avatar  avatar ChiYe avatar CANOE avatar  avatar  avatar SJTU_gs avatar iPriest001 avatar Dai Tran avatar nin avatar Antonio Andrea Gargiulo avatar  avatar Hao Li avatar Arqam avatar sohn avatar Xinzhou Wang avatar Fityanul Akhyar avatar Min avatar  avatar  avatar Ian Wong avatar jongchan avatar key avatar HongqiangWang avatar  avatar shengshijieshao avatar  avatar  avatar  avatar  avatar Yifan Wu avatar fengqian avatar  avatar Kirby_Star avatar Feng Guo avatar XavierYoung avatar Zhang Rong avatar Jialiang Ma avatar yueke1900prv avatar Sihan Shao avatar Dongze Li avatar 赫さん avatar

Watchers

 avatar

visual-for-mmdetection's Issues

the only one channel

Hello, i think your code can only visualize the feature map of a channel, which is not the same as grad cam.

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.