<gh_stars>0
from mmdet.apis import init_detector, inference_detector

print('Test MMDet...')
config_file = '/Projects/PayPal/mmocr/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py'
# download the checkpoint from model zoo and put it in `checkpoints/`
# url: https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_1x_coco/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth
checkpoint_file = '/Projects/PayPal/mmocr/faster_rcnn/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth'
device = 'cuda:0'
# init a detector
model = init_detector(config_file, checkpoint_file, device=device)
# inference the demo image
out = inference_detector(model, '/Projects/PayPal/mmocr/demo.jpg')
print(out)

print('Test MMRotate...')
import mmrotate
config_file = '/Projects/PayPal/mmocr/rotated_faster_rcnn/rotated_faster_rcnn_r50_fpn_1x_dota_le90.py'
# download the checkpoint from model zoo and put it in `checkpoints/`
# url: https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_1x_coco/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth
checkpoint_file = '/Projects/PayPal/mmocr/rotated_faster_rcnn/rotated_faster_rcnn_r50_fpn_1x_dota_le90-0393aa5c.pth'
img_path = "/Projects/PayPal/mmocr/demo_mmrotate.jpg"
model = init_detector(config_file, checkpoint_file, device=device)
result = inference_detector(model, img_path)
model.show_result(img_path, result, score_thr=0.3, out_file="/Projects/PayPal/mmocr/mmrotate_out.jpg")


from mmdet.apis import init_detector, inference_detector

print('Test MMDet...')
config_file = '/Projects/PayPal/mmocr/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py'
# download the checkpoint from model zoo and put it in `checkpoints/`
# url: https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_1x_coco/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth
checkpoint_file = '/Projects/PayPal/mmocr/faster_rcnn/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth'
device = 'cuda:0'
# init a detector
model = init_detector(config_file, checkpoint_file, device=device)
# inference the demo image
out = inference_detector(model, '/Projects/PayPal/mmocr/demo.jpg')
print(out)

print('Test MMRotate...')
import mmrotate
config_file = '/Projects/PayPal/mmocr/rotated_faster_rcnn/rotated_faster_rcnn_r50_fpn_1x_dota_le90.py'
# download the checkpoint from model zoo and put it in `checkpoints/`
# url: https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_1x_coco/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth
checkpoint_file = '/Projects/PayPal/mmocr/rotated_faster_rcnn/rotated_faster_rcnn_r50_fpn_1x_dota_le90-0393aa5c.pth'
img_path = "/Projects/PayPal/mmocr/demo_mmrotate.jpg"
model = init_detector(config_file, checkpoint_file, device=device)
result = inference_detector(model, img_path)
model.show_result(img_path, result, score_thr=0.3, out_file="/Projects/PayPal/mmocr/mmrotate_out.jpg")
# download the checkpoint from model zoo and put it in `checkpoints/` # url: https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_1x_coco/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth # init a detector # inference the demo image # download the checkpoint from model zoo and put it in `checkpoints/` # url: https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_1x_coco/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth