YAML Metadata Warning: empty or missing yaml metadata in repo card (https://huggingface.co/docs/hub/model-cards#model-card-metadata)

YOLOv8

This repository contains the YOLOv8 model weights (yolov8n.pt) for object detection. YOLOv8 is an advanced version of the YOLO (You Only Look Once) series of real-time object detection models.

Documentation

See below for a quickstart installation and usage example, and see the YOLOv8 Docs for full documentation on training, validation, prediction and deployment.

CLI

YOLOv8 may be used directly in the Command Line Interface (CLI) with a yolo command:

yolo predict model=yolov8n.pt source='https://ultralytics.com/images/bus.jpg'

Python

To use this model for object detection, follow these steps:

from ultralytics import YOLO

# Load a model
model = YOLO("yolov8n.yaml")  # build a new model from scratch
model = YOLO("yolov8n.pt")  # load a pretrained model (recommended for training)

# Use the model
model.train(data="coco128.yaml", epochs=3)  # train the model
metrics = model.val()  # evaluate model performance on the validation set
results = model("https://ultralytics.com/images/bus.jpg")  # predict on an image
path = model.export(format="onnx")  # export the model to ONNX format

For more examples and detailed usage instructions, visit the YOLOv8 Python Docs.

Example usage

code for performing object detection

# Install the import necessary dependencies:
pip install ultralytics
pip install opencv-python

import cv2
from ultralytics import YOLO


def detect_objects(model_path, image_path1, image_path2):  

    # Read images  
    input_image1 = cv2.imread(image_path1)
    input_image2 = cv2.imread(image_path2)

    # Load a model
    model = YOLO(model_path)

    # Run batched inference on a list of images
    results = model([input_image1, input_image2])  # return a list of Results objects

    # Process results list
    for result in results:
        boxes = result.boxes  # Boxes object for bounding box outputs
        labels = result.cls  # labels object for detceted classes outputs
        probs = result.probs  # Probs object for classification outputs
        result.show()  # display to screen
        result.save(filename="result.jpg")  # save to disk

# Example usage
model_path = 'YOLOv8\yolov8n.pt'
image_path1 = "path_to_your_image.jpg"
image_path2 = "path_to_your_image.jpg"
detect_objects(model_path, image_path1, image_path2)
@article{YOLOv8,
  title={YOLOv8: Improved Object Detection with Enhanced Performance},
  author={Muhammad Shahin},
  journal={Hugging Face Models},
  year={2024},
  url={link_to_your_huggingface_model}
}
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference API
Unable to determine this model's library. Check the docs .