lazylabel-gui 1.3.1__py3-none-any.whl → 1.3.3__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.
- lazylabel/core/file_manager.py +33 -1
- lazylabel/ui/main_window.py +380 -119
- lazylabel/ui/right_panel.py +29 -2
- lazylabel/utils/fast_file_manager.py +831 -0
- {lazylabel_gui-1.3.1.dist-info → lazylabel_gui-1.3.3.dist-info}/METADATA +1 -1
- {lazylabel_gui-1.3.1.dist-info → lazylabel_gui-1.3.3.dist-info}/RECORD +10 -10
- lazylabel/ui/test_hover.py +0 -48
- {lazylabel_gui-1.3.1.dist-info → lazylabel_gui-1.3.3.dist-info}/WHEEL +0 -0
- {lazylabel_gui-1.3.1.dist-info → lazylabel_gui-1.3.3.dist-info}/entry_points.txt +0 -0
- {lazylabel_gui-1.3.1.dist-info → lazylabel_gui-1.3.3.dist-info}/licenses/LICENSE +0 -0
- {lazylabel_gui-1.3.1.dist-info → lazylabel_gui-1.3.3.dist-info}/top_level.txt +0 -0
lazylabel/core/file_manager.py
CHANGED
@@ -24,16 +24,48 @@ class FileManager:
|
|
24
24
|
crop_coords: tuple[int, int, int, int] | None = None,
|
25
25
|
) -> str:
|
26
26
|
"""Save segments as NPZ file."""
|
27
|
+
logger.debug(f"Saving NPZ for image: {image_path}")
|
28
|
+
logger.debug(f"Image size: {image_size}, Class order: {class_order}")
|
29
|
+
|
30
|
+
# Validate inputs
|
31
|
+
if not class_order:
|
32
|
+
raise ValueError("No classes defined for saving")
|
33
|
+
|
27
34
|
final_mask_tensor = self.segment_manager.create_final_mask_tensor(
|
28
35
|
image_size, class_order
|
29
36
|
)
|
30
37
|
|
38
|
+
# Validate mask tensor
|
39
|
+
if final_mask_tensor.size == 0:
|
40
|
+
raise ValueError("Empty mask tensor generated")
|
41
|
+
|
42
|
+
logger.debug(f"Final mask tensor shape: {final_mask_tensor.shape}")
|
43
|
+
|
31
44
|
# Apply crop if coordinates are provided
|
32
45
|
if crop_coords:
|
33
46
|
final_mask_tensor = self._apply_crop_to_mask(final_mask_tensor, crop_coords)
|
47
|
+
logger.debug(f"Applied crop: {crop_coords}")
|
34
48
|
|
35
49
|
npz_path = os.path.splitext(image_path)[0] + ".npz"
|
36
|
-
|
50
|
+
|
51
|
+
# Create parent directory if it doesn't exist
|
52
|
+
parent_dir = os.path.dirname(npz_path)
|
53
|
+
if parent_dir: # Only create if there's actually a parent directory
|
54
|
+
os.makedirs(parent_dir, exist_ok=True)
|
55
|
+
logger.debug(f"Ensured directory exists: {parent_dir}")
|
56
|
+
|
57
|
+
# Save the NPZ file
|
58
|
+
try:
|
59
|
+
np.savez_compressed(npz_path, mask=final_mask_tensor.astype(np.uint8))
|
60
|
+
logger.debug(f"Saved NPZ file: {npz_path}")
|
61
|
+
except Exception as e:
|
62
|
+
raise OSError(f"Failed to save NPZ file {npz_path}: {str(e)}") from e
|
63
|
+
|
64
|
+
# Verify the file was actually created
|
65
|
+
if not os.path.exists(npz_path):
|
66
|
+
raise OSError(f"NPZ file was not created: {npz_path}")
|
67
|
+
|
68
|
+
logger.info(f"Successfully saved NPZ: {os.path.basename(npz_path)}")
|
37
69
|
return npz_path
|
38
70
|
|
39
71
|
def save_yolo_txt(
|