Detectron2

This is also an updated version of my previous blog detectron2 published on October 13, 2019. I lost the previous source for this blog, but, let’s re-write it.

The autumn in both Vancouver and Seattle is gorgeous…

Overview Seattle on Space Needle Around Space Needle
Overview Seattle on Space Needle Around Space Needle
Overview Seattle on Space Needle Around Space Needle
Space Needle So Heavy
Overview Seattle on Space Needle Around Space Needle
Ferris Wheel Pier 55
Overview Seattle on Space Needle Around Space Needle
Vancouver Maple UBC Poisonous Mushroom

Alright, let’s rapidly test Detectron2.

Installation is detailedly summarized in INSTALL.md.

We can simply follow GETTING_STARTED.md for some simple demonstrations. Make sure you’ve downloaded the demo pictures from Detectron1 demo and save under Detectron2’s folder demo.

1
2
3
4
5
6
7
8
9
10
11
➜  detectron2 git:(master) python demo/demo.py --config-file configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml \
--input ./demo/17790319373_bd19b24cfc_k.jpg \
--output ./result.jpg \
--opts MODEL.WEIGHTS detectron2://COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x/137849600/model_final_f10217.pkl
[04/05 18:17:22 detectron2]: Arguments: Namespace(confidence_threshold=0.5, config_file='configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml', input=['./demo/17790319373_bd19b24cfc_k.jpg'], opts=['MODEL.WEIGHTS', 'detectron2://COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x/137849600/model_final_f10217.pkl'], output='./result.jpg', video_input=None, webcam=False)
[04/05 18:17:24 fvcore.common.checkpoint]: Loading checkpoint from detectron2://COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x/137849600/model_final_f10217.pkl
[04/05 18:17:24 fvcore.common.file_io]: URL https://dl.fbaipublicfiles.com/detectron2/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x/137849600/model_final_f10217.pkl cached in /home/longervision/.torch/fvcore_cache/detectron2/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x/137849600/model_final_f10217.pkl
[04/05 18:17:24 fvcore.common.checkpoint]: Reading a file from 'Detectron2 Model Zoo'
0%| | 0/1 [00:00<?, ?it/s][04/05 18:17:25 detectron2]: ./demo/17790319373_bd19b24cfc_k.jpg: detected 13 instances in 0.86s
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 1.05it/s]
➜ detectron2 git:(master)

Let’s take a look at the result:

Segmentation Result of 17790319373_bd19b24cfc_k

And of course, my pictures taken in Seattle and Vancouver:

Overview Seattle on Space Needle Around Space Needle
Overview Seattle on Space Needle Around Space Needle
Overview Seattle on Space Needle Around Space Needle
Space Needle So Heavy
Overview Seattle on Space Needle Around Space Needle
Ferris Wheel Pier 55
Overview Seattle on Space Needle Around Space Needle
Vancouver Maple UBC Poisonous Mushroom