Skip to content

Commit cdc7dde

Browse files
committed
Fix unsup image loading when not validating
1 parent f6711c3 commit cdc7dde

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

napari_cellseg3d/code_plugins/plugin_model_training.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import shutil
2+
import warnings
23
from functools import partial
34
from pathlib import Path
45
from typing import TYPE_CHECKING, List
@@ -431,13 +432,18 @@ def check_ready(self):
431432
* False and displays a warning if not
432433
433434
"""
434-
if (
435-
self.images_filepaths == []
436-
or self.labels_filepaths == []
437-
or len(self.images_filepaths) != len(self.labels_filepaths)
438-
):
439-
logger.warning("Image and label paths are not correctly set")
440-
return False
435+
if not self.unsupervised_mode:
436+
if (
437+
self.images_filepaths == []
438+
or self.labels_filepaths == []
439+
or len(self.images_filepaths) != len(self.labels_filepaths)
440+
):
441+
logger.warning("Image and label paths are not correctly set")
442+
return False
443+
else:
444+
if self.get_unsupervised_image_filepaths() == []:
445+
logger.warning("Image paths are not correctly set")
446+
return False
441447
return True
442448

443449
def _toggle_unsupervised_mode(self, enabled=False):
@@ -940,8 +946,9 @@ def start(self):
940946

941947
if not self.check_ready(): # issues a warning if not ready
942948
err = "Aborting, please set all required paths"
943-
self.log.print_and_log(err)
949+
# self.log.print_and_log(err)
944950
logger.warning(err)
951+
warnings.warn(err, stacklevel=1)
945952
return
946953

947954
if self.worker is not None:

0 commit comments

Comments
 (0)