-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
29 lines (22 loc) · 941 Bytes
/
test.py
File metadata and controls
29 lines (22 loc) · 941 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from ultralytics import YOLO
def main():
model = YOLO("best.pt")
print("Running prediction on the 'test' image folder...")
model.predict(
source="C:/Users/agcoe/src/cos791_assignment_2/cheetah_data/cheetah_test",
save=True,
name="test_image_results", # A folder name for the saved images
)
print("Test image predictions saved to 'runs/detect/test_image_results'")
print("-------------------------------------------\n")
VIDEO_FILE_PATH = "test_videos\cheetah_1.mp4"
print(f"Running prediction on video: {VIDEO_FILE_PATH}...")
model.predict(
VIDEO_FILE_PATH,
save=True, # This saves a new video with the boxes drawn on
name="test_video_result", # A folder name for the saved video
)
print("Video prediction complete!")
print("Your new video is saved in the 'runs/detect/test_video_result' folder.")
if __name__ == "__main__":
main()