GaboFlo / IDNConsensus

Project for CentraleSupélec course on multi agents system consensus
GNU General Public License v3.0
0 stars 0 forks source link

Another RaspberryPi errror #6

Closed aarsht7 closed 2 years ago

aarsht7 commented 2 years ago

After some changes in the code, it is able to run the code (at much slow frequency). Following is the terminal output Ignore the error of display.

I covered the camera so it does not detect anything in the start (as you can see in the beginning) When I expose it to the object it gives error and process terminates.

I do have all the necessary things installed with the good versions as mentioned in the requirements.txt of the yolor repo. LMK if you figure out the issue.

$ python3 detect.py --source 0 --cfg cfg/yolor_csp.cfg --weights models/yolor_csp.pt --conf 0.25 --img-size 512 --device cpu 
Unable to init server: Could not connect: Connection refused
Unable to init server: Could not connect: Connection refused

(detect.py:8417): Gdk-CRITICAL **: 15:21:10.828: gdk_cursor_new_for_display: assertion 'GDK_IS_DISPLAY (display)' failed
Namespace(agnostic_nms=False, augment=False, cfg='cfg/yolor_csp.cfg', classes=None, conf_thres=0.25, device='cpu', img_size=512, iou_thres=0.5, names='data/coco.names', output='inference/output', save_txt=False, source='0', update=False, view_img=False, weights=['models/yolor_csp.pt'])
/usr/local/lib/python3.8/dist-packages/torch/functional.py:445: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at  ../aten/src/ATen/native/TensorShape.cpp:2157.)
  return _VF.meshgrid(tensors, **kwargs)  # type: ignore[attr-defined]
1/1: 0...  success (640x480 at 30.00 FPS).

0: 384x512 Done. (5.635s)
0: 384x512 Done. (5.632s)
0: 384x512 Done. (5.493s)
0: 384x512 Done. (5.353s)
0: 384x512 Done. (5.401s)
0: 384x512 Done. (5.500s)
0: 384x512 Done. (5.404s)
0: 384x512 Done. (5.396s)
0: 384x512 Done. (5.363s)
0: 384x512 Done. (5.538s)
Traceback (most recent call last):
  File "detect.py", line 260, in <module>
    detect()
  File "detect.py", line 117, in detect
    pred = non_max_suppression(
  File "/home/hoagie/pytorch/IDNConsensus/idnc/detection/yolor/utils/general.py", line 341, in non_max_suppression
    i = torch.ops.torchvision.nms(boxes, scores, iou_thres)
  File "/usr/local/lib/python3.8/dist-packages/torch/_ops.py", line 63, in __getattr__
    op = torch._C._jit_get_operation(qualified_op_name)
RuntimeError: No such operator torchvision::nms
MathisFederico commented 2 years ago

It's probably due to the torch modified for raspberry you installed, no idea how to fix this tough ...

Maybe you don't have torchvision>=0.8.1 installed?

aarsht7 commented 2 years ago

Nope, it was having some clash with python3.8, I reinstalled everything with python 3.9 and it works. here is the output of the terminal ;)

python3.9 detect.py --source 0 --cfg cfg/yolor_csp.cfg --weights models/yolor_csp.pt --conf 0.25 --img-size 512 --device cpu
/home/hoagie/.local/lib/python3.9/site-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension: 
  warn(f"Failed to load image Python extension: {e}")
Namespace(weights=['models/yolor_csp.pt'], source='0', output='inference/output', img_size=512, conf_thres=0.25, iou_thres=0.5, device='cpu', view_img=False, save_txt=False, classes=None, agnostic_nms=False, augment=False, update=False, cfg='cfg/yolor_csp.cfg', names='data/coco.names')
/home/hoagie/.local/lib/python3.9/site-packages/torch/functional.py:568: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at  /root/pytorch/aten/src/ATen/native/TensorShape.cpp:2227.)
  return _VF.meshgrid(tensors, **kwargs)  # type: ignore[attr-defined]
1/1: 0...  success (640x480 at 30.00 FPS).

0: 384x512 Done. (3.650s)
0: 384x512 Done. (3.587s)
0: 384x512 Done. (3.590s)
0: 384x512 2 persons, 1 bottles, Done. (3.695s)
0: 384x512 2 persons, 1 bottles, Done. (3.674s)
0: 384x512 2 persons, 1 bottles, Done. (3.677s)
0: 384x512 1 persons, Done. (3.673s)
0: 384x512 2 persons, 1 cell phones, Done. (3.700s)

NOTE : This test was performed with screen removed (you can compare the drop in the time difference between two outputs with previous output).