Created
June 23, 2019 13:43
-
-
Save Tony607/5ea54b2b7067cdb0cccc36e90c83369b to your computer and use it in GitHub Desktop.
How to train an object detection model with mmdetection | DLology
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%cd {mmdetection_dir} | |
from mmcv.runner import load_checkpoint | |
from mmdet.apis import inference_detector, show_result, init_detector | |
checkpoint_file = os.path.join(mmdetection_dir, work_dir, "latest.pth") | |
score_thr = 0.8 | |
# build the model from a config file and a checkpoint file | |
model = init_detector(config_fname, checkpoint_file) | |
# test a single image and show the results | |
img = 'data/VOCdevkit/VOC2007/JPEGImages/15.jpg' | |
result = inference_detector(model, img) | |
show_result(img, result, model.CLASSES, score_thr=score_thr, out_file="result.jpg") | |
# Show the image with bbox overlays. | |
from IPython.display import Image | |
Image(filename='result.jpg') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment