Skip to content

Commit

Permalink
Corrected the get_started.md example inference
Browse files Browse the repository at this point in the history
It did not contain the checkpoint download step.
  • Loading branch information
kazet committed Jan 11, 2021
1 parent 1f04bc5 commit dc4728c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions docs/get_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,18 @@ PYTHONPATH="$(dirname $0)/..":$PYTHONPATH

## Verification

To verify whether MMDetection and the required environment are installed correctly, we can run sample python codes to initialize a detector and inference a demo image:
To verify whether MMDetection and the required environment are installed correctly, we can run sample Python code to initialize a detector and run inference a demo image:

```python
from mmdet.apis import init_detector, inference_detector

config_file = 'configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py'
# download the checkpoint from model zoo and put it in `checkpoints/`
# url: http://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 = 'checkpoints/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth'
device = 'cuda:0'
# init a detector
model = init_detector(config_file, device=device)
model = init_detector(config_file, checkpoint_file, device=device)
# inference the demo image
inference_detector(model, 'demo/demo.jpg')
```
Expand Down

0 comments on commit dc4728c

Please sign in to comment.