label-studio icon indicating copy to clipboard operation
label-studio copied to clipboard

[bug] YOLOv8 export with local storage produces empty images folder

Open KkemChen opened this issue 5 months ago • 9 comments

Describe the bug When using local storage and exporting in YOLOv8 format with images, the exported images folder is empty despite the annotations being exported correctly.

To Reproduce Steps to reproduce the behavior:

  1. Configure Label Studio to use local storage for image files
  2. Create a project with object detection tasks using local images
  3. Complete annotations on the images using bounding boxes/polygons
  4. Go to 'Export' in the project
  5. Select 'YOLOv8' export format
  6. Check 'Include images' option
  7. Click 'Export' button
  8. Download and extract the exported file
  9. Observe that the images folder is empty while annotations are present

Expected behavior The exported YOLOv8 format should include both:

  • Annotation files (.txt) in the correct YOLOv8 format
  • Original image files in the images folder
  • Proper directory structure for YOLOv8 training

Screenshots If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: [Ubuntu 20.04]
  • docker-compose deploy
  • Label Studio Version: [1.20.0]
  • Browser: [chrome 139]
  • Storage Type: Local Storage

Additional context

  • The issue only occurs when using local storage configuration
  • Annotations export correctly, only image files are missing
  • From the logs, local file paths are being resolved correctly: /localstorage/Cat/202412041734_474/20210203_200132_1356856722123128832_657.jpg
  • The system shows successful file path resolution but images don't appear in final export
  • This may be related to file copying or path resolution during the YOLOv8 export process

Logs

{"message": "Local Storage file path exists locally, use it as a local file: /localstorage/Cat/202412041734_474/20210203_200132_1356856722123128832_657.jpg"}

Possible related issues

  • File permission issues during export
  • Path resolution problems in YOLOv8 export handler
  • Local storage path not being correctly processed during image copying

KkemChen avatar Aug 20 '25 14:08 KkemChen

Hello,

What are the values of these environment variables?

export LABEL_STUDIO_LOCAL_FILES_SERVING_ENABLED=trueexport LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/absolute/path/to/your/images_rootAnd you can export via command line

https://labelstud.io/guide/export.html#Export-using-console-command

Thank you, Abu

Comment by Abubakar Saad Workflow Run

heidi-humansignal avatar Sep 18 '25 19:09 heidi-humansignal

Image

KkemChen avatar Sep 19 '25 04:09 KkemChen

Hello,

It seems there is not path that has been setup for LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT which is root directory. Would be possible to set these variables up.

Thank you, Abu

Comment by Abubakar Saad Workflow Run

heidi-humansignal avatar Sep 19 '25 14:09 heidi-humansignal

I have defined it correctly now, but the images in the exported file are still empty

Image Image

KkemChen avatar Sep 23 '25 07:09 KkemChen

I think I found the problem. The hostname here gets the IP address of my host machine. There is no port number, so I can't download the image here.

Image

下面是我完整的docker-compose.yml配置文件

version: "3.9"
services:
  nginx:
    build: .
    image: heartexlabs/label-studio:latest
    restart: unless-stopped
    ports:
      - "6060:80"
      - "8085:8085"
      - "8076:8086"
    depends_on:
      - app
    hostname: labelnginx
    user: "0:0"
    environment:
      - LABEL_STUDIO_LOCAL_FILES_SERVING_ENABLED=true
      - COLLECT_ANALYTICS=false
      - SENTRY_DSN=
      - FRONTEND_SENTRY_DSN=
      - LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/
    #   Optional: Specify SSL termination certificate & key
    #   Just drop your cert.pem and cert.key into folder 'deploy/nginx/certs'
    #      - NGINX_SSL_CERT=/certs/cert.pem
    #      - NGINX_SSL_CERT_KEY=/certs/cert.key
    volumes:
      - ./mydata:/label-studio/data:rw
      - ./deploy/nginx/certs:/certs:ro
      - ./localstorage:/localstorage
      - ./deploy/nginx/nginx.conf:/etc/nginx/nginx.conf
      - ./deploy/nginx/resolv.conf:/etc/nginx/resolv.conf
    #   Optional: Override nginx default conf
    #      - ./deploy/my.conf:/etc/nginx/nginx.conf
    command: nginx

  app:
    stdin_open: true
    tty: true
    user: "0:0"
    build: .
    image: heartexlabs/label-studio:latest
    restart: unless-stopped
    expose:
      - "8000"
    depends_on:
      - db
    privileged: true
    environment:
      - DJANGO_DB=default
      - POSTGRE_NAME=postgres
      - POSTGRE_USER=postgres
      - POSTGRE_PASSWORD=postgres
      - POSTGRE_PORT=5432
      - POSTGRE_HOST=db
      - LABEL_STUDIO_LOCAL_FILES_SERVING_ENABLED=true
      - ML_TIMEOUT_PREDICT=409600
      - COLLECT_ANALYTICS=false
      - SENTRY_DSN=
      - FRONTEND_SENTRY_DSN=
      - JSON_LOG=1
      - CSRF_TRUSTED_ORIGINS=http://192.168.1.172:8085
      - LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/
      - LOG_LEVEL=DEBUG
    volumes:
      - ./mydata:/label-studio/data:rw
      - ./localstorage:/localstorage
      - ./deploy/uwsgi.ini:/label-studio/deploy/uwsgi.ini
    command: label-studio-uwsgi


  db:
    image: pgautoupgrade/pgautoupgrade:13-alpine
    hostname: db
    restart: unless-stopped
    # Optional: Enable TLS on PostgreSQL
    # Just drop your server.crt and server.key into folder 'deploy/pgsql/certs'
    # NOTE: Both files must have permissions u=rw (0600) or less
    #    command: >
    #      -c ssl=on
    #      -c ssl_cert_file=/var/lib/postgresql/certs/server.crt
    #      -c ssl_key_file=/var/lib/postgresql/certs/server.key
    ports:
      - 5432:5432
    environment:
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_USER=postgres
    volumes:
      - ${POSTGRES_DATA_DIR:-./postgres-data}:/var/lib/postgresql/data
      - ./deploy/pgsql/certs:/var/lib/postgresql/certs:ro

