lazylabel-gui 1.3.7__py3-none-any.whl → 1.3.8__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6293,22 +6293,23 @@ class MainWindow(QMainWindow):
6293
6293
  )
6294
6294
 
6295
6295
  def _start_sequential_multi_view_sam_loading(self):
6296
- """Start loading images into SAM models sequentially to avoid resource conflicts."""
6296
+ """Start loading images into SAM models in parallel for faster processing."""
6297
6297
  # Check if any loading is already in progress to prevent duplicate workers
6298
6298
  any_updating = any(self.multi_view_models_updating)
6299
6299
  if any_updating:
6300
- # Sequential loading already in progress, don't start another
6300
+ # Loading already in progress, don't start another
6301
6301
  updating_indices = [
6302
6302
  i
6303
6303
  for i, updating in enumerate(self.multi_view_models_updating)
6304
6304
  if updating
6305
6305
  ]
6306
6306
  logger.debug(
6307
- f"Sequential loading already in progress for viewers: {updating_indices}"
6307
+ f"Parallel loading already in progress for viewers: {updating_indices}"
6308
6308
  )
6309
6309
  return
6310
6310
 
6311
- # Find the next dirty model that needs updating
6311
+ # Find all dirty models that need updating and start them in parallel
6312
+ models_to_update = []
6312
6313
  for i in range(len(self.multi_view_models)):
6313
6314
  if (
6314
6315
  self.multi_view_images[i]
@@ -6316,15 +6317,24 @@ class MainWindow(QMainWindow):
6316
6317
  and self.multi_view_models_dirty[i]
6317
6318
  and not self.multi_view_models_updating[i]
6318
6319
  ):
6319
- # Start updating this model
6320
- self._ensure_multi_view_sam_updated(i)
6321
- return
6320
+ models_to_update.append(i)
6322
6321
 
