YOLO v8 What's different?

YOLO v8 What's different?

2023, Nov 13    

YOLOv8 is the latest version of the YOLO (You Only Look Once) series of real-time object detectors, offering cutting-edge performance in terms of accuracy and speed. It was developed by Ultralytics, who also created the influential and industry-defining YOLOv5 model. YOLOv8 builds on the success of previous versions, introducing new features and improvements for enhanced performance, flexibility, and efficiency.

YOLOv8 can be used for various tasks such as object detection, image classification, and instance segmentation. It employs state-of-the-art backbone and neck architectures, resulting in improved feature extraction and object detection performance. YOLOv8 adopts an anchor-free split Ultralytics head, which contributes to better accuracy and a more efficient detection process compared to anchor-based approaches.

Compared to its predecessors, YOLOv8 introduces several architectural and developer experience improvements. It is faster and more accurate than YOLOv5. All v8 models see a +4 to +9 mAP increase from v5 for a similar runtime. YOLOv8 is under active development as of writing this post, as Ultralytics work on new features and respond to feedback from the community.

YOLOv8 is designed to detect things in a single stage, meaning it makes predictions about the placements of elements in an image as well as the types of those elements at the same time. To enable YOLOv8 to function effectively, the input image must first be divided into a grid of cells. YOLOv8 can guess the bounding boxes and label classes associated with each cell based on informed guesses.

After YOLOv8 has completed its predictions, it removes the bounding boxes that are unlikely to occur. Each bounding box has been allocated a confidence score to help with this process. YOLOv8 will combine the leftover bounding boxes together after processing all of the other bounding boxes. This is done to eliminate the potential of making several observations of the same thing.

In conclusion, YOLOv8 expands on the foundation set by its predecessors by introducing a variety of new and updated features. It is faster and more accurate than its predecessors while maintaining its famed precision.

To use YOLOv8 in VSCode, you can follow these steps:

  1. Install YOLOv8: You can install YOLOv8 via the ultralytics pip package for the latest stable release or by cloning the Ultralytics GitHub repository for the most up-to-date version. Here is how you can install it using pip:
     pip install ultralytics
    

    Or, you can install it directly from the GitHub repository:

     pip install git+https://github.com/ultralytics/ultralytics.git@main
    
  2. Import YOLOv8: Once installed, you can import YOLOv8 into your Python script as follows:
     from ultralytics import YOLO
     model = YOLO('yolov8n.pt')
    
  3. Train the Model: If you want to train the model on a custom dataset, you can do so as follows:
     results = model.train(data='coco8.yaml', epochs=100, imgsz=640)
    
  4. Run Inference: To run inference with the YOLOv8 model on an image, you can use the following code:
     results = model('path/to/bus.jpg')
    
  5. Use YOLOv8 with CLI: The Ultralytics command line interface (CLI) allows for simple single-line commands without the need for a Python environment. You can simply run all tasks from the terminal with the yolo command². For example, to run prediction, you can use:
     yolo predict model=yolov8n.pt imgsz=640 conf=0.25
    

Remember to replace 'yolov8n.pt' and 'path/to/bus.jpg' with the path to your model and image file, respectively. Also, replace 'coco8.yaml' with the path to your dataset file if you’re training the model.

Please note that you should have the Git command-line tool installed on your system if you want to install the ultralytics package directly from the GitHub repository. Also, PyTorch requirements vary by operating system and CUDA requirements, so it’s recommended to install PyTorch first following instructions at pytorch.org.