KkemChen avatar Sep 23 '25 08:09 KkemChen

Hello,

Have you managed to resolve the issue? Please let us know if you need our support. we are happy to assist! Best Regards!

Comment by Oussama Assili Workflow Run

heidi-humansignal avatar Oct 06 '25 14:10 heidi-humansignal

Hello, Dear @heidi-humansignal I have the same problem, when I run label-studio with docker and add a local storage the export option does not work correctly and the image folder is empty. while when I remove the local storage it works well.

  • Consider the path is sync correctly and I checked env as bellow:
# echo $LABEL_STUDIO_LOCAL_FILES_SERVING_ENABLED
true
# echo $LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT
/label-studio/files

And I am using this docker-compose.yaml:

  services:
    label-studio:
      image: heartexlabs/label-studio:latest
      ports:
        - "8080:8080"
      volumes:
        - F:/Codes/LabelStudio/mydata:/label-studio/data
        # - F:/Codes/LabelStudio/dataset:/home/usr/dataset
        - F:/Codes/LabelStudio/myfiles:/label-studio/files
      user: root
      environment:
        CONVERTER_DOWNLOAD_RESOURCES: 1
        LABEL_STUDIO_API_KEY: ey......dtz0
        LABEL_STUDIO_LOCAL_FILES_SERVING_ENABLED: "true"
        LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT: /label-studio/files
        # LABEL_STUDIO_URL: "http://localhost:8080"
      stdin_open: true
      tty: true
 
  volumes:
    dataset:

alireza0r avatar Oct 07 '25 07:10 alireza0r

Hello,

Have you run into the same error the user above mentioned? If so, did you try the workaround suggested earlier? If the problem still occurs, could you please share your label configuration so we can take a closer look?

Best Regards!

Comment by Oussama Assili Workflow Run

heidi-humansignal avatar Oct 21 '25 11:10 heidi-humansignal

Same issue @heidi-humansignal

When use docker and YOLO with Images The labels folder is fine, but the images folder is empty

log

[label_studio_sdk._extensions.label_studio_tools.core.utils.io::get_local_path::90] [WARNING] Using `localhost` (http://localhost:8081/) in LABEL_STUDIO_URL, `localhost` is not accessible inside of docker containers. You can check your IP with utilities like `ifconfig` and set it as LABEL_STUDIO_URL.

env(I removed some info I think it's not related to)

HOME=/label-studio
LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/label-studio/files
PYTHONUNBUFFERED=1
LABEL_STUDIO_BASE_DATA_DIR=/label-studio/data
PYTHONDONTWRITEBYTECODE=1
LABEL_STUDIO_URL=host.docker.internal
LS_DIR=/label-studio
TERM=xterm
PATH=/label-studio/.venv/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
DJANGO_SETTINGS_MODULE=core.settings.label_studio
PYTHON_VERSION=3.13.7
LABEL_STUDIO_LOCAL_FILES_SERVING_ENABLED=true
OPT_DIR=/opt/heartex/instance-data/etc
PWD=/label-studio

version

{
  "release": "1.21.0",
  "label-studio-os-package": {
    "version": "1.21.0",
    "short_version": "1.21",
    "latest_version_from_pypi": "1.21.0",
    "latest_version_upload_time": "2025-09-30T06:48:47",
    "current_version_is_outdated": false
  },

  "label-studio-os-backend": {
    "message": "feat: BROS-353: Databricks storage integration (#8245) (#8542)",
    "commit": "5c988322ab98dc71c4dbc3a2e66159d588038888",
    "date": "2025/09/26 10:27:26",
    "branch": "",
    "version": "1.21.0+0.g5c98832"
  },

  "label-studio-frontend": {
    "message": "fix: BROS-389: Fix waveforms rendering for multi channels case (#8415)",
    "commit": "3d1fc618c10e0de7e161469fcfbde331cd347528",
    "date": "2025-09-16T22:21:39.000Z",
    "branch": "develop"
  },

  "dm2": {
    "message": "fix: FIT-641: 'Label Tasks As Displayed' is displayed outside the Labe ...",
    "commit": "a602b3c0a5b44f2bf7cc8ed05b4972b35e086bd5",
    "date": "2025-09-10T19:09:21.000Z",
    "branch": "develop"
  },

  "label-studio-converter": {
    "version": "2.0.4"
  },

  "edition": "Community"
}

abccbaandy avatar Dec 04 '25 08:12 abccbaandy

Hello,

Could you please run the following command and let us know if you have managed to export the images alongside the annotations. You can find the details in this documentation

label-studio export <project-id> <export-format> --export-path=<output-path>

Best Regards!

Comment by Oussama Assili Workflow Run

heidi-humansignal avatar Dec 16 '25 17:12 heidi-humansignal

Hello,

Could you please run the following command and let us know if you have managed to export the images alongside the annotations. You can find the details in this documentation

label-studio export <project-id> <export-format> --export-path=<output-path>

Best Regards!

Comment by Oussama Assili Workflow Run

No, still emtpy. And your doc link is broken.

abccbaandy avatar Dec 17 '25 07:12 abccbaandy