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.
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.
-
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 .
-
Start Machine Learning backend on
http://localhost:9090
docker-compose up
-
Validate that backend is running.
$ curl http://localhost:9090/health {"status":"UP"}
-
Connect to the backend from Label Studio: go to your project
Settings -> Machine Learning -> Add Model
and specifyhttp://localhost:9090
as a URL.
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.
-
Clone the YOLOv5 repo and update
.env
with its path. -
Create and use a virtual environment (optional but highly recommended).
python3 -m venv .venv source .venv/bin/activate
-
Install dependencies.
pip install -r requirements.txt -r local_requirements.txt
-
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