Object Detection

Object Detection1. Model Introduction2. Target Prediction: ImageEffect preview3. Target prediction: videoEffect preview4. Target prediction: real-time detection4.1. USB cameraEffect preview4.2, CSI cameraEffect previewReferences

Use Python to demonstrate the effects of Ultralytics: Object Detection in images, videos, and real-time detection.

1. Model Introduction

Object detection is a task that involves identifying the location and category of objects in an image or video stream.

The output of an object detector is a set of bounding boxes that surround objects in an image, as well as the class label and confidence score for each bounding box. If you need to identify objects of interest in a scene, but do not need to know the specific location or exact shape of the object, then object detection is a good choice.

2. Target Prediction: Image

Use yolo11n.pt to predict the pictures that come with the ultralytics project.

Enter the code folder:

Run the code:

Effect preview

Yolo recognition output image location: /home/pi/ultralytics/ultralytics/output/

image-20241228154717085

Sample code:

3. Target prediction: video

Use yolo11n.pt to predict the video under the ultralytics project (not the video that comes with ultralytics).

Enter the code folder:

Run the code:

Effect preview

Video location of yolo recognition output: /home/pi/ultralytics/ultralytics/output/

image-20241228155000451

Sample code:

4. Target prediction: real-time detection

4.1. USB camera

Use yolo11n.pt to predict the USB camera screen.

Enter the code folder:

Run the code: Click the preview screen and press the q key to terminate the program!

Effect preview

Yolo recognizes the output video location: /home/pi/ultralytics/ultralytics/output/

image-20241228160354642

Sample code:

4.2, CSI camera

Use yolo11n.pt to predict the CSI camera image.

Enter the code folder:

Run the code: Click the preview image, press the q key to terminate the program!

Effect preview

Yolo recognizes the output video location: /home/pi/ultralytics/ultralytics/output/

image-20241230153244636

Sample code:

References

https://docs.ultralytics.com/tasks/detect/