lazylabel-gui 1.3.4__py3-none-any.whl → 1.3.6__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/models/sam2_model.py +253 -134
- lazylabel/ui/main_window.py +100 -530
- lazylabel/ui/photo_viewer.py +35 -11
- lazylabel/ui/widgets/channel_threshold_widget.py +18 -4
- lazylabel/ui/workers/__init__.py +15 -0
- lazylabel/ui/workers/image_discovery_worker.py +66 -0
- lazylabel/ui/workers/multi_view_sam_init_worker.py +135 -0
- lazylabel/ui/workers/multi_view_sam_update_worker.py +158 -0
- lazylabel/ui/workers/sam_update_worker.py +129 -0
- lazylabel/ui/workers/single_view_sam_init_worker.py +61 -0
- {lazylabel_gui-1.3.4.dist-info → lazylabel_gui-1.3.6.dist-info}/METADATA +52 -49
- {lazylabel_gui-1.3.4.dist-info → lazylabel_gui-1.3.6.dist-info}/RECORD +16 -10
- {lazylabel_gui-1.3.4.dist-info → lazylabel_gui-1.3.6.dist-info}/WHEEL +0 -0
- {lazylabel_gui-1.3.4.dist-info → lazylabel_gui-1.3.6.dist-info}/entry_points.txt +0 -0
- {lazylabel_gui-1.3.4.dist-info → lazylabel_gui-1.3.6.dist-info}/licenses/LICENSE +0 -0
- {lazylabel_gui-1.3.4.dist-info → lazylabel_gui-1.3.6.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,61 @@
|
|
1
|
+
"""Worker thread for initializing single-view SAM model in background."""
|
2
|
+
|
3
|
+
import os
|
4
|
+
|
5
|
+
from PyQt6.QtCore import QThread, pyqtSignal
|
6
|
+
|
7
|
+
|
8
|
+
class SingleViewSAMInitWorker(QThread):
|
9
|
+
"""Worker thread for initializing single-view SAM model in background."""
|
10
|
+
|
11
|
+
model_initialized = pyqtSignal(object) # model_instance
|
12
|
+
finished = pyqtSignal()
|
13
|
+
error = pyqtSignal(str)
|
14
|
+
progress = pyqtSignal(str) # status message
|
15
|
+
|
16
|
+
def __init__(self, model_manager, default_model_type, custom_model_path=None):
|
17
|
+
super().__init__()
|
18
|
+
self.model_manager = model_manager
|
19
|
+
self.default_model_type = default_model_type
|
20
|
+
self.custom_model_path = custom_model_path
|
21
|
+
self._should_stop = False
|
22
|
+
|
23
|
+
def stop(self):
|
24
|
+
"""Stop the worker gracefully."""
|
25
|
+
self._should_stop = True
|
26
|
+
|
27
|
+
def run(self):
|
28
|
+
"""Initialize SAM model in background."""
|
29
|
+
try:
|
30
|
+
if self._should_stop:
|
31
|
+
return
|
32
|
+
|
33
|
+
if self.custom_model_path:
|
34
|
+
# Load custom model
|
35
|
+
model_name = os.path.basename(self.custom_model_path)
|
36
|
+
self.progress.emit(f"Loading {model_name}...")
|
37
|
+
|
38
|
+
success = self.model_manager.load_custom_model(self.custom_model_path)
|
39
|
+
if not success:
|
40
|
+
raise Exception(f"Failed to load custom model: {model_name}")
|
41
|
+
|
42
|
+
sam_model = self.model_manager.sam_model
|
43
|
+
else:
|
44
|
+
# Initialize the default model
|
45
|
+
self.progress.emit("Initializing AI model...")
|
46
|
+
sam_model = self.model_manager.initialize_default_model(
|
47
|
+
self.default_model_type
|
48
|
+
)
|
49
|
+
|
50
|
+
if self._should_stop:
|
51
|
+
return
|
52
|
+
|
53
|
+
if sam_model and sam_model.is_loaded:
|
54
|
+
self.model_initialized.emit(sam_model)
|
55
|
+
self.progress.emit("AI model initialized")
|
56
|
+
else:
|
57
|
+
self.error.emit("Model failed to load")
|
58
|
+
|
59
|
+
except Exception as e:
|
60
|
+
if not self._should_stop:
|
61
|
+
self.error.emit(f"Failed to load AI model: {str(e)}")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: lazylabel-gui
|
3
|
-
Version: 1.3.
|
3
|
+
Version: 1.3.6
|
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
|
@@ -53,17 +53,24 @@ Requires-Dist: pytest-qt>=4.2.0; extra == "dev"
|
|
53
53
|
Requires-Dist: ruff>=0.8.0; extra == "dev"
|
54
54
|
Dynamic: license-file
|
55
55
|
|
56
|
-
#
|
56
|
+
# LazyLabel
|
57
57
|
|
58
|
-
|
58
|
+
<div align="center">
|
59
|
+
<img src="https://raw.githubusercontent.com/dnzckn/LazyLabel/main/src/lazylabel/demo_pictures/logo2.png" alt="LazyLabel Logo" style="height:60px; vertical-align:middle;" />
|
60
|
+
<img src="https://raw.githubusercontent.com/dnzckn/LazyLabel/main/src/lazylabel/demo_pictures/logo_black.png" alt="LazyLabel Cursive" style="height:60px; vertical-align:middle;" />
|
61
|
+
</div>
|
59
62
|
|
60
|
-
|
63
|
+
**AI-Assisted Image Segmentation for Machine Learning Applications**
|
61
64
|
|
62
|
-
|
65
|
+
LazyLabel integrates Meta's Segment Anything Model (SAM) with advanced editing capabilities to enable efficient, high-precision image annotation. Designed for computer vision research and machine learning dataset preparation.
|
66
|
+
|
67
|
+
<div align="center">
|
68
|
+
<img src="https://raw.githubusercontent.com/dnzckn/LazyLabel/main/src/lazylabel/demo_pictures/gui.PNG" alt="LazyLabel Screenshot" width="800"/>
|
69
|
+
</div>
|
63
70
|
|
64
71
|
---
|
65
72
|
|
66
|
-
##
|
73
|
+
## Quick Start
|
67
74
|
|
68
75
|
### Installation
|
69
76
|
```bash
|
@@ -71,38 +78,38 @@ pip install lazylabel-gui
|
|
71
78
|
lazylabel-gui
|
72
79
|
```
|
73
80
|
|
74
|
-
### Optional: SAM
|
75
|
-
For
|
81
|
+
### Optional: SAM 2.1 Support
|
82
|
+
For enhanced performance with SAM 2.1 models:
|
76
83
|
```bash
|
77
84
|
pip install git+https://github.com/facebookresearch/sam2.git
|
78
85
|
```
|
79
|
-
|
86
|
+
**Note:** SAM 2.1 is optional - LazyLabel downloads SAM 1.0 models by default.
|
80
87
|
|
81
88
|
### Usage
|
82
|
-
1. **Open Folder**
|
83
|
-
2. **Click on
|
84
|
-
3. **
|
85
|
-
4. **Export**
|
89
|
+
1. **Open Folder** - Select your image directory
|
90
|
+
2. **AI Segmentation** - Click on objects for automatic mask generation
|
91
|
+
3. **Manual Refinement** - Edit polygons, merge segments, adjust classifications
|
92
|
+
4. **Export** - Generate `.npz` files with one-hot encoded masks for ML training
|
86
93
|
|
87
94
|
---
|
88
95
|
|
89
|
-
##
|
96
|
+
## Key Features
|
90
97
|
|
91
|
-
-
|
92
|
-
-
|
93
|
-
-
|
94
|
-
-
|
95
|
-
-
|
96
|
-
-
|
97
|
-
-
|
98
|
-
-
|
99
|
-
-
|
100
|
-
-
|
101
|
-
-
|
98
|
+
- **One-click AI segmentation** with Meta's SAM and SAM 2.1 models
|
99
|
+
- **Manual polygon drawing** with full vertex control
|
100
|
+
- **Smart editing tools** - merge segments, adjust class names, and class order
|
101
|
+
- **ML-ready exports** - One-hot encoded `.npz` format and `.json` for YOLO format
|
102
|
+
- **Image enhancement** - brightness, contrast, gamma adjustment
|
103
|
+
- **Advanced image viewer** - zoom, pan, and real-time adjustments
|
104
|
+
- **Edge cropping** - define custom crop areas to focus on specific regions
|
105
|
+
- **Undo/Redo system** - full history of all actions
|
106
|
+
- **Auto-saving** - automatic saving of labels when navigating between images
|
107
|
+
- **Advanced filtering** - FFT thresholding and color channel thresholding
|
108
|
+
- **Customizable hotkeys** for all functions
|
102
109
|
|
103
110
|
---
|
104
111
|
|
105
|
-
##
|
112
|
+
## Essential Hotkeys
|
106
113
|
|
107
114
|
| Action | Key | Description |
|
108
115
|
|--------|-----|-------------|
|
@@ -115,13 +122,13 @@ pip install git+https://github.com/facebookresearch/sam2.git
|
|
115
122
|
| **Positive Point** | `Left Click` | Add to segment |
|
116
123
|
| **Negative Point** | `Right Click` | Remove from segment |
|
117
124
|
|
118
|
-
|
125
|
+
**Note:** All hotkeys are fully customizable - Click "Hotkeys" button to personalize your workflow.
|
119
126
|
|
120
127
|
---
|
121
128
|
|
122
|
-
##
|
129
|
+
## Output Format
|
123
130
|
|
124
|
-
|
131
|
+
LazyLabel exports data in standardized formats optimized for machine learning workflows:
|
125
132
|
|
126
133
|
```python
|
127
134
|
import numpy as np
|
@@ -145,10 +152,9 @@ class_2_mask = mask[:, :, 2] # Object type 2
|
|
145
152
|
|
146
153
|
---
|
147
154
|
|
148
|
-
##
|
155
|
+
## Development
|
149
156
|
|
150
|
-
**Requirements:** Python 3.10
|
151
|
-
**2.5GB** disk space for SAM model (auto-downloaded)
|
157
|
+
**Requirements:** Python 3.10+, ~2.5GB disk space for SAM models (auto-downloaded)
|
152
158
|
|
153
159
|
### Installation from Source
|
154
160
|
```bash
|
@@ -160,35 +166,32 @@ lazylabel-gui
|
|
160
166
|
|
161
167
|
### Testing & Quality
|
162
168
|
```bash
|
163
|
-
# Run
|
164
|
-
|
169
|
+
# Run test suite (272 tests)
|
170
|
+
pytest --tb=short
|
165
171
|
|
166
|
-
# Code
|
167
|
-
ruff check
|
172
|
+
# Code quality checks
|
173
|
+
ruff check --fix src/
|
168
174
|
```
|
169
175
|
|
170
176
|
### Architecture
|
171
177
|
- **Modular design** with clean component separation
|
172
|
-
- **Signal-based communication** between UI elements
|
173
|
-
- **Extensible model system** for
|
174
|
-
- **Comprehensive test suite** (
|
178
|
+
- **Signal-based communication** between UI elements
|
179
|
+
- **Extensible model system** for SAM 1.0 and SAM 2.1 variants
|
180
|
+
- **Comprehensive test suite** (272 tests with extensive coverage)
|
181
|
+
- **Multi-view support** for simultaneous image processing
|
175
182
|
|
176
183
|
---
|
177
184
|
|
178
|
-
##
|
185
|
+
## Contributing
|
179
186
|
|
180
|
-
LazyLabel welcomes contributions!
|
181
|
-
- [
|
182
|
-
- [
|
183
|
-
- Issues page for feature requests and bug reports
|
187
|
+
LazyLabel welcomes contributions! Please review:
|
188
|
+
- [Usage Manual](src/lazylabel/USAGE_MANUAL.md) for comprehensive user documentation
|
189
|
+
- [Architecture Guide](src/lazylabel/ARCHITECTURE.md) for technical implementation details
|
190
|
+
- [Issues page](https://github.com/dnzckn/LazyLabel/issues) for feature requests and bug reports
|
184
191
|
|
185
192
|
---
|
186
193
|
|
187
|
-
##
|
194
|
+
## Acknowledgments
|
188
195
|
|
189
196
|
- [LabelMe](https://github.com/wkentaro/labelme)
|
190
197
|
- [Segment-Anything-UI](https://github.com/branislavhesko/segment-anything-ui)
|
191
|
-
|
192
|
-
---
|
193
|
-
|
194
|
-
**Made with ❤️ for the computer vision community**
|
@@ -10,7 +10,7 @@ lazylabel/core/file_manager.py,sha256=Fs4IJIm2hHvYXeDWR7mqEu2EE21o6qwSPpECv8CYQ3
|
|
10
10
|
lazylabel/core/model_manager.py,sha256=NmgnIrw9sb_vSwRVkBr2Z_Mc2kFfdFukFgUhqs2e-L0,6829
|
11
11
|
lazylabel/core/segment_manager.py,sha256=M6kHcYeiub3WqL01NElCvKOc2GNmf72LUM1W8XwSaxc,6465
|
12
12
|
lazylabel/models/__init__.py,sha256=fIlk_0DuZfiClcm0XlZdimeHzunQwBmTMI4PcGsaymw,91
|
13
|
-
lazylabel/models/sam2_model.py,sha256=
|
13
|
+
lazylabel/models/sam2_model.py,sha256=Z0UVs_m9VwUO4znZF5VA4-HQSF-oCT9RbKtK3EU20qU,21747
|
14
14
|
lazylabel/models/sam_model.py,sha256=Q1GAaFG6n5JoZXhClcUZKN-gvA_wmtVuUYzELG7zhPg,8833
|
15
15
|
lazylabel/ui/__init__.py,sha256=4qDIh9y6tABPmD8MAMGZn_G7oSRyrcHt2HkjoWgbGH4,268
|
16
16
|
lazylabel/ui/control_panel.py,sha256=6WsCX9MzLtYzgi93Yat4utajHHjKuROg_Nf9iGLY05s,33456
|
@@ -18,9 +18,9 @@ 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
|
21
|
+
lazylabel/ui/main_window.py,sha256=TZ1m7GxxyonhSMffwNe8sE264IzuoML8W-V9r7HOP1E,382538
|
22
22
|
lazylabel/ui/numeric_table_widget_item.py,sha256=dQUlIFu9syCxTGAHVIlmbgkI7aJ3f3wmDPBz1AGK9Bg,283
|
23
|
-
lazylabel/ui/photo_viewer.py,sha256=
|
23
|
+
lazylabel/ui/photo_viewer.py,sha256=3o7Xldn9kJWvWlbpcHDRMk87dnB5xZKbfyAT3oBYlIo,6670
|
24
24
|
lazylabel/ui/reorderable_class_table.py,sha256=sxHhQre5O_MXLDFgKnw43QnvXXoqn5xRKMGitgO7muI,2371
|
25
25
|
lazylabel/ui/right_panel.py,sha256=D69XgPXpLleflsIl8xCtoBZzFleLqx0SezdwfcEJhUg,14280
|
26
26
|
lazylabel/ui/modes/__init__.py,sha256=ikg47aeexLQavSda_3tYn79xGJW38jKoUCLXRe2w8ok,219
|
@@ -30,20 +30,26 @@ lazylabel/ui/modes/single_view_mode.py,sha256=khGUXVQ_lv9cCXkOAewQN8iH7R_CPyIVtQ
|
|
30
30
|
lazylabel/ui/widgets/__init__.py,sha256=6VDoMnanqVm3yjOovxie3WggPODuhUsIO75RtxOhQhI,688
|
31
31
|
lazylabel/ui/widgets/adjustments_widget.py,sha256=5xldhdEArX3H2P7EmHPjURdwpV-Wa2WULFfspp0gxns,12750
|
32
32
|
lazylabel/ui/widgets/border_crop_widget.py,sha256=8NTkHrk_L5_T1psVuXMspVVZRPTTeJyIEYBfVxdGeQA,7529
|
33
|
-
lazylabel/ui/widgets/channel_threshold_widget.py,sha256=
|
33
|
+
lazylabel/ui/widgets/channel_threshold_widget.py,sha256=DSYDOUTMXo02Fn5P4cjh2OqDawA2Hm_ChYecVGwzwk8,21297
|
34
34
|
lazylabel/ui/widgets/fft_threshold_widget.py,sha256=mcbkNoP0aj-Pe57sgIWBnmg4JiEbTikrwG67Vgygnio,20859
|
35
35
|
lazylabel/ui/widgets/fragment_threshold_widget.py,sha256=YtToua1eAUtEuJ3EwdCMvI-39TRrFnshkty4tnR4OMU,3492
|
36
36
|
lazylabel/ui/widgets/model_selection_widget.py,sha256=k4zyhWszi_7e-0TPa0Go1LLPZpTNGtrYSb-yT7uGiVU,8420
|
37
37
|
lazylabel/ui/widgets/settings_widget.py,sha256=ShTaLJeXxwrSuTV4kmtV2JiWjfREil2D1nvPUIfAgDs,4859
|
38
38
|
lazylabel/ui/widgets/status_bar.py,sha256=wTbMQNEOBfmtNj8EVFZS_lxgaemu-CbRXeZzEQDaVz8,4014
|
39
|
+
lazylabel/ui/workers/__init__.py,sha256=1pctFFvHiVW3meiaW5_-AUgQ0AKcvCF4J8-QHoWRtwI,529
|
40
|
+
lazylabel/ui/workers/image_discovery_worker.py,sha256=mW4diqPnbyGgyX2DDKm_o9NnAq4V-Jywk_f7risVgS0,2405
|
41
|
+
lazylabel/ui/workers/multi_view_sam_init_worker.py,sha256=O1EbMNVG-0NZ1FuOvP475WMIg2tQ3IM83Mb8sJrpRsQ,5558
|
42
|
+
lazylabel/ui/workers/multi_view_sam_update_worker.py,sha256=2Y8YXqgBXlqRhu63RfoIa0sob-t7DEe5fiuAW3f48eE,5671
|
43
|
+
lazylabel/ui/workers/sam_update_worker.py,sha256=dL-OA8mfHn0EGhyMofOK-NpbomkWUQypcyDsV3AlYYE,4792
|
44
|
+
lazylabel/ui/workers/single_view_sam_init_worker.py,sha256=hScGlCkPgh5oVoAKZZZjQhSshnTJXLRHzJHR-hHWKj0,2176
|
39
45
|
lazylabel/utils/__init__.py,sha256=V6IR5Gim-39HgM2NyTVT-n8gy3mjilCSFW9y0owN5nc,179
|
40
46
|
lazylabel/utils/custom_file_system_model.py,sha256=-3EimlybvevH6bvqBE0qdFnLADVtayylmkntxPXK0Bk,4869
|
41
47
|
lazylabel/utils/fast_file_manager.py,sha256=kzbWz_xKufG5bP6sjyZV1fmOKRWPPNeL-xLYZEu_8wE,44697
|
42
48
|
lazylabel/utils/logger.py,sha256=R7z6ifgA-NY-9ZbLlNH0i19zzwXndJ_gkG2J1zpVEhg,1306
|
43
49
|
lazylabel/utils/utils.py,sha256=sYSCoXL27OaLgOZaUkCAhgmKZ7YfhR3Cc5F8nDIa3Ig,414
|
44
|
-
lazylabel_gui-1.3.
|
45
|
-
lazylabel_gui-1.3.
|
46
|
-
lazylabel_gui-1.3.
|
47
|
-
lazylabel_gui-1.3.
|
48
|
-
lazylabel_gui-1.3.
|
49
|
-
lazylabel_gui-1.3.
|
50
|
+
lazylabel_gui-1.3.6.dist-info/licenses/LICENSE,sha256=kSDEIgrWAPd1u2UFGGpC9X71dhzrlzBFs8hbDlENnGE,1092
|
51
|
+
lazylabel_gui-1.3.6.dist-info/METADATA,sha256=wU3SVog5c0CafMdOiUD82IFoQwZ-LUdOTGxbLQWW7WU,7156
|
52
|
+
lazylabel_gui-1.3.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
53
|
+
lazylabel_gui-1.3.6.dist-info/entry_points.txt,sha256=Hd0WwEG9OPTa_ziYjiD0aRh7R6Fupt-wdQ3sspdc1mM,54
|
54
|
+
lazylabel_gui-1.3.6.dist-info/top_level.txt,sha256=YN4uIyrpDBq1wiJaBuZLDipIzyZY0jqJOmmXiPIOUkU,10
|
55
|
+
lazylabel_gui-1.3.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|