Why the output file is empty when I use detect()from webcam ?
I use windows10.
Why the output folder is empty?
python detect.py --source 0 --output inference\output\test.demo
Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.4, device='', img_size=640, iou_thres=0.5, output='inference\output\test.demo', save_txt=False, source='0', update=False, view_img=False, weights='yolov5s.pt')
Using CUDA device0 _CudaDeviceProperties(name='GeForce MX150', total_memory=2048MB)
Fusing layers...
Model Summary: 140 layers, 7.45958e+06 parameters, 6.61683e+06 gradients
1/1: 0... success (640x480 at 30.00 FPS).
......
0: 512x640 2 persons, 2 tvs, Done. (0.028s)
0: 512x640 2 persons, 1 chairs, 2 tvs, Done. (0.032s)
0: 512x640 2 persons, 1 chairs, 2 tvs, Done. (0.033s)
0: 512x640 2 persons, 1 chairs, 2 tvs, Done. (0.028s)
Done. (18.484s)
Hello @19fchen, thank you for your interest in our work! Please visit our Custom Training Tutorial to get started, and see our Jupyter Notebook , Docker Image, and Google Cloud Quickstart Guide for example environments.
If this is a bug report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.
If this is a custom model or data training question, please note Ultralytics does not provide free personal support. As a leader in vision ML and AI, we do offer professional consulting, from simple expert advice up to delivery of fully customized, end-to-end production solutions for our clients, such as:
For more information please visit https://www.ultralytics.com.
Hi, I did a quick test and did not see any output too! Also I'm not sure what the output's extension is supposed to be.
python detect.py --source 0 --output inference\output # 1
python detect.py --source 0 --output inference\output\vid.mp4 # 2 (or other extension like avi)
I did a quick look and found the below. We need the below to save the image/vid.
https://github.com/ultralytics/yolov5/blob/08e97a2f884a9090abb890298dd1d47611a3e249/detect.py#L125
but, it's set to False at init
https://github.com/ultralytics/yolov5/blob/08e97a2f884a9090abb890298dd1d47611a3e249/detect.py#L21
and only when viewing non-webcam would it be set to True
https://github.com/ultralytics/yolov5/blob/08e97a2f884a9090abb890298dd1d47611a3e249/detect.py#L49-L55
I then tried to change it to True, but ran into more errors. For example, the mode is set to 'image'.
which would attempt to write the output as an img file and not a VideoStream.
https://github.com/ultralytics/yolov5/blob/08e97a2f884a9090abb890298dd1d47611a3e249/detect.py#L126-L139
If we were to change the mode, there would errors with missing self.frame variable. Also, the only time mode is set to 'video' is within the LoadImages function and not LoadStream.
All in all, I think there should be a better way to do this than messing with everything..
@19fchen @NanoCode012 webcams are not saved. They're just meant for realtime demos. You can save detections with --save-txt.
@19fchen @NanoCode012 webcams are not saved. They're just meant for realtime demos. You can save detections with --save-txt.
Thank you for your help.
Hi, I did a quick test and did not see any output too! Also I'm not sure what the output's extension is supposed to be.
python detect.py --source 0 --output inference\output # 1 python detect.py --source 0 --output inference\output\vid.mp4 # 2 (or other extension like avi)I did a quick look and found the below. We need the below to save the image/vid.
https://github.com/ultralytics/yolov5/blob/08e97a2f884a9090abb890298dd1d47611a3e249/detect.py#L125
but, it's set to False at init
https://github.com/ultralytics/yolov5/blob/08e97a2f884a9090abb890298dd1d47611a3e249/detect.py#L21
and only when viewing non-webcam would it be set to True
https://github.com/ultralytics/yolov5/blob/08e97a2f884a9090abb890298dd1d47611a3e249/detect.py#L49-L55
I then tried to change it to True, but ran into more errors. For example, the mode is set to 'image'.
which would attempt to write the output as an img file and not a VideoStream.
https://github.com/ultralytics/yolov5/blob/08e97a2f884a9090abb890298dd1d47611a3e249/detect.py#L126-L139
If we were to change the
mode, there would errors with missingself.framevariable. Also, the only timemodeis set to 'video' is within theLoadImagesfunction and notLoadStream.All in all, I think there should be a better way to do this than messing with everything..
Uhm, I think I should understand the source code first. Thank you for your help.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.