Open wannanfeng opened 3 months ago
from mmdet.apis import init_detector, inference_detector, DetInferencer
from mmdet.registry import VISUALIZERS
import cv2, sys, pickle
import mmcv
from rich.pretty import pprint
config_file = r'/Region-proposal/mmdetection/faster-rcnn_r101_fpn_2x_coco.py'
checkpoint_file = r'/Region-proposal/mmdetection/faster_rcnn_r101_fpn_2x_coco_bbox_mAP-0.398_20200504_210455-1d2dac9c.pth'
img = 'sample/sample.png'
inference = DetInferencer(model=config_file, weights=checkpoint_file, device='cuda:0')
inference(img, out_dir='./self-data-test-output')
res = inference(img)
print(res)
print('detect nums: ', len(res['predictions'][0]['labels']))
If possible, after making some other modifications, can I get the results of RPN on this simple demo python template?
How to obtain the output results of RPN in the latest version (many proposals before NMS) or visualize it?