Abe404 / root_painter

RootPainter: Deep Learning Segmentation of Biological Images with Corrective Annotation
https://nph.onlinelibrary.wiley.com/doi/full/10.1111/nph.18387
Other
53 stars 12 forks source link

Could not find a backend to open image #57

Closed big-charles closed 1 year ago

big-charles commented 1 year ago

An image (maybe more) in my dataset triggered this error when annotated and then clicked on saved and next. Inference on it worked fine.

bash-4.2$ python main.py                                                                      │README.md  gpl3.txt  publish.sh  setup.py
GPU Available True                                                                            │(base) root@PC-SE22-091:/home/Charles/root_painter# cd painter/src/main/python/
Batch size 11                                                                                 │(base) root@PC-SE22-091:/home/Charles/root_painter/painter/src/main/python# python main.py
Started main loop. Checking for instructions in /home/ucl/elia/rongione/root_painter_sync/inst│QStandardPaths: runtime directory '/mnt/wslg/runtime-dir' is not owned by UID 0, but a direct
ructions                                                                                      │ory permissions 0700 owned by UID 1000 GID 100
execute_instruction start_training                                                            │view menu add action
epoch train duration 166.935                                                                  │Starting watch for changes
Traceback (most recent call last):                                                            │load seg from file.
  File "main.py", line 35, in <module>                                                        │load seg from file.
    trainer.main_loop()                                                                       │^[[A^[[B
  File "/CECI/home/users/r/o/rongione/root_painter/trainer/trainer.py", line 120, in main_loop│
    self.train_one_epoch()                                                                    │
  File "/CECI/home/users/r/o/rongione/root_painter/trainer/trainer.py", line 301, in train_one│
_epoch                                                                                        │
    self.validation()                                                                         │
  File "/CECI/home/users/r/o/rongione/root_painter/trainer/trainer.py", line 332, in validatio│
n                                                                                             │
    cur_metrics = get_val_metrics(copy.deepcopy(self.model))                                  │
  File "/CECI/home/users/r/o/rongione/root_painter/trainer/model_utils.py", line 108, in get_v│
al_metrics                                                                                    │
    image = im_utils.load_image(image_path)                                                   │
  File "/CECI/home/users/r/o/rongione/root_painter/trainer/im_utils.py", line 223, in load_ima│
ge                                                                                            │
    photo = imread(photo_path)                                                                │
  File "/home/ucl/elia/rongione/.local/lib/python3.8/site-packages/skimage/io/_io.py", line 53│
, in imread                                                                                   │
    img = call_plugin('imread', fname, plugin=plugin, **plugin_args)                          │
  File "/home/ucl/elia/rongione/.local/lib/python3.8/site-packages/skimage/io/manage_plugins.p│
y", line 207, in call_plugin                                                                  │
    return func(*args, **kwargs)                                                              │
  File "/home/ucl/elia/rongione/.local/lib/python3.8/site-packages/skimage/io/_plugins/imageio│
_plugin.py", line 10, in imread                                                               │
    return np.asarray(imageio_imread(*args, **kwargs))                                        │
  File "/home/ucl/elia/rongione/.local/lib/python3.8/site-packages/imageio/__init__.py", line │
97, in imread                                                                                 │
    return imread_v2(uri, format=format, **kwargs)                                            │
  File "/home/ucl/elia/rongione/.local/lib/python3.8/site-packages/imageio/v2.py", line 200, i│
n imread                                                                                      │
    with imopen(uri, "ri", **imopen_args) as file:                                            │
  File "/home/ucl/elia/rongione/.local/lib/python3.8/site-packages/imageio/core/imopen.py", li│
ne 303, in imopen                                                                             │
    raise err_type(err_msg)                                                                   │
ValueError: Could not find a backend to open `/home/ucl/elia/rongione/root_painter_sync/datase│
ts/Paille_photo_finale/3T4_20210508_104558.jpg:Zone.Identifier`` with iomode `ri`.            │

3T4_20210508_104558

Abe404 commented 1 year ago

I haven't been able to reproduce the bug. But I've switched the trainer to use the same mechanism as the client for loading the image (PIL instead of skimage). See https://github.com/Abe404/root_painter/commit/27de9e5ef8547cf0d1915c720d33ace97f0c36bc

The change has been pushed to the master branch.

Can you please let me know if the problem persists after you pull these latest changes from master?