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

Get data 404 error

Open vfdev-5 opened this issue 6 years ago • 6 comments

Describe the bug

Data defined in the task is not provided.

To Reproduce

  • Created tasks.json
{
  "0": {
    "id": 0,
    "data": {
      "image": "/data/img/img1.tif",
      "mask": "/data/msk/mask1.tif"
    }
  },
  "1": {
    "id": 1,
    "data": {
      "image": "/data/img/img2.tif",
      "mask": "/data/msk/mask2.tif"
    }
  }
}

and config.json

{
  "title": "Label Studio",
  "port": 8097,
  "debug": true,
  "label_config": "config.xml",
  "input_path": "tasks.json",
  "output_dir": "completions",
  "instruction": "Type some <b>hypertext</b> for label experts!",
  "allow_delete_completions": true,
  "templates_dir": "examples",
  "editor": {
    "debug": false
  },
  "!ml_backend": {
    "url": "http://localhost:9090",
    "model_name": "my_super_model"
  },
  "sampling": "uniform"
}
  • Initialize the project
 label-studio init labeling_project -c config.json 
  • Run the project
label-studio start ./labeling_project --port 8097

And I get the following error:

[2020-02-26 16:41:07,111] [werkzeug] [INFO] 127.0.0.1 - - [26/Feb/2020 16:41:07] "GET /static/images/github.svg HTTP/1.1" 200 -
[2020-02-26 16:41:07,113] [werkzeug] [INFO] 127.0.0.1 - - [26/Feb/2020 16:41:07] "GET /static/images/slack.png HTTP/1.1" 200 -
[2020-02-26 16:41:07,114] [werkzeug] [INFO] 127.0.0.1 - - [26/Feb/2020 16:41:07] "GET /static/images/ls_logo.png HTTP/1.1" 200 -
[2020-02-26 16:41:07,472] [werkzeug] [INFO] 127.0.0.1 - - [26/Feb/2020 16:41:07] "GET /api/projects/1/next/ HTTP/1.1" 200 -
[2020-02-26 16:41:07,631] [werkzeug] [INFO] 127.0.0.1 - - [26/Feb/2020 16:41:07] "GET /data/img/img1.tif HTTP/1.1" 404 -
[2020-02-26 16:41:07,634] [werkzeug] [INFO] 127.0.0.1 - - [26/Feb/2020 16:41:07] "GET /data/msk/mask1.tif HTTP/1.1" 404 -

Expected behavior Data should be served ?

Environment (please complete the following information):

  • OS: [e.g. iOS] Linux
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22] : 0.4.8

vfdev-5 avatar Feb 26 '20 16:02 vfdev-5

Hi, @vfdev-5 ! Data from local filesystem should be served a bit differently. There is no need to modify internal tasks.json and config.json files. Please try the solution from https://github.com/heartexlabs/label-studio/issues/221 by creating tasks with local URL using

label-studio init labeling_project --input-path my/image/dir --input-format image-dir --label-config my_config.xml

niklub avatar Feb 28 '20 15:02 niklub

However if in some cases you need to create local URLs by your own, use the following format:

http://localhost:8200/data/image_filename?d=path/to/image/dir

niklub avatar Feb 28 '20 15:02 niklub

@niklub thanks for suggestions.

I did the same as you suggested, but without localhost : /data/image_filename?d=path/to/image/dir

I have also a doubt about reading tif files by html, as I did not find any image reader in the repository, I think user need to render its imagery to RGB 8 bits.

So, you can close the issues if you wish. My problem is solved while preparing the data specifically for labelling and using /data/image_filename?d=path/to/image/dir trick.

vfdev-5 avatar Feb 28 '20 15:02 vfdev-5

We haven't image readers, just passing the image links to the browsers - I believe tif files should be handled by them

niklub avatar Feb 28 '20 15:02 niklub

The approach doesn't directly applicable on Windows. I want to create an audio annotation project with pre-annotations. Everything works fine on macOS/Ubuntu, but I have to import that project on Windows machine. And I've stacked on specifying path to a file in JSON tasks. In order to figure out the template of path specification I've tried to import a file through drug&drop window and checked the generated task.json, and it looks like this:

{
 "id": 1,
 "data": {
  "audio": "http:\/\/localhost:8080\/data\/upload\/f68f81e1cf0681ad839b8bb295e7cb34-record.wav"
 }
}

So, the path is not absolute and a part of the path is a generated uuid64 code. I'm actually confused about how can I imitate this approach during the tasks file creation. Any thoughts on that? @niklub

fearless-lark avatar Jan 12 '21 14:01 fearless-lark

Try this scheme:

  1. Add audio files via drag&drop
  2. Call wget http://localhost:8080/api/tasks > all_tasks.json
  3. Remove all tasks (this action will leave uploaded files in place)
  4. Make tasks = json.load(open('all_tasks.json'))['tasks']
  5. Add predictions to tasks
  6. Save tasks to import.json
  7. Import via GUI import.json

makseq avatar Jan 12 '21 17:01 makseq