Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

detection_predict_video.py 846 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
  1. import requests
  2. import torch
  3. from super_gradients.common.object_names import Models
  4. from super_gradients.training import models
  5. # Note that currently only YoloX and PPYoloE are supported.
  6. model = models.get(Models.YOLOX_N, pretrained_weights="coco")
  7. # We want to use cuda if available to speed up inference.
  8. model = model.to("cuda" if torch.cuda.is_available() else "cpu")
  9. video_path = "pose_elephant_flip.mp4"
  10. # Download the video to the local file system.
  11. with open(video_path, mode="wb") as f:
  12. response = requests.get("https://deci-pretrained-models.s3.amazonaws.com/sample_images/pose_elephant_flip.mp4")
  13. f.write(response.content)
  14. predictions = model.predict(video_path)
  15. predictions.show()
  16. predictions.save("pose_elephant_flip_prediction.mp4")
  17. predictions.save("pose_elephant_flip_prediction.gif") # Can also be saved as a gif.
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...