predict.py 659 B

1234567891011121314
  1. from ultralytics import YOLO
  2. # Load an official or custom model
  3. model = YOLO('yolov8m.pt') # Load an official Detect model
  4. #model = YOLO('yolov8n-seg.pt') # Load an official Segment model
  5. #model = YOLO('yolov8n-pose.pt') # Load an official Pose model
  6. #model = YOLO('path/to/best.pt') # Load a custom trained model
  7. # Perform tracking with the model
  8. results = model.predict(source=0, show=True) #
  9. #results = model.track(source="https://www.youtube.com/watch?v=6n5d1C1Alh4", show=True) # Tracking with default tracker
  10. #results = model.track(source="https://youtu.be/LNwODJXcvt4", show=True, tracker="bytetrack.yaml") # Tracking with ByteTrack tracker