From f40f929e44253eb587bdcce5fecd29bb8e155269 Mon Sep 17 00:00:00 2001 From: Jordan Pierce <115024024+Jordan-Pierce@users.noreply.github.com> Date: Mon, 16 Dec 2024 15:00:56 -0500 Subject: [PATCH 1/3] LabelWindow: editting labels is cleaner and more accurate --- coralnet_toolbox/Annotations/QtAnnotation.py | 24 +++++++++++++++++--- coralnet_toolbox/QtLabelWindow.py | 5 +++- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/coralnet_toolbox/Annotations/QtAnnotation.py b/coralnet_toolbox/Annotations/QtAnnotation.py index 824304fb..72de639c 100644 --- a/coralnet_toolbox/Annotations/QtAnnotation.py +++ b/coralnet_toolbox/Annotations/QtAnnotation.py @@ -118,12 +118,30 @@ def update_user_confidence(self, new_label: 'Label'): self.show_message = False def update_label(self, new_label: 'Label'): + # Initializing if self.label is None: self.label = new_label - self.update_graphics_item() - if self.label.id != new_label.id: + # Updating + elif self.label.id != new_label.id or self.label.color != new_label.color: + # Update the label in user_confidence if it exists + if self.user_confidence: + old_confidence = next(iter(self.user_confidence.values())) + self.user_confidence = {new_label: old_confidence} + + # Update the label in machine_confidence if it exists + if self.machine_confidence: + new_machine_confidence = {} + for label, confidence in self.machine_confidence.items(): + if label.id == self.label.id: + new_machine_confidence[new_label] = confidence + else: + new_machine_confidence[label] = confidence + self.machine_confidence = new_machine_confidence + # Update the label self.label = new_label - self.update_graphics_item() + + # Always update the graphics item + self.update_graphics_item() def _prepare_data_for_qimage(self, data): if data.shape[0] == 3: # RGB image diff --git a/coralnet_toolbox/QtLabelWindow.py b/coralnet_toolbox/QtLabelWindow.py index fefffa69..30066183 100644 --- a/coralnet_toolbox/QtLabelWindow.py +++ b/coralnet_toolbox/QtLabelWindow.py @@ -405,7 +405,10 @@ def edit_labels(self, old_label, new_label, delete_old=False): self.update_labels_per_row() self.reorganize_labels() - + + # Refresh the scene with the new label + self.annotation_window.set_image(self.annotation_window.current_image_path) + def delete_label(self, label): if (label.short_label_code == "Review" and label.long_label_code == "Review" and From 05477c29b885ad81047e5319e52d6854c7e178e5 Mon Sep 17 00:00:00 2001 From: Jordan Pierce <115024024+Jordan-Pierce@users.noreply.github.com> Date: Mon, 16 Dec 2024 15:51:06 -0500 Subject: [PATCH 2/3] Fix formatting of info label text in dataset export dialog --- coralnet_toolbox/MachineLearning/ExportDataset/QtBase.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/coralnet_toolbox/MachineLearning/ExportDataset/QtBase.py b/coralnet_toolbox/MachineLearning/ExportDataset/QtBase.py index a2b5bf80..fd90817b 100644 --- a/coralnet_toolbox/MachineLearning/ExportDataset/QtBase.py +++ b/coralnet_toolbox/MachineLearning/ExportDataset/QtBase.py @@ -85,8 +85,7 @@ def setup_info_layout(self): layout = QVBoxLayout() # Create a QLabel with explanatory text and hyperlink - info_label = QLabel("Export Patches, Rectangles, and Polygons to create a YOLO-formatted \ - Classification, Detection or Segmentation dataset.") + info_label = QLabel("Export Patches, Rectangles, and Polygons to create a YOLO-formatted Classification, Detection or Segmentation dataset.") info_label.setOpenExternalLinks(True) info_label.setWordWrap(True) From 7997aecee52d81ec23948784199f958d184f9e17 Mon Sep 17 00:00:00 2001 From: Jordan Pierce <115024024+Jordan-Pierce@users.noreply.github.com> Date: Mon, 16 Dec 2024 15:51:43 -0500 Subject: [PATCH 3/3] =?UTF-8?q?Bump=20version:=200.0.13=20=E2=86=92=200.0.?= =?UTF-8?q?14?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- coralnet_toolbox/__init__.py | 2 +- pyproject.toml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/coralnet_toolbox/__init__.py b/coralnet_toolbox/__init__.py index e90f09d2..fd54aa7a 100644 --- a/coralnet_toolbox/__init__.py +++ b/coralnet_toolbox/__init__.py @@ -2,7 +2,7 @@ from coralnet_toolbox.main import run -__version__ = "0.0.13" +__version__ = "0.0.14" __author__ = "Jordan Pierce" __email__ = "jordan.pierce@noaa.gov" __credits__ = "National Center for Coastal and Ocean Sciences (NCCOS)" \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 3df0ecdc..b663bb93 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "coralnet-toolbox" -version = "0.0.13" +version = "0.0.14" dynamic = [ "dependencies", ] @@ -48,7 +48,7 @@ universal = true [tool.bumpversion] -current_version = "0.0.13" +current_version = "0.0.14" commit = true tag = true