6323
- # If no more models to update, we're done
6324
- if self._multi_view_loading_step >= self._multi_view_total_steps:
6325
- self._show_success_notification(
6326
- "AI models ready for prompting", duration=3000
6322
+ if models_to_update:
6323
+ logger.debug(f"Starting parallel loading for viewers: {models_to_update}")
6324
+ # Show notification about parallel loading
6325
+ self._show_notification(
6326
+ f"Loading embeddings for {len(models_to_update)} images in parallel...",
6327
+ duration=0,
6327
6328
  )
6329
+ # Start all workers in parallel
6330
+ for i in models_to_update:
6331
+ self._ensure_multi_view_sam_updated(i)
6332
+ else:
6333
+ # If no more models to update and none are running, we're done
6334
+ if not any(self.multi_view_models_updating):
6335
+ self._show_success_notification(
6336
+ "AI models ready for prompting", duration=3000
6337
+ )
6328
6338
 
6329
6339
  def _on_multi_view_init_error(self, error_message):
6330
6340
  """Handle multi-view model initialization error."""
@@ -6466,14 +6476,8 @@ class MainWindow(QMainWindow):
6466
6476
 
6467
6477
  logger.debug(f"Starting SAM image loading worker for viewer {viewer_index + 1}")
6468
6478
 
6469
- # Show enumerated progress notification
6470
- image_name = Path(image_path).name if image_path else "unknown"
6471
- config = self._get_multi_view_config()
6472
- num_viewers = config["num_viewers"]
6473
- self._show_notification(
6474
- f"Computing embeddings for image {viewer_index + 1}/{num_viewers}: {image_name}",
6475
- duration=0, # Persistent until completion
6476
- )
6479
+ # Individual notifications are now handled by the parallel loading start
6480
+ # No need for per-viewer notifications when loading in parallel
6477
6481
 
6478
6482
  # Get current modified image if operate_on_view is enabled
6479
6483
  current_image = None
@@ -6561,8 +6565,16 @@ class MainWindow(QMainWindow):
6561
6565
  if hasattr(self, "_multi_view_loading_step"):
6562
6566
  self._multi_view_loading_step += 1
6563
6567
 
6564
- # Continue sequential loading
6565
- self._start_sequential_multi_view_sam_loading()
6568
+ # Check if all models are done (either loaded, failed, or timed out)
6569
+ if not any(self.multi_view_models_updating) and not any(
6570
+ self.multi_view_models_dirty
6571
+ ):
6572
+ # All models processed
6573
+ self._show_success_notification("AI model loading complete", duration=3000)
6574
+ elif not any(self.multi_view_models_updating):
6575
+ # No models are currently updating but some may still be dirty
6576
+ # Try to load remaining models
6577
+ self._start_sequential_multi_view_sam_loading()
6566
6578
 
6567
6579
  def _on_multi_view_sam_update_finished(self, viewer_index):
6568
6580
  """Handle completion of multi-view SAM model update."""
@@ -6596,14 +6608,19 @@ class MainWindow(QMainWindow):
6596
6608
  # Update progress
6597
6609
  if hasattr(self, "_multi_view_loading_step"):
6598
6610
  self._multi_view_loading_step += 1
6599
- if self._multi_view_loading_step < self._multi_view_total_steps:
6600
- self._show_notification(
6601
- f"Loading image {self._multi_view_loading_step + 1} of {self._multi_view_total_steps}...",
6602
- duration=0,
6603
- )
6604
6611
 
6605
- # Continue sequential loading of the next SAM model
6606
- self._start_sequential_multi_view_sam_loading()
6612
+ # Check if all models are done loading
6613
+ if not any(self.multi_view_models_updating) and not any(
6614
+ self.multi_view_models_dirty
6615
+ ):
6616
+ # All models loaded successfully
6617
+ self._show_success_notification(
6618
+ "AI models ready for prompting", duration=3000
6619
+ )
6620
+ elif not any(self.multi_view_models_updating):
6621
+ # No models are currently updating but some may still be dirty
6622
+ # This can happen if there was an error, try to load remaining models
6623
+ self._start_sequential_multi_view_sam_loading()
6607
6624
 
6608
6625
  def _on_multi_view_sam_update_error(self, viewer_index, error_message):
6609
6626
  """Handle multi-view SAM model update error."""
@@ -6639,8 +6656,16 @@ class MainWindow(QMainWindow):
6639
6656
  if hasattr(self, "_multi_view_loading_step"):
6640
6657
  self._multi_view_loading_step += 1
6641
6658
 
6642
- # Continue sequential loading even if this model failed
6643
- self._start_sequential_multi_view_sam_loading()
6659
+ # Check if all models are done (either loaded or failed)
6660
+ if not any(self.multi_view_models_updating) and not any(
6661
+ self.multi_view_models_dirty
6662
+ ):
6663
+ # All models processed (some may have failed)
6664
+ self._show_success_notification("AI model loading complete", duration=3000)
6665
+ elif not any(self.multi_view_models_updating):
6666
+ # No models are currently updating but some may still be dirty
6667
+ # Try to load remaining models
6668
+ self._start_sequential_multi_view_sam_loading()
6644
6669
 
6645
6670
  def _cleanup_multi_view_models(self):
6646
6671
  """Clean up multi-view model instances."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lazylabel-gui
3
- Version: 1.3.7
3
+ Version: 1.3.8
4
4
  Summary: An image segmentation GUI for generating ML ready mask tensors and annotations.
5
5
  Author-email: "Deniz N. Cakan" <deniz.n.cakan@gmail.com>
6
6
  License: MIT License
@@ -18,7 +18,7 @@ lazylabel/ui/editable_vertex.py,sha256=ofo3r8ZZ3b8oYV40vgzZuS3QnXYBNzE92ArC2wggJ
18
18
  lazylabel/ui/hotkey_dialog.py,sha256=U_B76HLOxWdWkfA4d2XgRUaZTJPAAE_m5fmwf7Rh-5Y,14743
19
19
  lazylabel/ui/hoverable_pixelmap_item.py,sha256=UbWVxpmCTaeae_AeA8gMOHYGUmAw40fZBFTS3sZlw48,1821
20
20
  lazylabel/ui/hoverable_polygon_item.py,sha256=gZalImJ_PJYM7xON0iiSjQ335ZBREOfSscKLVs-MSh8,2314
21
- lazylabel/ui/main_window.py,sha256=PFbVzZ1jbOuz2q8MNY3BHjWmJU6YoBqKiPwLvlDdsNI,383320
21
+ lazylabel/ui/main_window.py,sha256=udjyVXL6Ms_zjpT6TILdqvaSkX6u_YyaxWF93O93W2s,384664
22
22
  lazylabel/ui/numeric_table_widget_item.py,sha256=dQUlIFu9syCxTGAHVIlmbgkI7aJ3f3wmDPBz1AGK9Bg,283
23
23
  lazylabel/ui/photo_viewer.py,sha256=3o7Xldn9kJWvWlbpcHDRMk87dnB5xZKbfyAT3oBYlIo,6670
24
24
  lazylabel/ui/reorderable_class_table.py,sha256=sxHhQre5O_MXLDFgKnw43QnvXXoqn5xRKMGitgO7muI,2371
@@ -47,9 +47,9 @@ lazylabel/utils/custom_file_system_model.py,sha256=-3EimlybvevH6bvqBE0qdFnLADVta
47
47
  lazylabel/utils/fast_file_manager.py,sha256=kzbWz_xKufG5bP6sjyZV1fmOKRWPPNeL-xLYZEu_8wE,44697
48
48
  lazylabel/utils/logger.py,sha256=R7z6ifgA-NY-9ZbLlNH0i19zzwXndJ_gkG2J1zpVEhg,1306
49
49
  lazylabel/utils/utils.py,sha256=sYSCoXL27OaLgOZaUkCAhgmKZ7YfhR3Cc5F8nDIa3Ig,414
50
- lazylabel_gui-1.3.7.dist-info/licenses/LICENSE,sha256=kSDEIgrWAPd1u2UFGGpC9X71dhzrlzBFs8hbDlENnGE,1092
51
- lazylabel_gui-1.3.7.dist-info/METADATA,sha256=Mo6GD0ppauY9CxGQVxIT3BzwEcryP6D_Gs3alvGu5Eg,7754
52
- lazylabel_gui-1.3.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
53
- lazylabel_gui-1.3.7.dist-info/entry_points.txt,sha256=Hd0WwEG9OPTa_ziYjiD0aRh7R6Fupt-wdQ3sspdc1mM,54
54
- lazylabel_gui-1.3.7.dist-info/top_level.txt,sha256=YN4uIyrpDBq1wiJaBuZLDipIzyZY0jqJOmmXiPIOUkU,10
55
- lazylabel_gui-1.3.7.dist-info/RECORD,,
50
+ lazylabel_gui-1.3.8.dist-info/licenses/LICENSE,sha256=kSDEIgrWAPd1u2UFGGpC9X71dhzrlzBFs8hbDlENnGE,1092
51
+ lazylabel_gui-1.3.8.dist-info/METADATA,sha256=k6_eCNou42Egim6fW_LuvX3oLd67qTxjVqk2ovHPz0E,7754
52
+ lazylabel_gui-1.3.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
53
+ lazylabel_gui-1.3.8.dist-info/entry_points.txt,sha256=Hd0WwEG9OPTa_ziYjiD0aRh7R6Fupt-wdQ3sspdc1mM,54
54
+ lazylabel_gui-1.3.8.dist-info/top_level.txt,sha256=YN4uIyrpDBq1wiJaBuZLDipIzyZY0jqJOmmXiPIOUkU,10
55
+ lazylabel_gui-1.3.8.dist-info/RECORD,,