ESA-PhiLab/iris

App interface does not load for a custom labelling project

cthenoz opened this issue · 3 comments

Hi there,

I have just discovered this application and thus tried it out out of curiosity but encountered a problem : when I try to work on a custom labelling project, the interface just never loads in the web app. The page remains blank, except a rectangle with my image (just one view of it though) that I can zoom in and out and pan.

I have followed your demo tutorial that worked just fine. And then, I tried to use it for a custom project. I have cropped a Pleiades TIF image to a patch of 512x512 pixels and written a config file similarly to the demo example. Here is the config content :

{
  "name": "segmentation",
  "port": 8080,
  "images": {
    "path": {
      "Pleiades": "images/test_pleiades_{id}.tif"
    },
    "shape": [
      512,
      512
    ]
  },
  "segmentation": {
    "path": "masks/mask_{id}.png",
    "mask_encoding": "rgb",
    "mask_area": [
      0,
      0,
      512,
      512
    ],
    "score": "f1",
    "unverified_threshold": 1,
    "test_images": null
  },
  "classes": [
    {
      "name": "No Shadows",
      "description": "",
      "colour": [
        255,
        255,
        255,
        0
      ],
      "user_colour": [
        0,
        0,
        255,
        0
      ]
    },
    {
      "name": "Shadows",
      "description": "",
      "colour": [
        255,
        0,
        0,
        0
      ]
    }
  ],
  "views": {
    "RGB": {
      "description": "RGB image.",
      "type": "image",
      "data": [
        "$Pleiades.B1",
        "$Pleiades.B2",
        "$Pleiades.B3"
      ]
    }
  },
  "NIR": {
    "description": "Near Infrared",
    "type": "image",
    "data": "$Pleiades.B4",
    "cmap": "gray"
  },
  "view_groups": {
    "default": [
      "RGB",
      "NIR"
    ]
  }
}

I have a folder organized this way :

custom_project
    |---- images
    |    |---- test_pleiades_02.tif
    |---- config.json

And I launch the following command in my conda environment where the project is installed, in debug mode:

iris label /path/to/custom_project/config.json -d

And this is what I get in the terminal :

 * Serving Flask app 'iris'
 * Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://127.0.0.1:6060
Press CTRL+C to quit
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 119-990-726
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET / HTTP/1.1" 302 -
[2023-08-02 11:44:55,712] INFO in debughelpers: Locating template 'segmentation.html':
    1: trying loader of application 'iris'
       class: jinja2.loaders.FileSystemLoader
       encoding: 'utf-8'
       followlinks: False
       searchpath:
         - /mambaforge/envs/esa_philab_iris/lib/python3.9/site-packages/iris-0.0.0-py3.9.egg/iris/templates
       -> no match
    2: trying loader of blueprint 'main' (iris.main)
       class: jinja2.loaders.FileSystemLoader
       encoding: 'utf-8'
       followlinks: False
       searchpath:
         - /mambaforge/envs/esa_philab_iris/lib/python3.9/site-packages/iris-0.0.0-py3.9.egg/iris/main/templates
       -> no match
    3: trying loader of blueprint 'segmentation' (iris.segmentation)
       class: jinja2.loaders.FileSystemLoader
       encoding: 'utf-8'
       followlinks: False
       searchpath:
         - /mambaforge/envs/esa_philab_iris/lib/python3.9/site-packages/iris-0.0.0-py3.9.egg/iris/segmentation/templates
       -> found ('/mambaforge/envs/esa_philab_iris/lib/python3.9/site-packages/iris-0.0.0-py3.9.egg/iris/segmentation/templates/segmentation.html')
    4: trying loader of blueprint 'admin' (iris.admin)
       class: jinja2.loaders.FileSystemLoader
       encoding: 'utf-8'
       followlinks: False
       searchpath:
         - /mambaforge/envs/esa_philab_iris/lib/python3.9/site-packages/iris-0.0.0-py3.9.egg/iris/admin/templates
       -> no match
    5: trying loader of blueprint 'help' (iris.help)
       class: jinja2.loaders.FileSystemLoader
       encoding: 'utf-8'
       followlinks: False
       searchpath:
         - /mambaforge/envs/esa_philab_iris/lib/python3.9/site-packages/iris-0.0.0-py3.9.egg/iris/help/templates
       -> no match
    6: trying loader of blueprint 'user' (iris.user)
       class: jinja2.loaders.FileSystemLoader
       encoding: 'utf-8'
       followlinks: False
       searchpath:
         - /mambaforge/envs/esa_philab_iris/lib/python3.9/site-packages/iris-0.0.0-py3.9.egg/iris/user/templates
       -> no match
