From a3e9eb5a4c4ad59040324e07cb56a5cf8ecd7efe Mon Sep 17 00:00:00 2001 From: Max Tkachenko Date: Thu, 18 Apr 2024 01:31:09 +0100 Subject: [PATCH 01/16] docs: Add tutorial on how to convert YOLO to LS --- README.md | 128 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 112 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index c42a0084..5e9cff93 100644 --- a/README.md +++ b/README.md @@ -261,15 +261,57 @@ Corresponding annotations could be found in `tmp/voc-annotations/*.xml`: Use cases: image object detection -### YOLO to Label Studio converter +# YOLO to Label Studio converter -Usage: +1. label-studio-converter import yolo -i YOLO/datasets/test1 -o output.json --image-root-url "/data/local-files/?d=test1/images" +2. http://localhost:8080/data/local-files/?d=test1/images/p10.jpg +3. LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/Users/amir.giveon/GoogleDrive/projects/K1/YOLO/datasets/ +4. Local Storage `Absolute local path` (displayed as `Path` on the storage card) /Users/amir.giveon/GoogleDrive/projects/K1/YOLO/datasets/test1/images + + +--image-root-url "/data/local-files/?d=images" +label-studio-converter import yolo -i /yolo/root/directory +LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/yolo/root/directory + +### YOLO directory structure + +Check the structure of YOLO folder first, keep in mind that the root is `/yolo/root/directory`. + +``` +/yolo/root/directory + images + - 1.jpg + - 2.jpg + - ... + labels + - 1.txt + - 2.txt + + classes.txt +``` + +**classes.txt example** + +``` +Airplane +Car +``` + +### Usage ``` label-studio-converter import yolo -i /yolo/root/directory -o ls-tasks.json ``` -Help: +**Note** + * if you use Local Storage, you should point the Label Studio environment variable `LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/yolo/root/directory` to the same directory as you used in `-i` parameter. + * If you want to use `LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/yolo/root` (one level up relative to `-i`), you need to specify `--image-root-url`: + ``` + label-studio-converter import yolo -i /yolo/root/directory -o ls-tasks.json --image-root-url "/data/local-files/?d=images" + ``` + + +**Help command** ``` label-studio-converter import yolo -h @@ -299,28 +341,82 @@ optional arguments: image extension to search: .jpg, .png ``` -YOLO export folder example: +## Tutorial: Importing YOLO Pre-Annotated Images to Label Studio using Local Storage + +This tutorial will guide you through the process of importing a folder with YOLO annotations into Label Studio for further annotation. +We'll cover setting up your environment, converting YOLO annotations to Label Studio's format, and importing them into your project. + + +### Prerequisites +- Label Studio installed locally +- YOLO annotated images and corresponding .txt label files in the directory `/yolo/root/directory`. +- label-studio-converter installed (available via `pip install label-studio-converter`) + +### Step 1: Set Up Your Environment and Run Label Studio +Before starting Label Studio, set the following environment variables to enable Local Storage file serving: + +Unix systems: +``` +export LABEL_STUDIO_LOCAL_FILES_SERVING_ENABLED=true +export LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/yolo/root/directory +label-studio ``` -yolo-folder - images - - 1.jpg - - 2.jpg - - ... - labels - - 1.txt - - 2.txt - classes.txt +Windows: +``` +set LABEL_STUDIO_LOCAL_FILES_SERVING_ENABLED=true +set LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=C:\path\to\your\YOLO\dataset +label-studio ``` -classes.txt example +Replace `/yolo/root/directory` with the actual path to your YOLO dataset directory. + +### Step 2: Setup Local Storage +1. Create a new project. +2. Go to project settings. +3. Set the **absolute path** to the same directory as you have in `LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT`. +4. Click `Add storage`. + +Check more details about Local Storages [in the documentation](https://labelstud.io/guide/storage.html#Local-storage). + +### Step 3: Verify Image Access +Before importing the converted annotations from YOLO, verify that you can access an image from your Local storage via Label Studio. Open a new browser tab and enter the following URL: ``` -Airplane -Car +http://localhost:8080/data/local-files/?d=relative/path/to/images/your_image.jpg ``` +Replace `relative/path/to/images/your_image.jpg` with the path to one of your images. The image should display in the new tab of the browser. +If you can't open an image, the Local Storage configuration is incorrect: most likely you made a mistake in your Path in Local Storage settings. + +**Note:** The URL path from `?d=` should be relative to `LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/yolo/root/directory`, +it means that the real path will be `/yolo/root/directory/relative/path/to/images/your_image.jpg` and this image should exist on your hard drive. + +### Step 3: Convert YOLO Annotations +Use the label-studio-converter to convert your YOLO annotations to a format that Label Studio can understand: +sh +label-studio-converter import yolo -i /yolo/root/directory -o output.json --image-root-url "/data/local-files/?d=relative/path/to/images" +Replace relative/path/to/images with the path to your images relative to the LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT. + + +### Step 4: Import Converted Annotations +Now that you've verified image access, import the output.json file into Label Studio: +1. Go to your Label Studio project. +2. Click on the "Import" button. +3. Select the output.json file and import it. + +### Step 5: Verify Annotations +After importing, you should see your images with the pre-annotated bounding boxes in Label Studio. Verify that the annotations are correct and make any necessary adjustments. + +### Troubleshooting +If you encounter issues with paths or image access, ensure that: +- The LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT is set correctly. +- The `--image-root-url` in the conversion command matches the relative path used in Label Studio. +- The Local Storage in Label Studio is set up correctly with the absolute path to your images. +- For a more details, please refer to the documentation on [importing pre-annotated data](https://labelstud.io/guide/predictions.html). + + ## Contributing We would love to get your help for creating converters to other models. Please feel free to create pull requests. From 8c4f41e5f2dd532ad3631ad7f4d5cff7cd8d20c6 Mon Sep 17 00:00:00 2001 From: Max Tkachenko Date: Thu, 18 Apr 2024 02:27:48 +0100 Subject: [PATCH 02/16] Update README.md --- README.md | 85 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 44 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index 5e9cff93..d203ac7f 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,9 @@ - [CoNLL 2003](#conll-2003) - [COCO](#coco) - [Pascal VOC XML](#pascal-voc-xml) +- [YOLO to Label Studio Converter](#yolo-to-label-studio-converter) + - [Usage](#usage) + - [Tutorial: Importing YOLO Pre-Annotated Images to Label Studio using Local Storage](#tutorial-importing-yolo-pre-annotated-images-to-label-studio-using-local-storage) - [Contributing](#contributing) - [License](#license) @@ -261,24 +264,16 @@ Corresponding annotations could be found in `tmp/voc-annotations/*.xml`: Use cases: image object detection -# YOLO to Label Studio converter +-------- -1. label-studio-converter import yolo -i YOLO/datasets/test1 -o output.json --image-root-url "/data/local-files/?d=test1/images" -2. http://localhost:8080/data/local-files/?d=test1/images/p10.jpg -3. LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/Users/amir.giveon/GoogleDrive/projects/K1/YOLO/datasets/ -4. Local Storage `Absolute local path` (displayed as `Path` on the storage card) /Users/amir.giveon/GoogleDrive/projects/K1/YOLO/datasets/test1/images - - ---image-root-url "/data/local-files/?d=images" -label-studio-converter import yolo -i /yolo/root/directory -LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/yolo/root/directory +# YOLO to Label Studio Converter ### YOLO directory structure -Check the structure of YOLO folder first, keep in mind that the root is `/yolo/root/directory`. +Check the structure of YOLO folder first, keep in mind that the root is `/yolo/datasets/one`. ``` -/yolo/root/directory +/yolo/datasets/one images - 1.jpg - 2.jpg @@ -290,7 +285,7 @@ Check the structure of YOLO folder first, keep in mind that the root is `/yolo/r classes.txt ``` -**classes.txt example** +*classes.txt example* ``` Airplane @@ -300,16 +295,16 @@ Car ### Usage ``` -label-studio-converter import yolo -i /yolo/root/directory -o ls-tasks.json +label-studio-converter import yolo -i /yolo/datasets/one -o ls-tasks.json --image-root-url "/data/local-files/?d=one/images" ``` -**Note** - * if you use Local Storage, you should point the Label Studio environment variable `LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/yolo/root/directory` to the same directory as you used in `-i` parameter. - * If you want to use `LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/yolo/root` (one level up relative to `-i`), you need to specify `--image-root-url`: - ``` - label-studio-converter import yolo -i /yolo/root/directory -o ls-tasks.json --image-root-url "/data/local-files/?d=images" - ``` +**Note for Local Storages** + * It's very important to set `LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/yolo/datasets` (**not** to `/yolo/datasets/one`, but **`/yolo/datasets`**) for Label Studio run. + * Add a new Local Storage in the Project Settings and set `Absolute local path` to `/yolo/datasets/one/images` (or `c:\yolo\datasets\one\images` for Windows). +**Note for Cloud Storages** + * Use `--image-root-url` to make correct prefixes for task urls, e.g. `--image-root-url s3://my-bucket/yolo/datasets/one`. + * Add a new Cloud Storage in the Project Settings with the corresponding bucket and prefix. **Help command** @@ -350,7 +345,7 @@ We'll cover setting up your environment, converting YOLO annotations to Label St ### Prerequisites - Label Studio installed locally -- YOLO annotated images and corresponding .txt label files in the directory `/yolo/root/directory`. +- YOLO annotated images and corresponding .txt label files in the directory `/yolo/datasets/one`. - label-studio-converter installed (available via `pip install label-studio-converter`) ### Step 1: Set Up Your Environment and Run Label Studio @@ -359,23 +354,23 @@ Before starting Label Studio, set the following environment variables to enable Unix systems: ``` export LABEL_STUDIO_LOCAL_FILES_SERVING_ENABLED=true -export LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/yolo/root/directory +export LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/yolo/datasets label-studio ``` Windows: ``` set LABEL_STUDIO_LOCAL_FILES_SERVING_ENABLED=true -set LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=C:\path\to\your\YOLO\dataset +set LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=C:\\yolo\\datasets label-studio ``` -Replace `/yolo/root/directory` with the actual path to your YOLO dataset directory. +Replace `/yolo/datasets` with the actual path to your YOLO datasets directory. ### Step 2: Setup Local Storage 1. Create a new project. -2. Go to project settings. -3. Set the **absolute path** to the same directory as you have in `LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT`. +2. Go to Project Settings. +3. Set the **Absolute local path** to `/yolo/datasets/one/images` or `c:\yolo\datasets\one\images` on Windows. 4. Click `Add storage`. Check more details about Local Storages [in the documentation](https://labelstud.io/guide/storage.html#Local-storage). @@ -384,27 +379,27 @@ Check more details about Local Storages [in the documentation](https://labelstud Before importing the converted annotations from YOLO, verify that you can access an image from your Local storage via Label Studio. Open a new browser tab and enter the following URL: ``` -http://localhost:8080/data/local-files/?d=relative/path/to/images/your_image.jpg +http://localhost:8080/data/local-files/?d=one/images/.jpg ``` -Replace `relative/path/to/images/your_image.jpg` with the path to one of your images. The image should display in the new tab of the browser. -If you can't open an image, the Local Storage configuration is incorrect: most likely you made a mistake in your Path in Local Storage settings. +Replace `one/images/.jpg` with the path to one of your images. The image should display **in the new tab of the browser**. +If you can't open an image, the Local Storage configuration is incorrect: most likely you made a mistake in your `Path` in Local Storage settings or in `LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT`. -**Note:** The URL path from `?d=` should be relative to `LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/yolo/root/directory`, -it means that the real path will be `/yolo/root/directory/relative/path/to/images/your_image.jpg` and this image should exist on your hard drive. +**Note:** The URL path from `?d=` should be relative to `LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/yolo/datasets`, +it means that the real path will be `/yolo/datasets/one/images/.jpg` and this image should exist on your hard drive. ### Step 3: Convert YOLO Annotations Use the label-studio-converter to convert your YOLO annotations to a format that Label Studio can understand: -sh -label-studio-converter import yolo -i /yolo/root/directory -o output.json --image-root-url "/data/local-files/?d=relative/path/to/images" -Replace relative/path/to/images with the path to your images relative to the LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT. +``` +label-studio-converter import yolo -i /yolo/datasets/one -o output.json --image-root-url "/data/local-files/?d=one/images" +``` ### Step 4: Import Converted Annotations -Now that you've verified image access, import the output.json file into Label Studio: +Now import the `output.json` file into Label Studio: 1. Go to your Label Studio project. 2. Click on the "Import" button. -3. Select the output.json file and import it. +3. Select the `output.json` file and import it. ### Step 5: Verify Annotations After importing, you should see your images with the pre-annotated bounding boxes in Label Studio. Verify that the annotations are correct and make any necessary adjustments. @@ -412,19 +407,27 @@ After importing, you should see your images with the pre-annotated bounding boxe ### Troubleshooting If you encounter issues with paths or image access, ensure that: - The LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT is set correctly. -- The `--image-root-url` in the conversion command matches the relative path used in Label Studio. -- The Local Storage in Label Studio is set up correctly with the absolute path to your images. -- For a more details, please refer to the documentation on [importing pre-annotated data](https://labelstud.io/guide/predictions.html). +- The `--image-root-url` in the conversion command matches the relative path: +``` +`Absolute local path from Local Storage Settings` - `LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT` = `path for --image_root_url` +``` +e.g.: +``` +/yolo/datasets/one/images - /yolo/datasets/ = one/images +``` +- The Local Storage in Label Studio is set up correctly with the Absolute local path to your images (`/yolo/datasets/one/images`) +- For a more details, please refer to the documentation on [importing pre-annotated data](https://labelstud.io/guide/predictions.html) and [Cloud Storages](https://labelstud.io/guide/storage). +------------ -## Contributing +# Contributing We would love to get your help for creating converters to other models. Please feel free to create pull requests. - [Contributing Guideline](https://github.com/heartexlabs/label-studio/blob/develop/CONTRIBUTING.md) - [Code Of Conduct](https://github.com/heartexlabs/label-studio/blob/develop/CODE_OF_CONDUCT.md) -## License +# License This software is licensed under the [Apache 2.0 LICENSE](/LICENSE) © [Heartex](https://www.heartex.com/). 2020 From cca78e395f1078a3b85152aad4a9da2610b03ea7 Mon Sep 17 00:00:00 2001 From: Max Tkachenko Date: Thu, 18 Apr 2024 02:29:35 +0100 Subject: [PATCH 03/16] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d203ac7f..11dba08f 100644 --- a/README.md +++ b/README.md @@ -388,20 +388,20 @@ If you can't open an image, the Local Storage configuration is incorrect: most l **Note:** The URL path from `?d=` should be relative to `LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/yolo/datasets`, it means that the real path will be `/yolo/datasets/one/images/.jpg` and this image should exist on your hard drive. -### Step 3: Convert YOLO Annotations +### Step 4: Convert YOLO Annotations Use the label-studio-converter to convert your YOLO annotations to a format that Label Studio can understand: ``` label-studio-converter import yolo -i /yolo/datasets/one -o output.json --image-root-url "/data/local-files/?d=one/images" ``` -### Step 4: Import Converted Annotations +### Step 5: Import Converted Annotations Now import the `output.json` file into Label Studio: 1. Go to your Label Studio project. 2. Click on the "Import" button. 3. Select the `output.json` file and import it. -### Step 5: Verify Annotations +### Step 6: Verify Annotations After importing, you should see your images with the pre-annotated bounding boxes in Label Studio. Verify that the annotations are correct and make any necessary adjustments. ### Troubleshooting From 4c8b2e50e0ea835157b3ac163540b73718e25512 Mon Sep 17 00:00:00 2001 From: Max Tkachenko Date: Thu, 18 Apr 2024 02:49:02 +0100 Subject: [PATCH 04/16] Update yolo.py --- label_studio_converter/imports/yolo.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/label_studio_converter/imports/yolo.py b/label_studio_converter/imports/yolo.py index 2889cf6f..6478850f 100644 --- a/label_studio_converter/imports/yolo.py +++ b/label_studio_converter/imports/yolo.py @@ -14,6 +14,7 @@ from label_studio_converter.imports.label_config import generate_label_config logger = logging.getLogger('root') +default_image_root_url = '/data/local-files/?d=images' def convert_yolo_to_ls( @@ -22,7 +23,7 @@ def convert_yolo_to_ls( to_name='image', from_name='label', out_type="annotations", - image_root_url='/data/local-files/?d=', + image_root_url=default_image_root_url, image_ext='.jpg,.jpeg,.png', image_dims: Optional[Tuple[int, int]] = None, ): @@ -143,12 +144,22 @@ def convert_yolo_to_ls( with open(out_file, 'w') as out: json.dump(tasks, out) + if image_root_url == default_image_root_url: + help_root_dir = ( + "Set environment variables LABEL_STUDIO_LOCAL_FILES_SERVING_ENABLED=true and " + "LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT={image_root_url} for Label Studio run,\n" + "add Local Storage with Absolute local path = {image_root_url}/images" + ) + print( '\n' f' 1. Create a new project in Label Studio\n' f' 2. Use Labeling Config from "{label_config_file}"\n' - f' 3. Setup serving for images [e.g. you can use Local Storage (or others):\n' - f' https://labelstud.io/guide/storage.html#Local-storage]\n' + f' 3. Setup serving for images\n' + f' E.g. you can use Local Storage (or others):\n' + f' https://labelstud.io/guide/storage.html#Local-storage\n' + f' See tutorial here:\nhttps://github.com/HumanSignal/label-studio-converter/tree/master?tab=readme-ov-file#yolo-to-label-studio-converter\n' + f' {help_root_dir}\n' f' 4. Import "{out_file}" to the project\n' ) else: @@ -196,7 +207,7 @@ def add_parser(subparsers): '--image-root-url', dest='image_root_url', help='root URL path where images will be hosted, e.g.: http://example.com/images', - default='/data/local-files/?d=', + default=default_image_root_url, ) yolo.add_argument( '--image-ext', From bb60a210924fff43747d1f1324885a1af8924c2b Mon Sep 17 00:00:00 2001 From: Max Tkachenko Date: Thu, 18 Apr 2024 02:53:19 +0100 Subject: [PATCH 05/16] Update yolo.py --- label_studio_converter/imports/yolo.py | 1 + 1 file changed, 1 insertion(+) diff --git a/label_studio_converter/imports/yolo.py b/label_studio_converter/imports/yolo.py index 6478850f..a21af011 100644 --- a/label_studio_converter/imports/yolo.py +++ b/label_studio_converter/imports/yolo.py @@ -144,6 +144,7 @@ def convert_yolo_to_ls( with open(out_file, 'w') as out: json.dump(tasks, out) + help_root_dir = '' if image_root_url == default_image_root_url: help_root_dir = ( "Set environment variables LABEL_STUDIO_LOCAL_FILES_SERVING_ENABLED=true and " From d0ec4b62bc31fbfee684aff29cc866f757da1afe Mon Sep 17 00:00:00 2001 From: Max Tkachenko Date: Thu, 18 Apr 2024 03:03:05 +0100 Subject: [PATCH 06/16] Update yolo.py --- label_studio_converter/imports/yolo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/label_studio_converter/imports/yolo.py b/label_studio_converter/imports/yolo.py index a21af011..cd23f3b9 100644 --- a/label_studio_converter/imports/yolo.py +++ b/label_studio_converter/imports/yolo.py @@ -148,8 +148,8 @@ def convert_yolo_to_ls( if image_root_url == default_image_root_url: help_root_dir = ( "Set environment variables LABEL_STUDIO_LOCAL_FILES_SERVING_ENABLED=true and " - "LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT={image_root_url} for Label Studio run,\n" - "add Local Storage with Absolute local path = {image_root_url}/images" + "LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT={input_dir} for Label Studio run,\n" + "add Local Storage with Absolute local path = {input_dir}/images" ) print( From 658661ccba0248ac8805bdfcc16e1053e9a8fa79 Mon Sep 17 00:00:00 2001 From: Max Tkachenko Date: Thu, 18 Apr 2024 03:03:19 +0100 Subject: [PATCH 07/16] Update yolo.py --- label_studio_converter/imports/yolo.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/label_studio_converter/imports/yolo.py b/label_studio_converter/imports/yolo.py index cd23f3b9..66d3e06e 100644 --- a/label_studio_converter/imports/yolo.py +++ b/label_studio_converter/imports/yolo.py @@ -147,9 +147,9 @@ def convert_yolo_to_ls( help_root_dir = '' if image_root_url == default_image_root_url: help_root_dir = ( - "Set environment variables LABEL_STUDIO_LOCAL_FILES_SERVING_ENABLED=true and " - "LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT={input_dir} for Label Studio run,\n" - "add Local Storage with Absolute local path = {input_dir}/images" + f"Set environment variables LABEL_STUDIO_LOCAL_FILES_SERVING_ENABLED=true and " + f"LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT={input_dir} for Label Studio run,\n" + f"add Local Storage with Absolute local path = {input_dir}/images" ) print( From 01fbdb9ebc482c850101226a1e9862a441cdf07a Mon Sep 17 00:00:00 2001 From: Max Tkachenko Date: Thu, 18 Apr 2024 11:56:20 +0100 Subject: [PATCH 08/16] Update README.md Co-authored-by: Caitlin Wheeless --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 11dba08f..11d744e4 100644 --- a/README.md +++ b/README.md @@ -297,6 +297,7 @@ Car ``` label-studio-converter import yolo -i /yolo/datasets/one -o ls-tasks.json --image-root-url "/data/local-files/?d=one/images" ``` +Where the URL path from `?d=` is relative to the path you set in `LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT`. **Note for Local Storages** * It's very important to set `LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/yolo/datasets` (**not** to `/yolo/datasets/one`, but **`/yolo/datasets`**) for Label Studio run. From 1616dac593f01ade59add5f0be1ef2325bde673f Mon Sep 17 00:00:00 2001 From: Max Tkachenko Date: Thu, 18 Apr 2024 11:56:36 +0100 Subject: [PATCH 09/16] Update README.md Co-authored-by: Caitlin Wheeless --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 11d744e4..540db585 100644 --- a/README.md +++ b/README.md @@ -301,7 +301,7 @@ Where the URL path from `?d=` is relative to the path you set in `LABEL_STUDIO_L **Note for Local Storages** * It's very important to set `LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/yolo/datasets` (**not** to `/yolo/datasets/one`, but **`/yolo/datasets`**) for Label Studio run. - * Add a new Local Storage in the Project Settings and set `Absolute local path` to `/yolo/datasets/one/images` (or `c:\yolo\datasets\one\images` for Windows). + * [Add a new Local Storage](https://labelstud.io/guide/storage#Local-storage) in the project settings and set **Absolute local path** to `/yolo/datasets/one/images` (or `c:\yolo\datasets\one\images` for Windows). **Note for Cloud Storages** * Use `--image-root-url` to make correct prefixes for task urls, e.g. `--image-root-url s3://my-bucket/yolo/datasets/one`. From 63870b03805347f58fdbf059fa77d79f6191ef64 Mon Sep 17 00:00:00 2001 From: Max Tkachenko Date: Thu, 18 Apr 2024 11:56:48 +0100 Subject: [PATCH 10/16] Update README.md Co-authored-by: Caitlin Wheeless --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 540db585..75f2ff55 100644 --- a/README.md +++ b/README.md @@ -304,7 +304,7 @@ Where the URL path from `?d=` is relative to the path you set in `LABEL_STUDIO_L * [Add a new Local Storage](https://labelstud.io/guide/storage#Local-storage) in the project settings and set **Absolute local path** to `/yolo/datasets/one/images` (or `c:\yolo\datasets\one\images` for Windows). **Note for Cloud Storages** - * Use `--image-root-url` to make correct prefixes for task urls, e.g. `--image-root-url s3://my-bucket/yolo/datasets/one`. + * Use `--image-root-url` to make correct prefixes for task URLs, e.g. `--image-root-url s3://my-bucket/yolo/datasets/one`. * Add a new Cloud Storage in the Project Settings with the corresponding bucket and prefix. **Help command** From 600a6d3536f00eb9a2bcc4c48ec904ba771f5ac0 Mon Sep 17 00:00:00 2001 From: Max Tkachenko Date: Thu, 18 Apr 2024 11:56:58 +0100 Subject: [PATCH 11/16] Update README.md Co-authored-by: Caitlin Wheeless --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 75f2ff55..6aba1ec6 100644 --- a/README.md +++ b/README.md @@ -300,7 +300,7 @@ label-studio-converter import yolo -i /yolo/datasets/one -o ls-tasks.json --imag Where the URL path from `?d=` is relative to the path you set in `LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT`. **Note for Local Storages** - * It's very important to set `LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/yolo/datasets` (**not** to `/yolo/datasets/one`, but **`/yolo/datasets`**) for Label Studio run. + * It's very important to set `LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/yolo/datasets` (**not** to `/yolo/datasets/one`, but **`/yolo/datasets`**) for Label Studio to run. * [Add a new Local Storage](https://labelstud.io/guide/storage#Local-storage) in the project settings and set **Absolute local path** to `/yolo/datasets/one/images` (or `c:\yolo\datasets\one\images` for Windows). **Note for Cloud Storages** From b5ab1f6e45115fad10a785a224ce987a3c5eeb5c Mon Sep 17 00:00:00 2001 From: Max Tkachenko Date: Thu, 18 Apr 2024 11:57:11 +0100 Subject: [PATCH 12/16] Update README.md Co-authored-by: Caitlin Wheeless --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6aba1ec6..f13f5506 100644 --- a/README.md +++ b/README.md @@ -305,7 +305,7 @@ Where the URL path from `?d=` is relative to the path you set in `LABEL_STUDIO_L **Note for Cloud Storages** * Use `--image-root-url` to make correct prefixes for task URLs, e.g. `--image-root-url s3://my-bucket/yolo/datasets/one`. - * Add a new Cloud Storage in the Project Settings with the corresponding bucket and prefix. + * [Add a new Cloud Storage](https://labelstud.io/guide/storage) in the project settings with the corresponding bucket and prefix. **Help command** From 933f85661e385ac04cab1ed064fc43cfe9cbc8f8 Mon Sep 17 00:00:00 2001 From: Max Tkachenko Date: Thu, 18 Apr 2024 11:57:41 +0100 Subject: [PATCH 13/16] Update README.md Co-authored-by: Caitlin Wheeless --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f13f5506..7f972197 100644 --- a/README.md +++ b/README.md @@ -370,7 +370,8 @@ Replace `/yolo/datasets` with the actual path to your YOLO datasets directory. ### Step 2: Setup Local Storage 1. Create a new project. -2. Go to Project Settings. +2. Go to the project settings and select **Cloud Storage**. +3. Click **Add Source Storage** and select **Local files** from the **Storage Type** options. 3. Set the **Absolute local path** to `/yolo/datasets/one/images` or `c:\yolo\datasets\one\images` on Windows. 4. Click `Add storage`. From 5008b06c9c11e01a7546d815325239f147d3cac4 Mon Sep 17 00:00:00 2001 From: Max Tkachenko Date: Thu, 18 Apr 2024 11:58:25 +0100 Subject: [PATCH 14/16] Update README.md Co-authored-by: Caitlin Wheeless --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7f972197..b247debd 100644 --- a/README.md +++ b/README.md @@ -385,7 +385,7 @@ http://localhost:8080/data/local-files/?d=one/images/.jpg ``` Replace `one/images/.jpg` with the path to one of your images. The image should display **in the new tab of the browser**. -If you can't open an image, the Local Storage configuration is incorrect: most likely you made a mistake in your `Path` in Local Storage settings or in `LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT`. +If you can't open an image, the Local Storage configuration is incorrect. The most likely reason is that you made a mistake when specifying your `Path` in Local Storage settings or in `LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT`. **Note:** The URL path from `?d=` should be relative to `LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/yolo/datasets`, it means that the real path will be `/yolo/datasets/one/images/.jpg` and this image should exist on your hard drive. From b0c3051c2fae244b3ff1fdb6b23245138d83fd20 Mon Sep 17 00:00:00 2001 From: Max Tkachenko Date: Thu, 18 Apr 2024 11:58:36 +0100 Subject: [PATCH 15/16] Update README.md Co-authored-by: Caitlin Wheeless --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b247debd..2c8195cc 100644 --- a/README.md +++ b/README.md @@ -400,7 +400,7 @@ label-studio-converter import yolo -i /yolo/datasets/one -o output.json --image- ### Step 5: Import Converted Annotations Now import the `output.json` file into Label Studio: 1. Go to your Label Studio project. -2. Click on the "Import" button. +2. From the Data Manager, click **Import**. 3. Select the `output.json` file and import it. ### Step 6: Verify Annotations From 183703ba489e08c2fbe585fe7885189450f91262 Mon Sep 17 00:00:00 2001 From: Max Tkachenko Date: Thu, 18 Apr 2024 11:58:44 +0100 Subject: [PATCH 16/16] Update README.md Co-authored-by: Caitlin Wheeless --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2c8195cc..dc9683fb 100644 --- a/README.md +++ b/README.md @@ -418,7 +418,7 @@ e.g.: /yolo/datasets/one/images - /yolo/datasets/ = one/images ``` - The Local Storage in Label Studio is set up correctly with the Absolute local path to your images (`/yolo/datasets/one/images`) -- For a more details, please refer to the documentation on [importing pre-annotated data](https://labelstud.io/guide/predictions.html) and [Cloud Storages](https://labelstud.io/guide/storage). +- For more details, refer to the documentation on [importing pre-annotated data](https://labelstud.io/guide/predictions.html) and [setting up Cloud Storages](https://labelstud.io/guide/storage). ------------