facebookresearch / Detectron

FAIR's research platform for object detection research, implementing popular algorithms like Mask R-CNN and RetinaNet.
Apache License 2.0
26.21k stars 5.45k forks source link

How do I get X server to display an image in detectron2? #1003

Closed rezabanitaba closed 3 years ago

rezabanitaba commented 3 years ago

I am following detectron2 getting started tutorial to detect objects in an image. I am doing this using an AWS machine learning AMI and jupyter notebook. The model successfully detects an object in the image, but openCV seems to be not working because I do not get an output in my console. The error I get is cannot connect to X server.

Reading a file from 'Detectron2 Model Zoo'
[07/12 20:03:32 detectron2]: input1.jpg: detected 1 instances in 0.45s : 
cannot connect to X server /home/ubuntu/anaconda3/lib/python3.7/multiprocessing/semaphore_tracker.py:144: UserWarning: semaphore_tracker: There appear to be 1 leaked semaphores to clean up at shutdown len(cache)) ubuntu@ip-10-0-0-225:~/detectron2/detectron2/demo$

Here is the command I use to run the model:

python demo.py --config-file ../configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml \
--input input1.jpg input2.jpg \
--opts MODEL.WEIGHTS detectron2://COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x/137849600/model_final_f10217.pkl