[2023-08-02 11:44:55,721] INFO in debughelpers: Locating template 'base.html':
    1: trying loader of application 'iris'
       class: jinja2.loaders.FileSystemLoader
       encoding: 'utf-8'
       followlinks: False
       searchpath:
         - /mambaforge/envs/esa_philab_iris/lib/python3.9/site-packages/iris-0.0.0-py3.9.egg/iris/templates
       -> no match
    2: trying loader of blueprint 'main' (iris.main)
       class: jinja2.loaders.FileSystemLoader
       encoding: 'utf-8'
       followlinks: False
       searchpath:
         - /mambaforge/envs/esa_philab_iris/lib/python3.9/site-packages/iris-0.0.0-py3.9.egg/iris/main/templates
       -> found ('/mambaforge/envs/esa_philab_iris/lib/python3.9/site-packages/iris-0.0.0-py3.9.egg/iris/main/templates/base.html')
    3: trying loader of blueprint 'segmentation' (iris.segmentation)
       class: jinja2.loaders.FileSystemLoader
       encoding: 'utf-8'
       followlinks: False
       searchpath:
         - /mambaforge/envs/esa_philab_iris/lib/python3.9/site-packages/iris-0.0.0-py3.9.egg/iris/segmentation/templates
       -> no match
    4: trying loader of blueprint 'admin' (iris.admin)
       class: jinja2.loaders.FileSystemLoader
       encoding: 'utf-8'
       followlinks: False
       searchpath:
         - /mambaforge/envs/esa_philab_iris/lib/python3.9/site-packages/iris-0.0.0-py3.9.egg/iris/admin/templates
       -> no match
    5: trying loader of blueprint 'help' (iris.help)
       class: jinja2.loaders.FileSystemLoader
       encoding: 'utf-8'
       followlinks: False
       searchpath:
         - /mambaforge/envs/esa_philab_iris/lib/python3.9/site-packages/iris-0.0.0-py3.9.egg/iris/help/templates
       -> no match
    6: trying loader of blueprint 'user' (iris.user)
       class: jinja2.loaders.FileSystemLoader
       encoding: 'utf-8'
       followlinks: False
       searchpath:
         - /mambaforge/envs/esa_philab_iris/lib/python3.9/site-packages/iris-0.0.0-py3.9.egg/iris/user/templates
       -> no match
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /segmentation/ HTTP/1.1" 200 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /static/css/main.css HTTP/1.1" 200 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /static/css/dialogue.css HTTP/1.1" 200 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /static/javascripts/dialogue.js HTTP/1.1" 200 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /user/static/javascripts/user.js HTTP/1.1" 200 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /static/javascripts/utils.js HTTP/1.1" 200 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /segmentation/static/css/segmentation.css HTTP/1.1" 304 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /segmentation/static/javascripts/segmentation/views.js HTTP/1.1" 200 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /static/javascripts/views.js HTTP/1.1" 200 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /segmentation/static/javascripts/segmentation.js HTTP/1.1" 200 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /segmentation/static/icons/move.png HTTP/1.1" 304 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /segmentation/static/icons/next.png HTTP/1.1" 304 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /segmentation/static/icons/previous.png HTTP/1.1" 304 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /segmentation/static/icons/save_mask.png HTTP/1.1" 304 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /segmentation/static/icons/undo.png HTTP/1.1" 304 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /segmentation/static/icons/class.png HTTP/1.1" 304 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /segmentation/static/icons/redo.png HTTP/1.1" 304 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /segmentation/static/icons/reset_views.png HTTP/1.1" 304 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /segmentation/static/icons/pencil.png HTTP/1.1" 304 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /segmentation/static/icons/reset_mask.png HTTP/1.1" 304 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /segmentation/static/icons/eraser.png HTTP/1.1" 304 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /segmentation/static/icons/ai.png HTTP/1.1" 304 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /segmentation/static/icons/show_mask.png HTTP/1.1" 304 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /segmentation/static/icons/mask_final.png HTTP/1.1" 304 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /segmentation/static/icons/mask_user.png HTTP/1.1" 304 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /segmentation/static/icons/mask_errors.png HTTP/1.1" 304 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /segmentation/static/icons/brightness_up.png HTTP/1.1" 304 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /segmentation/static/icons/brightness_down.png HTTP/1.1" 304 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /segmentation/static/icons/saturation_up.png HTTP/1.1" 304 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /segmentation/static/icons/saturation_down.png HTTP/1.1" 304 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /segmentation/static/icons/invert.png HTTP/1.1" 304 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /segmentation/static/icons/contrast.png HTTP/1.1" 304 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /segmentation/static/icons/reset_filters.png HTTP/1.1" 304 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /segmentation/static/icons/help.png HTTP/1.1" 304 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /segmentation/static/icons/preferences.png HTTP/1.1" 304 -
127.0.0.1 - - [02/Aug/2023 11:44:55] "GET /user/get/current HTTP/1.1" 403 -
127.0.0.1 - - [02/Aug/2023 11:45:00] "POST /user/login HTTP/1.1" 200 -
127.0.0.1 - - [02/Aug/2023 11:45:00] "GET /user/get/current HTTP/1.1" 200 -
127.0.0.1 - - [02/Aug/2023 11:45:00] "GET /image_info/02 HTTP/1.1" 200 -
127.0.0.1 - - [02/Aug/2023 11:45:00] "GET /segmentation/load_mask/02 HTTP/1.1" 404 -

Any idea what I could be doing wrong or if this is a bug or something ?

Hi there! Thanks for the interest in using IRIS.

I made a mock-up of your project (although it was using a random tif, not a Pleiades image). It looks like the isue is that the "NIR" viewgroup that you define is not in the list of views, it's actually outside of it. Then, when the default viewgroup is loaded, it can't find the NIR view that it's looking for. Here is the corrected config snippet, let me know if it works:

    "views": {
      "RGB": {
        "description": "RGB image.",
        "type": "image",
        "data": [
          "$Pleiades.B1",
          "$Pleiades.B2",
          "$Pleiades.B3"
        ]
      },
      "NIR": {
        "description": "Near Infrared",
        "type": "image",
        "data": "$Pleiades.B4",
        "cmap": "gray"
      }
    },
    "view_groups": {
      "default": [
        "RGB",
        "NIR"
      ]
    }
  }

Hi ! Thank you for your reply ! Your code snippet works perfectly fine. I hadn't noticed my indentation error... Since no error was prompted, I got confused. Maybe adding a validity check of the config beforehand could prevent such situations ? Just an idea :-)
Have a good day !

Glad it worked! And yes, some kind of automatic checker for the config would be a nice feature, I will add it to the to-do. thanks.