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

extract_frames.py 705 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. # script used for extracting frames from the videos
  2. from utils import FrameExtractor
  3. import os
  4. from config import VIDEOS_DIR, VIDEO_NAMES_DIR, RAW_IMAGES_DIR, CLASSES
  5. if __name__ == "__main__":
  6. for class_name in CLASSES:
  7. print(f"Extracting images for class {class_name}...")
  8. dest_dir = os.path.join(RAW_IMAGES_DIR, class_name)
  9. os.makedirs(dest_dir, exist_ok=True)
  10. fe = FrameExtractor(os.path.join(VIDEOS_DIR, VIDEO_NAMES_DIR[class_name]))
  11. fe.extract_frames(every_x_frame=50,
  12. skip_seconds=60,
  13. img_name=class_name,
  14. dest_path=dest_dir)
  15. print("done.")
Tip!

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

Comments

Loading...