roboflow / roboflow-python

The official Roboflow Python package. Manage your datasets, models, and deployments. Roboflow has everything you need to build a computer vision application.
https://docs.roboflow.com/python
Apache License 2.0
271 stars 70 forks source link

Can Video Inference be Done for fps >30? #281

Closed okay-ok closed 1 month ago

okay-ok commented 1 month ago

I'm just a newbie looking through the code on this repo....i was reading the video inference part and it seems that fps higher than 30 is not supported... I just wanted to know if it would be possible for us to somehow slow-down the given video file(Set of frames) to be refactored at a lower fps

for e.g. convert a 10 second 60 fps clip to a 20 second 30 fps clip, then infer, and relay the video back at 60 fps.

Sorry if this is obviously wrong/not useful...just thought maybe it could work.

I'm also not sure if the 60 fps actually doesn't work or I'm reading something not used.

Alternatively, for 60 fps could we just take every second frame, find the bounding boxes and for the remaining half frames, maybe take the average of the bounding boxes present in both in the previous and next frames

(like maybe the car-1's bounding box moves from x=3 to x=5 from frame 1 to frame 3, then maybe just display a bounding box at x=4 on frame-2 (for which we didn't infer).

IDK how we would detect that we have the same bounding box in the next frame, maybe by similar areas and positions, or another nn?

IDK where else to ask, hopefully not wasting your time, any help is appreciated!

yeldarby commented 1 month ago

Hi @okay-ok, I think you're talking about the Roboflow hosted API for async video. You generally don't need to infer at the native frame rate of the video. Often 2-5 frames per second is more than sufficient for common use-cases. And you're correct, you can overlay that back over the video. We even have a prediction interpolation helper in supervision to help smooth things out when you're upsampling.

If you truly do need 60fps predictions you can definitely do that with inference, our open source package that powers our hosted APIs, running on your own compute.