[go: up one dir, main page]

Skip to content

Interactive Semi Automatic Labeling with Ultralytics and Label Studio

Notifications You must be signed in to change notification settings

danielsyahputra/label-studio-semi-automatic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Semi Automatic Labelling with Ultralytics and Label Studio

Quickstart

Before using this repository, make sure you are already running label studio. You can see the Installation Docs for the installation. I recommend you to run it using Docker. Here is what command I used for running the label studio.

mkdir -p ~/Documents/Personal/label-studio
cd ~/Documents/Personal/label-studio

You change change the path according to your preferences.

docker run -it --user root -p {PORT}:8080 -v $(pwd)/mydata:/label-studio/data --env LABEL_STUDIO_LOCAL_FILES_SERVING_ENABLED=true --env LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/label-studio/files -v $(pwd)/myfiles:/label-studio/files heartexlabs/label-studio:latest label-studio

Note: Change value of PORT based on your preferences. The command above will mount your local storage to label studio container, check out this Sync to Local Storage documentation for more information.

Once the program is succesfully running, you can go to http://localhost:{PORT}

Running Machine Learning Backend

Please, make sure you already running the label studio, then

Clone the repo

git clone <ENTER_REPO_HTTP_OR_SSH_PATH>

cd label-studio-semi-automatic

Edit the .env file

cp .env-examples .env
  • BACKEND_PORT is the port that you want to used to run the ML Backend
  • LABEL_STUDIO_BASEURL is label studio local url that is already running. e.g (192.168.42.42:{PORT})
  • LABEL_STUDIO_API_TOKEN is API token for your label studio
  • MODEL_DIR the directory that contains .pt and .yaml file. I recommend you to make a directory in weights folder. Example: weights/person will consists <name>.pt and <name>.yaml

Note:

  • If you are running the ML backend in Docker, LABEL_STUDIO_URL can’t contain localhost or 0.0.0.0. Use the full IP address instead, e.g. 192.168.42.42. You can get this using the ifconfig (Unix) or ipconfig (Windows) commands.
  • The content of .yaml file have to look something like this
names:
    - person
    - class_2
    - class_3
    .
    .
    .

Build and start machine learning backend

sudo docker-compose up -d --build

Check if it works:

$ curl http://localhost:{BACKEND_PORT}/health

{"model_dir":"weights/person","status":"UP","v2":false}

Create Project and Import Dataset

Create a Project

I assume that you know and already made a project in Label Studio, simply just click the Create button on top-left of you label studio UI, then set up your setting such as labels (don't forget to add label names), and also type of annotation which is Object Detection with Bounding Box.

Import Dataset

You can simply import the dataset by click Go to import then drag your dataset. But, this method can't be done if your dataset is big. So, I recommend you to synchronize the label studio to local storage or using cloud storage service. Now, I'll show you how to synchronize label studio into your local storage.

Go to Settings >> Cloud Storage >> Add Source Storage >> Storage Type >> Local Storage

Then, add your storage title (optional), and absolute local path. Remember in the Quickstart, I already add a command where your local storage will be mount to label studio container, check out this LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/label-studio/files part.

So, if before your ran the quickstart command in ~/Documents/Personal/label-studio, then, the myfiles folder will be created inside of that directory. You can move or copy a folder that contains all you images to annotate inside myfiles. Example, we have a dataset contains of images named person_dataset, then, copy the person_dataset into ~/Documents/Personal/label-studio/myfiles. At the end you will have a directory ~/Documents/Personal/label-studio/myfiles/person_dataset in your local that contains a bunch of images.

Then, edit your Absolute local path to be /label-studio/files/person_dataset, activate the toggle button, and Check connection. Finally, you can click Sync Storage

Note: See quickstart command where there's a mounting process to /label-studio/files from your local storage.

Connect to Machine Learning Backend

Go to Settings >> Model >> Enter Name >> Enter Backend URL >> Activate Interactive preannotations >> Validate and Save.

Note: If you are running the ML backend in Docker, backend url can’t contain localhost or 0.0.0.0. Use the full IP address instead, e.g. 192.168.42.42. You can get this using the ifconfig (Unix) or ipconfig (Windows) commands. So, the backend url will be something like this http://192.168.100.79:{BACKEND_PORT}

Then, setup you annotations settings

Go to Settings >> Annotations >> Activate Show before labeling >> Activate Use predictions to prelabel tasks >> Select which prediction that you want to use >> Save

Enjoy Your Annotating Process

Once all the steps are already completed, you can go back to the project and start your annotation. Enjoy your annotating process :)

About

Interactive Semi Automatic Labeling with Ultralytics and Label Studio

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published