ESA-PhiLab / iris

Semi-automatic tool for manual segmentation of multi-spectral and geo-spatial imagery.
GNU General Public License v3.0
123 stars 39 forks source link

How to load existing masks #57

Closed tbonfort closed 2 months ago

tbonfort commented 3 months ago

Hi, I already have existing labels in png format that I would like to edit/update with Iris. i.e.

"segmentation": {
      "path": "/path/to/labels/test/lab-{id}.png",
      "mask_encoding": "integer",
      "mask_area":[0,0,512,512],
      "score": "f1",
      "unverified_threshold": 1,
      "test_images": null
  },

where /path/to/labels/test/lab-{id}.png points to an already existing png file.

Is there a way to import these existing files so that I can view and update them? Or should I manually convert them to ./cloud-segmentation.iris/segmentation/7/{id}_user.npy first ?

Thanks

aliFrancis commented 3 months ago

Hi @tbonfort !

I haven't tried anything like this with IRIS before, but it is indeed an interesting use case. If you manually set the _user.npy files as you suggest, then you will be able to edit the labels. However, assuming the labels fully cover the image, then the model within IRIS will not be able to overwrite any of those labels (user annotations always take precedence over model predictions). You could, however, use the eraser tool to remove areas that you'd like to then fill with the model.

aliFrancis commented 2 months ago

Any updates on this?

tbonfort commented 2 months ago

Thanks for the response, and sorry for the late reply. My aim was to be able to add a snow class to the cloudsen dataset, but I will not be continuing that effort. In order to do this, I wrote a small script to re-create the *.npy files, while setting the "0" class marked as unset, and all other classes set as manually set. I then made a small modification to the inferer so that it would only add pixels belonging to my new snow class. I can post these small modifications here, but they do not belong to the core program as they are not generic at all. this issue can be closed.