Skip to content

Viam modular computer vision service for YOLOv8 inference

License

Notifications You must be signed in to change notification settings

viam-labs/YOLOv8

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YOLOv8 modular service

This module implements the RDK vision API in a viam-labs:vision:yolov8 model.

This model leverages the Ultralytics inference library to allow for object detection and classification from YOLOv8 models.

Both locally deployed YOLOv8 models and models from web sources like HuggingFace can be used (HuggingFace models will be downloaded and used locally).

Example screen recording of usage

Build and Run

To use this module, follow these instructions to add a module from the Viam Registry and select the viam-labs:vision:yolov8 model from the viam-labs YOLOv8 module.

Configure your vision service

Note

Before configuring your vision service, you must create a machine.

Navigate to the Config tab of your robot’s page in the Viam app. Click on the Components subtab and click Create component. Select the vision type, then select the viam-labs:vision:yolov8 model. Enter a name for your vision and click Create.

On the new component panel, copy and paste the following attribute template into your vision service's Attributes box:

{
  "model_location": "<model_path>"
}

Note

For more information, see Configure a Robot.

Attributes

The following attributes are available for viam-labs:vision:yolov8 model:

Name Type Inclusion Description
model_location string Required Local path or HuggingFace model identifier

Example Configurations

HuggingFace model:

{
  "model_location": "keremberke/yolov8n-hard-hat-detection"
}

Local YOLOv8 model:

{
  "model_location": "/path/to/yolov8n.pt"
}

API

The YOLOv8 resource provides the following methods from Viam's built-in rdk:service:vision API

get_detections(image=binary)

get_detections_from_camera(camera_name=string)

Note: if using this method, any cameras you are using must be set in the depends_on array for the service configuration, for example:

      "depends_on": [
        "cam"
      ]

get_classifications(image=binary)

get_classifications_from_camera(camera_name=string)

Note: if using this method, any cameras you are using must be set in the depends_on array for the service configuration, for example:

      "depends_on": [
        "cam"
      ]

About

Viam modular computer vision service for YOLOv8 inference

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published