-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
YOLO reduce original video's number of frame when inferring #13507
Comments
👋 Hello @KieuSonTung, thank you for your interest in Ultralytics YOLOv8 🚀! We recommend a visit to the Docs for new users where you can find many Python and CLI usage examples and where many of the most common questions may already be answered. If this is a 🐛 Bug Report, please provide a minimum reproducible example to help us debug it. If this is a custom training ❓ Question, please provide as much information as possible, including dataset image examples and training logs, and verify you are following our Tips for Best Training Results. Join the vibrant Ultralytics Discord 🎧 community for real-time conversations and collaborations. This platform offers a perfect space to inquire, showcase your work, and connect with fellow Ultralytics users. InstallPip install the pip install ultralytics EnvironmentsYOLOv8 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 Ultralytics CI tests are currently passing. CI tests verify correct operation of all YOLOv8 Modes and Tasks on macOS, Windows, and Ubuntu every 24 hours and on every commit. |
Hello! Thank you for reaching out and providing details about your issue. Let's address your concerns step-by-step. Frame Reduction IssueThe reduction in the number of frames from 48,000 to 24,000 suggests that the inference process might be skipping frames. This can happen due to the Could you please check if args['vid_stride'] = 1
model = DetectionPredictor(cfg=args)
results = model(source=video_path, stream=True) Reducing Video FPSYes, YOLO does support reducing the video's FPS during inference or training. You can achieve this by adjusting the args['vid_stride'] = 2 # Process every second frame
model = DetectionPredictor(cfg=args)
results = model(source=video_path, stream=True) Next Steps
If the issue persists after these steps, please provide a minimum reproducible example of your code. This will help us investigate further. You can refer to our minimum reproducible example guide for more details. Feel free to reach out if you have any more questions or need further assistance. We're here to help! 😊 |
Hi @glenn-jocher . Thank you so much for replying. I tried to adjust I used this code to print out the number of frames and fps video_path = '/data/test_video/T160-1_video.mp4'
cap = cv2.VideoCapture(video_path)
frame_count = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
fps = cap.get(cv2.CAP_PROP_FPS)
print('FRAME_COUNT', frame_count) and it returns 22833 frames And i ran this code to count the number of frames in the result output: args['vid_stride'] = 1
model = DetectionPredictor(cfg=args)
results = model(source=video_path, stream=True)
cnt = 0
for r in results:
cnt += 1
print(cnt) and it returns 11411 frames. What should I do next? Thank you so much. |
Hi @KieuSonTung, Thank you for providing additional details and the code snippets. Let's work together to resolve this issue. Steps to Investigate Further
Next Steps
By following these steps, we can better understand the issue and work towards a solution. Feel free to reach out if you have any more questions or need further assistance. We're here to help! 😊 |
Search before asking
Question
Hi everyone! I hope that someone can help me fix this.
I'm using DetectionPredictor from
ultralytics.models.yolo.detect
with my pre-trained model to infer a video. I used this line of codewhich
args
is a dictionary of custom parameters (device, project, name, batch).In the original video, there are 48000 frames. However, when I loop the
results
and count, there are only 24000 frames. How does this happen? And also, does YOLO support reducing video's FPS while inferring or training?Thank you so much!
Additional
No response
The text was updated successfully, but these errors were encountered: