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

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.