Set of tools and scripts to leverage LabelStudio to
import/export/check annotations made by CV models.
- Import the ultralytics dataset
uv run label-studio-converter import yolo \
-i ./datasets/ultralytics/coco8/ \
-o data/import/ls-tasks.json \
--image-root-url "http://localhost:8000/ultralytics/coco8/images/"- Start the label-studio environment
docker compose up- Follow the instructions from the import command to import data into label studio
- Select the Export button in the Project > YOLO with Images
- All the label txt files have their updated bbox coords
- The datasets are located in
./datasetsand the folder will be served statically by the HTTP server. ./mydatais used by label-studio to store data locally../dockercontains the Dockerfiles
This is the coco8-import dataset:
.
├── classes.txt
├── images
│ ├── 000000000009.jpg
│ ├── 000000000025.jpg
│ ├── 000000000030.jpg
│ └── 000000000034.jpg
└── labels
├── 000000000009.txt
├── 000000000025.txt
├── 000000000030.txt
└── 000000000034.txtThe classes.txt file should contain all classes in the right order:
person
bicycle
car
motorcycle
airplane
...
teddy bear
hair drier
toothbrushStart label-studio and a local HTTP server to serve images from a dataset:
docker compose upNote: Label Studio is started on port 8080 and the HTTP static server on port 8000.
Import a Ultralytics dataset:
uv run label-studio-converter import yolo \
-i ./datasets/ultralytics/coco8/ \
-o data/import/ls-tasks.json \
--image-root-url "http://localhost:8000/ultralytics/coco8/images/"Note: It will generate a ls-tasks.json and a ls-tasks.label_config.xml
files that can be imported in a label studio project.
Deploy LabelStudio to AWS using the provided Terraform configuration:
- Terraform installed
- AWS CLI configured with appropriate credentials
- An AWS account with necessary permissions
-
Navigate to the terraform directory:
cd terraform/ -
Copy and configure variables:
cp terraform.template.tfVars terraform.tfVars
Edit
terraform.tfVarswith your values:s3_bucket_name: Unique S3 bucket name for storing LabelStudio datadb_username: PostgreSQL database usernamedb_password: Secure PostgreSQL database passworddb_name: Database name (default: labelstudio)labelstudio_username: Admin username for LabelStudiolabelstudio_password: Admin password for LabelStudiolabelstudio_token: Random token for API accessaws_region: AWS region (default: us-west-2)instance_type: EC2 instance type (default: t3.small)
-
Initialize Terraform:
terraform init
-
Plan the deployment:
terraform plan -var-file="terraform.tfVars" -
Apply the configuration:
terraform apply -var-file="terraform.tfVars" -
Access LabelStudio: After deployment, use the output
instance_ipto access LabelStudio athttp://<instance_ip>
The Terraform configuration creates:
- EC2 Instance: Runs LabelStudio in Docker container
- RDS PostgreSQL: Database for LabelStudio data
- S3 Bucket: Storage for uploaded files and exports
- IAM Roles/Policies: Secure access between services
- Security Groups: Network access controls
To destroy the infrastructure:
terraform destroy -var-file="terraform.tfVars"