Troubleshooting image loading issue in Label Studio with local storage paths

Question:

I’ve set LABEL_STUDIO_LOCAL_FILES_SERVING_ENABLED=true and LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=C:\User\YOLO\dataset\ to the environment. However, after converting my YOLO dataset with the Label Studio Converter to get a JSON with image paths, I can’t display the images in Label Studio—there’s an error loading the image URL.

Answer:

Ensure the environment variables are set properly before starting Label Studio. Use the following command to set them:

set LABEL_STUDIO_LOCAL_FILES_SERVING_ENABLED=true
set LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=C:\User\YOLO\dataset\
label-studio start

Modify your JSON to have correct relative paths based on your LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT. Your JSON paths should look like this:

[
  {
    "data": {
      "image": "/data/local-files/?d=train/images/004811b6-Cam_3340.jpg"
    },
    ...
  }
]

Re-import this amended JSON into Label Studio.

Go to Label Studio Settings > Cloud Storage, add new local storage with the “Local path” field set to C:\User\YOLO\dataset\train\images. Don’t sync storage, just let Label Studio know where images are located.

Try these steps and verify that the images load correctly. Make sure the image paths are accessible and that the environment variables are set in the session running Label Studio.