Closed aarsht7 closed 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?
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).
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.