Closed mattdoescode closed 2 years ago
Are you having a problem only when --save-img
? Are you able to see the inference result with --view-img
?
Only having the problem with --save-img. I am able to view the video feed with --view-img for 1 frame and then the program crashes (works just fine when not using save-img).
Could you tell me exactly what path you set as the --save-img
path?
Please see this article for more debugging possibilities.
I've been setting it is to "True". The save path is "inference\output". I'll look into the article. thank you!
The bug seems to come from this line: _for frame_idx, (path, img, im0s, vidcap) in enumerate(dataset): In class Loadstreams cap = cv2.VideoCapture(eval(s) if s.isnumeric() else s) works just fine. But when we try to enumerate it when it breaks.
I'm still not sure why this bug only happens when --save-img
is True,
but if the problem is with cv2.VideoCapture, then try running the basic OpenCV webcam test script from this link.
Also, it could be helpful if you cold tell me all the details about what computer / camera you're using.
I'm pretty sure I've figured it out. I'll post the solution tomorrow. Thank you so much for the help here!
Very glad to hear. Thank you.
Got it... and I feel really silly (I'm a novice programmer). The video recorder was never being passed back.
In datasets.py line 324-> return img_path, img, img0, None. I changed None to be self.cap and added a newline on line 280 self.cap = cap
This might break some aspects of the script but for my usage, it works. I'll play with this and eventually make a pull request.
Setting --save-img to true when processing a webcam input causes :
Traceback (most recent call last): File "classy_track.py", line 318, in
detect(args)
File "classy_track.py", line 256, in detect
fps = vid_cap.get(cv2.CAP_PROP_FPS)
AttributeError: 'NoneType' object has no attribute 'get'