GaboFlo / IDNConsensus

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

Error on raspberryPi #3

Closed aarsht7 closed 2 years ago

aarsht7 commented 2 years ago

It still gives the error of not detecting the display. and another AssertionError at the end. please have a look at this what can be modified.

$ python3 detect.py --source 0 --cfg cfg/yolor_csp.cfg --weights models/yolor_csp.pt --conf 0.25 --img-size 640 --device cpu 

Unable to init server: Could not connect: Connection refused
Unable to init server: Could not connect: Connection refused

(detect.py:55654): Gdk-CRITICAL **: 16:46:40.640: 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=640, 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]
Traceback (most recent call last):
  File "detect.py", line 186, in <module>
    detect()
  File "detect.py", line 43, in detect
    model = Darknet(cfg, imgsz).cuda()
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 680, in cuda
    return self._apply(lambda t: t.cuda(device))
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 570, in _apply
    module._apply(fn)
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 570, in _apply
    module._apply(fn)
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 570, in _apply
    module._apply(fn)
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 593, in _apply
    param_applied = fn(param)
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 680, in <lambda>
    return self._apply(lambda t: t.cuda(device))
  File "/usr/local/lib/python3.8/dist-packages/torch/cuda/__init__.py", line 208, in _lazy_init
    raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled
GaboFlo commented 2 years ago

Resolved before merging #4 (Submodule wasn't up-to-date). @aarsht7 you can try it back now, it's supposed to work.

aarsht7 commented 2 years ago

Yes that I figured out while cloning so I tried to directly cloned the repo from the @MathisFederico and I tried to run the command. but it looks like the code is still searching for the display.

GaboFlo commented 2 years ago

What if

Remove the --view-img argument if you don't want to display live detection

? By doing that, on my computer, my webcam stream is not displayed. @aarsht7

aarsht7 commented 2 years ago

Well you can see in the 1st msg the command that I have executed. I have already removed the argument. I will try to run it after connecting the display. And if it doesn't give any error with the display then I guess we got some issues.

MathisFederico commented 2 years ago

Well you can see in the 1st msg the command that I have executed.

Please ensure that you pulled modifications on the yolor & idnc branches, i can see that .cuda() was called, this should not be the case with the cpu device on the latest

MathisFederico commented 2 years ago

Oh @GaboFlo you made a typo !

In detect.py, searching for cuda, you did this:

    # Load model
    model = Darknet(cfg, imgsz)
    if device == "cpu":
        model = model.cuda()

and not this:

    # Load model
    model = Darknet(cfg, imgsz)
    if device != "cpu":
        model = model.cuda()

Fixed on branch bugfix/cuda-cpu @aarsht7 We will merge as soon as @GaboFlo allows it

aarsht7 commented 2 years ago

Yes, I just noticed the same thing.

aarsht7 commented 2 years ago

Nope, It still gives the same error. I have hard coded the device='cpu' and there is no more same error. Strange! Along with that I have to modify several other things. I will upload the modified code for the raspberryPi on new branch