Skip to content

Unofficial translation layer between Label Studio and YOLOv5.

Notifications You must be signed in to change notification settings

cejohnson/label-studio-yolov5

Repository files navigation

Label Studio YOLOv5

This repo is a translation layer between YOLOv5 and Label Studio. It is not officially associated with either project in any way.

The translation layer can be used in a Label Studio ML backend, or it can be used in conjunction with the Label Studio API.

Environment

Regardless of use case, set up your environment by copying example.env to .env and filling in the necessary information. This .env file will then be automatically used for different workflows.

Label Studio Machine Learning Backend

  1. Build the container for your architecture. As of November 2023, most computers use the x86/64 architecture. A notable exception is Macs using Apple Silicon (M1/M2/M3/...).

    x86/64:

    docker build -t label-studio-yolov5 .

    ARM64:

    docker build -f Dockerfile.arm -t label-studio-yolov5 .
  2. Start Machine Learning backend on http://localhost:9090

    docker-compose up
  3. Validate that backend is running.

    $ curl http://localhost:9090/health
    {"status":"UP"}
  4. Connect to the backend from Label Studio: go to your project Settings -> Machine Learning -> Add Model and specify http://localhost:9090 as a URL.

Running the Prediction Script

The predict script can be used to create predictions for Label Studio tasks using the Label Studio API. It will iterate through tasks for a given project (and optionally view/tab) and create predictions for each. Configuration is done through the .env file.

Prerequisites

  1. Clone the YOLOv5 repo and update .env with its path.

  2. Create and use a virtual environment (optional but highly recommended).

    python3 -m venv .venv
    source .venv/bin/activate

Running

  1. Install dependencies.

    pip install -r requirements.txt -r local_requirements.txt
  2. Run the script.

    python predict.py

    Options:

    Dry run (doesn't create predictions in Label Studio but performs all other processing).

    python predict.py --dry-run

    Specify env file:

    python predict.py --env-file ENV_FILE

About

Unofficial translation layer between Label Studio and YOLOv5.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published