From 4f84090a8ea177403d5ab7c923ecc52588b5e9a4 Mon Sep 17 00:00:00 2001 From: Fernando Cervantes Sanchez Date: Mon, 5 Aug 2024 17:11:29 -0400 Subject: [PATCH 1/2] Updated pyproject.toml for future integration into other package manager repositories --- pyproject.toml | 7 ++++++- setup.cfg | 2 -- 2 files changed, 6 insertions(+), 3 deletions(-) delete mode 100644 setup.cfg diff --git a/pyproject.toml b/pyproject.toml index 1cda397..709ed07 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,12 +24,15 @@ classifiers = [ ] requires-python = ">=3.10" dependencies = [ + "napari", "numpy", + "dask[array]", "magicgui", "qtpy", "scikit-image", "tensorstore==0.1.59", "ome-zarr==0.9.0", + "zarr", "zarrdataset>=0.2.0", ] @@ -49,10 +52,12 @@ testing = [ [project.entry-points."napari.manifest"] napari-activelearning = "napari_activelearning:napari.yaml" +[project.urls] +Homepage = "https://github.com/TheJacksonLaboratory/activelearning" [build-system] -requires = ["setuptools>=42.0.0", "wheel", "setuptools_scm"] +requires = ["setuptools>=42.0.0", "setuptools_scm"] build-backend = "setuptools.build_meta" [tool.setuptools] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 30ec8f5..0000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[metadata] -url = https://github.com/TheJacksonLaboratory/activelearning \ No newline at end of file From 477a71f930d0a079a15eb70121c98c3ccaf3807f Mon Sep 17 00:00:00 2001 From: Fernando Cervantes Sanchez Date: Mon, 5 Aug 2024 17:12:22 -0400 Subject: [PATCH 2/2] Fixed bug that prevented to change cellpose models --- src/napari_activelearning/_models.py | 7 +++--- .../_models_interface.py | 25 ++++++++++++------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/napari_activelearning/_models.py b/src/napari_activelearning/_models.py index b428863..6e9ad3e 100644 --- a/src/napari_activelearning/_models.py +++ b/src/napari_activelearning/_models.py @@ -129,10 +129,9 @@ def _get_transform(self): return self._transform def _fine_tune(self, train_data, train_labels, test_data, test_labels): - if self._model is None: - self._model_init() + self._model_init() - model_path = train.train_seg( + self._pretrained_model = train.train_seg( self._model.net, train_data=train_data, train_labels=train_labels, @@ -163,7 +162,7 @@ def _fine_tune(self, train_data, train_labels, test_data, test_labels): model_name=self._model_name ) - self._model_init(pretrained_model=model_path) + self._model_init(pretrained_model=self._pretrained_model) USING_CELLPOSE = True diff --git a/src/napari_activelearning/_models_interface.py b/src/napari_activelearning/_models_interface.py index b0f4c42..69f946f 100644 --- a/src/napari_activelearning/_models_interface.py +++ b/src/napari_activelearning/_models_interface.py @@ -134,11 +134,11 @@ class CellposeTunableWidget(CellposeTunable, QWidget): def __init__(self): super().__init__() - (segmentation_parameters, + (self._segmentation_parameters, segmentation_parameter_names) =\ cellpose_segmentation_parameters_widget() - (finetuning_parameters, + (self._finetuning_parameters, finetuning_parameter_names) =\ cellpose_finetuning_parameters_widget() @@ -166,7 +166,7 @@ def __init__(self): Qt.ScrollBarAlwaysOff ) self._segmentation_parameters_scr.setWidget( - segmentation_parameters.native + self._segmentation_parameters.native ) self._finetuning_parameters_scr = QScrollArea() @@ -175,16 +175,17 @@ def __init__(self): Qt.ScrollBarAlwaysOff ) self._finetuning_parameters_scr.setWidget( - finetuning_parameters.native + self._finetuning_parameters.native ) for par_name in segmentation_parameter_names: - segmentation_parameters.__getattr__(par_name).changed.connect( + self._segmentation_parameters.__getattr__(par_name)\ + .changed.connect( partial(self._set_parameter, parameter_key="_" + par_name) ) for par_name in finetuning_parameter_names: - finetuning_parameters.__getattr__(par_name).changed.connect( + self._finetuning_parameters.__getattr__(par_name).changed.connect( partial(self._set_parameter, parameter_key="_" + par_name) ) @@ -220,6 +221,12 @@ def _show_segmentation_parameters(self, show: bool): def _show_finetuning_parameters(self, show: bool): self._finetuning_parameters_scr.setVisible(show) + def _fine_tune(self, train_data, train_labels, test_data, test_labels): + super()._fine_tune(train_data, train_labels, test_data, + test_labels) + self._segmentation_parameters.pretrained_model.value =\ + self._pretrained_model + def simple_segmentation_parameters_widget(): @magicgui(auto_call=True) @@ -245,7 +252,7 @@ class SimpleTunableWidget(SimpleTunable, QWidget): def __init__(self): super().__init__() - (segmentation_parameters, + (self._segmentation_parameters, segmentation_parameter_names) =\ simple_segmentation_parameters_widget() @@ -264,11 +271,11 @@ def __init__(self): Qt.ScrollBarAlwaysOff ) self._segmentation_parameters_scr.setWidget( - segmentation_parameters.native + self._segmentation_parameters.native ) for par_name in segmentation_parameter_names: - segmentation_parameters.__getattr__(par_name).changed.connect( + self._segmentation_parameters.__getattr__(par_name).changed.connect( partial(self._set_parameter, parameter_key="_" + par_name) )