-
-
Notifications
You must be signed in to change notification settings - Fork 16.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why didn't I get results in my video test? #2277
Comments
👋 Hello @Kylinb, thank you for your interest in 🚀 YOLOv5! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution. 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 training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available. For business inquiries or professional support requests please visit https://www.ultralytics.com or email Glenn Jocher at glenn.jocher@ultralytics.com. RequirementsPython 3.8 or later with all requirements.txt dependencies installed, including $ pip install -r requirements.txt EnvironmentsYOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
StatusIf this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), testing (test.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit. |
@Kylinb we use cv2 for video loading, so you may want to create a simple cv2 loop to see what's going wrong. You might also try exporting to a different format, or using one of our verified environments in the message above. |
Hi , @glenn-jocher @Kylinb I'm also getting same issue.
I think it trying to open video via cv2.show and this method is not working on colab. So , How can I saved detected bounding box generated video with save (TXT , Labels) etc.like image ? Thanks , |
@VinayChaudhari1996 inference works correctly in Colab notebook on videos. Tested myself today March 4th. |
To save txt use --save-txt. See detect.py argparser for all arguments. |
@Kylinb Hi, Buddy! I think I find what is your problem. You need pay attention to your video encoding format. I just test some videos. And when I test a video with encoding format of 'hevc'(‘hevc’ is just a encoding style of H.265. But what you are using in OpenCV with H.264 encoding format. ), the process was getting no results. Maybe you should modify the code of the encoding format of reading video with OpenCV, or there is just no encoder for 'hevc' format in your system, or you can just transform your videos in H.264 encoding format. |
@JOSHUAWENJZ ok! Yes as you said we use cv2 for video reading, so the videos must be openable by cv2 for YOLOv5 inference to work. |
@glenn-jocher @Kylinb I want to add some advice. Here is a simple solution. Just modify line 134 in detect.py as below. |
@JOSHUAWENJZ so you would recommend hardcoding an FPS in detect.py L134 for better robustness to cv2 property retrieval issues there? |
@glenn-jocher Yes. If you know the FPS of input video, just fix fps in detect.py L134. BUT I think there should be a better solution. And I will try to get right FPS and frame number of H.265 video, that is the best solution. : ) |
@JOSHUAWENJZ right, we want a robust solution that swaps in a default FPS on check failures. I don't think we can hard code 25 or 30 because then if someone runs a 60 FPS video for example then the output inference video will play at half speed. There are a number of checks functions here in general.py, this would probably be the right place for a check_FPS() function. If you'd like to submit a PR for this that would be great! Lines 55 to 146 in 886f1c0
|
root causeplease check the code line at: def isdocker():
# Is environment a Docker container
return Path('/workspace').exists() # or Path('/.dockerenv').exists() solution:Ensure there is no 'workspace' word in your full path. |
@riskycheng this should only return True if the root directory is called |
Hi @glenn-jocher , |
Hi,author!
/home/kylinb/anaconda3/envs/yolov5/bin/python /home/kylinb/PycharmProjects/yolov5/detect.py
Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.25, device='', exist_ok=False, img_size=640, iou_thres=0.45, name='exp', project='runs/detect', save_conf=False, save_txt=False, source='/home/kylinb/PycharmProjects/yolov5/1.mp4', update=False, view_img=False, weights='/home/kylinb/PycharmProjects/yolov5/runs/train/exp2/weights/best.pt')
YOLOv5 v4.0-63-g73a0669 torch 1.7.1 CUDA:0 (GeForce RTX 2070 with Max-Q Design, 7982.3125MB)
Fusing layers...
Model Summary: 224 layers, 7056607 parameters, 0 gradients, 16.3 GFLOPS
video 1/1 (1/-9223372036854775808) /home/kylinb/PycharmProjects/yolov5/1.mp4: 384x640 4 pigs, Done. (0.009s)
That's the problem. When I test a video,the result just like above. No video display, no video save. But the folder 'exp' would be created. Obviously, the folder is empty. It works only when testing pictures.
The text was updated successfully, but these errors were encountered: