Machine learning backend

You can easily connect your favorite machine learning framework with Label Studio by using Heartex SDK.

That gives you the opportunities to use:

Here is a quick example tutorial on how to do that with simple image classification:

  1. Clone pyheartex, and start serving example image classifier ML backend at http://localhost:9090
    git clone https://github.com/heartexlabs/pyheartex.git
    cd pyheartex/examples/docker
    docker-compose up -d
  1. Run Label Studio project specifying ML backend URLs:

    label-studio start imgcls --init --template image_classification \
    --ml-backend-url http://localhost:9090 --ml-backend-name my_model

Once you’re satisfied with pre-labeling results, you can immediately send prediction requests via REST API:

curl -X POST -H 'Content-Type: application/json' -d '{"image_url": "https://go.heartex.net/static/samples/sample.jpg"}' http://localhost:8200/predict

Note: There is a limitation of using ML backend with locally hosted files, i.e. you can’t train your models on tasks with URLs like {"url": "http://localhost:8200/static/image.png"}. URLs should be accessible from the outside.

Feel free to play around with any other models & frameworks apart from image classifiers! See instructions on how to connect existing models.

When something goes wrong, for example your predictions are failing, the first thing to do is to check the runtime logs

docker exec -it model_server sh -c "tail -n50 /tmp/wsgi.log"

To see what happens during model training, check training logs:

docker exec -it model_server sh -c "tail -n50 /tmp/rq.log"