Reputation: 65
In label-studio I am trying to import pre annotated json file from other machine in my local machine ..
[
{
"id": 51,
"file_upload": "12.jpg",
"data": {
"image": "/data/upload/4/12.jpg"
},
"annotations": [...]
}
]
I copied same image 12.jpg in similar dir on local machine - C:\Users\ABC\AppData\Local\label-studio\label-studio\media\upload\4\ . But I get error when I start label this image in label-studio
enter code hereThere was an issue loading URL from $image value
Things to look out for:
URL is valid
URL scheme matches the service scheme, i.e. https and https
The static server has wide-open CORS, more on that here
Technical description:
URL: /data/upload/4/12.jpg
I also changed imagge path in JSON and again imported
"image": "C:/Users/ABC/AppData/Local/label-studio/label-studio/media/upload/4/12.jpg"
still getting same issue.
Corresponding Source of task enter image description here
Please let me know if I missed any step.
I followed documentation - https://labelstud.io/guide/predictions.html
Upvotes: 4
Views: 6815
Reputation: 882
It's highly recommended not to use media file uploads in Label Studio. They exist mostly for toy setups, just to try things in a fast way. The recommended way is to use storages, e.g.:
Problems
There are two points with uploaded files:
When you upload a media file to LS, LS creates a record in its database and associate the uploaded file with this DB record. If you try to access /upload/4/12.jpg next time, LS will check permission using the DB record and if the permission check is passed, LS returns a file from the hard drive.
More details: https://github.com/HumanSignal/label-studio/blob/develop/label_studio/data_import/api.py#L613
When you upload a media file to LS, it won't be stored with the same name, Django will generate unique name for it. It's made to avoid rewriting already existing files with the same names.
So, it's pretty hard to repeat the same configuration of a project with uploaded files.
Solution
/data/upload/4
to /data/local-files/?d=<relative_path_from_LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT>/12.jpg
Upvotes: 1
Reputation: 11
what i did to solve the issue is to use different port for running the application in localhost. This solved the issue for me.
label-studio start --port 9001
Upvotes: 0