OpenGVLab/InternImage

Is there a way to extract the heatmap based on the feature map from image_demo.py?

jeonga0303 opened this issue · 0 comments

Is there a way to extract the heatmap based on the feature map from image_demo.py?
I want to visualize the generated heatmap by overlapping it on the original image.
From this, I think I can find out which areas the model values. Is there a way?

def main(args):
    # build the model from a config file and a checkpoint file
    model = init_detector(args.config, args.checkpoint, device=args.device)
    # test a single image
    result = inference_detector(model, args.img)
    print(result)
    mmcv.mkdir_or_exist(args.out)
    out_file = osp.join(args.out, osp.basename(args.img))
    # show the results
    model.show_result(
        args.img,
        result,
        score_thr=args.score_thr,
        show=False,
        bbox_color=args.palette,
        text_color=(200, 200, 200),
        mask_color=args.palette,
        out_file=out_file
    )
    print(f"Result is save at {out_file}")