Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot import an exported JSON file from another computer to my local computer #7001

Closed
ahmetfatihsalim opened this issue Jan 30, 2025 · 3 comments

Comments

@ahmetfatihsalim
Copy link

ahmetfatihsalim commented Jan 30, 2025

Setup:

I'm using Anaconda Navigator on Windows 11 system. My label-studio version is 1.15.4
In Anaconda Navigator I have a environment called label-studio. Python version 3.12.8
In this environment I've installed label studio. I've set local variables for using local storage

Image

In my project settings I setup local storage for source and target storage

Image

I get "successfully connected" message when I check connection. I didn't sync the storages (However target storage got auto-synced when I create it)

I got exported JSON file from my coworker who works on different computer. Exported JSON file has 49 images. I've edited JSON file so the data path looks at "/data/local-files/?d=". Here is the source link for this info. Here is the example from JSON file:

{ "id": 1, "annotations": [ { "id": 1, "completed_by": 1, "result": [ { "original_width": 1000, "original_height": 562, "image_rotation": 0, "value": { "x": 43.161599999999986, "y": 67.19999999999999, "width": 7.41840000000003, "height": 7.39999999999995, "rotation": 0, "rectanglelabels": ["fire"] }, "id": "7Jdww3Q3et", "from_name": "label", "to_name": "image", "type": "rectanglelabels", "origin": "manual" }, { "original_width": 1000, "original_height": 562, "image_rotation": 0, "value": { "x": 69.23839999999997, "y": 51.79999999999999, "width": 3.9340000000000335, "height": 5.999999999999953, "rotation": 0, "rectanglelabels": ["fire"] }, "id": "n8rQd0jspm", "from_name": "label", "to_name": "image", "type": "rectanglelabels", "origin": "manual" }, { "original_width": 1000, "original_height": 562, "image_rotation": 0, "value": { "x": 8.8796, "y": 0.6000000000000011, "width": 81.82720000000008, "height": 63.6, "rotation": 0, "rectanglelabels": ["smoke"] }, "id": "Ir8CCY1Q5-", "from_name": "label", "to_name": "image", "type": "rectanglelabels", "origin": "manual" }, { "original_width": 1000, "original_height": 562, "image_rotation": 0, "value": { "x": 33.94480000000007, "y": 64.40000000000005, "width": 8.542400000000004, "height": 14.000000000000036, "rotation": 0, "rectanglelabels": ["smoke"] }, "id": "bbrwY_ZbXE", "from_name": "label", "to_name": "image", "type": "rectanglelabels", "origin": "manual" }, { "original_width": 1000, "original_height": 562, "image_rotation": 0, "value": { "x": 42.712, "y": 75.2, "width": 2.6975999999999942, "height": 8.799999999999997, "rotation": 0, "rectanglelabels": ["fire"] }, "id": "0BU4x3_cHb", "from_name": "label", "to_name": "image", "type": "rectanglelabels", "origin": "manual" } ], "was_cancelled": false, "ground_truth": false, "created_at": "2025-01-19T19:01:36.682275Z", "updated_at": "2025-01-19T19:01:50.135836Z", "draft_created_at": "2025-01-19T18:56:50.843603Z", "lead_time": 367.841, "prediction": {}, "result_count": 0, "unique_id": "f8230439-cf19-4d47-aa6a-8c5d9f318d7a", "import_id": null, "last_action": null, "task": 1, "project": 3, "updated_by": 1, "parent_prediction": null, "parent_annotation": null, "last_created_by": null } ], "file_upload": "19642e5d-uxAsUwEdG0mI3GDubP5Dpw.webp", "drafts": [], "predictions": [], "data": { "image": "/data/local-files/?d=Osman19642e5d-uxAsUwEdG0mI3GDubP5Dpw.webp" }, "meta": {}, "created_at": "2025-01-19T18:54:10.234785Z", "updated_at": "2025-01-19T19:01:50.225508Z", "inner_id": 1, "total_annotations": 1, "cancelled_annotations": 0, "total_predictions": 0, "comment_count": 0, "unresolved_comment_count": 0, "last_comment_updated_at": null, "project": 3, "updated_by": 1, "comment_authors": [] },

I also got Exported project in YOLO format. So I can add these Images to my local storage folder. These Images have the same names as in JSON file.

Problem:
When I import the JSON file to my project images appear as "downloading Images". I can't see them

Image

Image

Here is the errors in cmd:

Image

Question:
How can I successfully import an exported JSON file from another computer to my local computer and actually see images and annotations? what did I do wrong?

@heidi-humansignal
Copy link
Collaborator

Hello,

Thank you for contacting Label Studio,

Could you please apply the following suggestion and let us know if it has resolved the issue or not

To reuse an exported JSON file (with annotations) on a new computer and see the images correctly, you must ensure two things:

  1. Correct File Paths in JSON:
  • Each task’s data.image must match how Label Studio references local files. Instead of a raw path like C:/images/..., Label Studio expects something like: "/data/local-files/?d=folder_name/filename.jpg"
  • The portion after ?d= must be exactly the relative path from your LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT.
  1. Local Storage Setup and Placement of Images:
  • Make sure you’ve set up your Local Storage in your project’s Settings → Cloud Storage with the absolute folder path where your images live on this new computer.
  • Ensure that the environment variables are set when you start Label Studio: SET LABEL_STUDIO_LOCAL_FILES_SERVING_ENABLED=true SET LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=C:\path\to\images label-studio start
  • Place all exported images into that same folder path (or subfolders). For instance, if your JSON has "/data/local-files/?d=Osman19642e5d-uxAsUwEdG0mI3GDubP5Dpw.webp", then on disk you must have: C:\path\to\images\Osman19642e5d-uxAsUwEdG0mI3GDubP5Dpw.webp
  • Finally, click Sync Storage on the Local Storage if needed, and import the JSON file under Data Manager → Import. This ensures Label Studio sees the images in the correct location to load them.

After these steps, your existing annotations should match up with the images, and you won’t see “downloading images” errors.
Let me know if you have any further questions or run into issues.

Comment by Oussama Assili
Workflow Run

@ahmetfatihsalim
Copy link
Author

Hello Heidi,

* Place all exported images into that same folder path (or subfolders). For instance, if your JSON has `"/data/local-files/?d=Osman19642e5d-uxAsUwEdG0mI3GDubP5Dpw.webp"`, then on disk you must have:` C:\path\to\images\Osman19642e5d-uxAsUwEdG0mI3GDubP5Dpw.webp`

Turned out that I didnt put "/" to "/data/local-files/?d=Osman19642e5d-uxAsUwEdG0mI3GDubP5Dpw.webp". So it should have been "/data/local-files/?d=Osman/19642e5d-uxAsUwEdG0mI3GDubP5Dpw.webp" -_-. Literally as annoying as forgetting a ";".

Thanks for the reply.

@heidi-humansignal
Copy link
Collaborator

No worries at all! we are happy to assist you!

Please let us know if you have any additional questions! for now , we will close this ticket!

Comment by Oussama Assili
Workflow Run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants