lazylabel-gui 1.1.6__py3-none-any.whl → 1.1.7__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/ui/main_window.py +9 -9
- lazylabel/ui/widgets/settings_widget.py +1 -1
- lazylabel_gui-1.1.7.dist-info/METADATA +240 -0
- {lazylabel_gui-1.1.6.dist-info → lazylabel_gui-1.1.7.dist-info}/RECORD +8 -8
- lazylabel_gui-1.1.6.dist-info/METADATA +0 -244
- {lazylabel_gui-1.1.6.dist-info → lazylabel_gui-1.1.7.dist-info}/WHEEL +0 -0
- {lazylabel_gui-1.1.6.dist-info → lazylabel_gui-1.1.7.dist-info}/entry_points.txt +0 -0
- {lazylabel_gui-1.1.6.dist-info → lazylabel_gui-1.1.7.dist-info}/licenses/LICENSE +0 -0
- {lazylabel_gui-1.1.6.dist-info → lazylabel_gui-1.1.7.dist-info}/top_level.txt +0 -0
lazylabel/ui/main_window.py
CHANGED
@@ -587,7 +587,7 @@ class MainWindow(QMainWindow):
|
|
587
587
|
self.viewer.setFocus()
|
588
588
|
|
589
589
|
def _load_selected_image(self, index):
|
590
|
-
"""Load the selected image."""
|
590
|
+
"""Load the selected image. Auto-saves previous work if enabled."""
|
591
591
|
|
592
592
|
if not index.isValid() or not self.file_model.isDir(index.parent()):
|
593
593
|
return
|
@@ -599,6 +599,12 @@ class MainWindow(QMainWindow):
|
|
599
599
|
if path == self.current_image_path: # Only reset if loading a new image
|
600
600
|
return
|
601
601
|
|
602
|
+
# Auto-save if enabled and we have a current image (not the first load)
|
603
|
+
if self.current_image_path and self.control_panel.get_settings().get(
|
604
|
+
"auto_save", True
|
605
|
+
):
|
606
|
+
self._save_output_to_npz()
|
607
|
+
|
602
608
|
self.current_image_path = path
|
603
609
|
pixmap = QPixmap(self.current_image_path)
|
604
610
|
if not pixmap.isNull():
|
@@ -634,12 +640,9 @@ class MainWindow(QMainWindow):
|
|
634
640
|
self.model_manager.sam_model.set_image_from_path(self.current_image_path)
|
635
641
|
|
636
642
|
def _load_next_image(self):
|
637
|
-
"""Load next image in the file list
|
643
|
+
"""Load next image in the file list."""
|
638
644
|
if not self.current_file_index.isValid():
|
639
645
|
return
|
640
|
-
# Auto-save if enabled
|
641
|
-
if self.control_panel.get_settings().get("auto_save", True):
|
642
|
-
self._save_output_to_npz()
|
643
646
|
parent = self.current_file_index.parent()
|
644
647
|
row = self.current_file_index.row()
|
645
648
|
# Find next valid image file
|
@@ -651,12 +654,9 @@ class MainWindow(QMainWindow):
|
|
651
654
|
return
|
652
655
|
|
653
656
|
def _load_previous_image(self):
|
654
|
-
"""Load previous image in the file list
|
657
|
+
"""Load previous image in the file list."""
|
655
658
|
if not self.current_file_index.isValid():
|
656
659
|
return
|
657
|
-
# Auto-save if enabled
|
658
|
-
if self.control_panel.get_settings().get("auto_save", True):
|
659
|
-
self._save_output_to_npz()
|
660
660
|
parent = self.current_file_index.parent()
|
661
661
|
row = self.current_file_index.row()
|
662
662
|
# Find previous valid image file
|
@@ -22,7 +22,7 @@ class SettingsWidget(QWidget):
|
|
22
22
|
# Auto-save
|
23
23
|
self.chk_auto_save = QCheckBox("Auto-Save on Navigate")
|
24
24
|
self.chk_auto_save.setToolTip(
|
25
|
-
"Automatically save work when
|
25
|
+
"Automatically save work when switching to any new image (navigation keys, double-click, etc.)"
|
26
26
|
)
|
27
27
|
self.chk_auto_save.setChecked(True)
|
28
28
|
layout.addWidget(self.chk_auto_save)
|
@@ -0,0 +1,240 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: lazylabel-gui
|
3
|
+
Version: 1.1.7
|
4
|
+
Summary: An image segmentation GUI for generating ML ready mask tensors and annotations.
|
5
|
+
Author-email: "Deniz N. Cakan" <deniz.n.cakan@gmail.com>
|
6
|
+
License: MIT License
|
7
|
+
|
8
|
+
Copyright (c) 2025 Deniz N. Cakan
|
9
|
+
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
12
|
+
in the Software without restriction, including without limitation the rights
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
15
|
+
furnished to do so, subject to the following conditions:
|
16
|
+
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
18
|
+
copies or substantial portions of the Software.
|
19
|
+
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
26
|
+
SOFTWARE.
|
27
|
+
|
28
|
+
Project-URL: Homepage, https://github.com/dnzckn/lazylabel
|
29
|
+
Project-URL: Bug Tracker, https://github.com/dnzckn/lazylabel/issues
|
30
|
+
Classifier: Programming Language :: Python :: 3
|
31
|
+
Classifier: License :: OSI Approved :: MIT License
|
32
|
+
Classifier: Operating System :: OS Independent
|
33
|
+
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
34
|
+
Classifier: Environment :: X11 Applications :: Qt
|
35
|
+
Requires-Python: >=3.10
|
36
|
+
Description-Content-Type: text/markdown
|
37
|
+
License-File: LICENSE
|
38
|
+
Requires-Dist: PyQt6>=6.9.0
|
39
|
+
Requires-Dist: pyqtdarktheme==2.1.0
|
40
|
+
Requires-Dist: torch>=2.7.1
|
41
|
+
Requires-Dist: torchvision>=0.22.1
|
42
|
+
Requires-Dist: segment-anything==1.0
|
43
|
+
Requires-Dist: numpy>=2.1.2
|
44
|
+
Requires-Dist: opencv-python>=4.11.0.86
|
45
|
+
Requires-Dist: scipy>=1.15.3
|
46
|
+
Requires-Dist: requests>=2.32.4
|
47
|
+
Requires-Dist: tqdm>=4.67.1
|
48
|
+
Provides-Extra: dev
|
49
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
50
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
51
|
+
Requires-Dist: pytest-mock>=3.10.0; extra == "dev"
|
52
|
+
Requires-Dist: pytest-qt>=4.2.0; extra == "dev"
|
53
|
+
Requires-Dist: ruff>=0.8.0; extra == "dev"
|
54
|
+
Dynamic: license-file
|
55
|
+
|
56
|
+
# <img src="https://raw.githubusercontent.com/dnzckn/LazyLabel/main/src/lazylabel/demo_pictures/logo2.png" alt="LazyLabel Logo" style="height:60px; vertical-align:middle;" /> <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;" />
|
57
|
+
|
58
|
+
**AI-Assisted Image Segmentation Made Simple**
|
59
|
+
|
60
|
+
LazyLabel combines Meta's Segment Anything Model (SAM) with intuitive editing tools for fast, precise image labeling. Perfect for machine learning datasets, computer vision research, and annotation workflows.
|
61
|
+
|
62
|
+

|
63
|
+
|
64
|
+
---
|
65
|
+
|
66
|
+
## 🚀 Quick Start
|
67
|
+
|
68
|
+
### Installation
|
69
|
+
```bash
|
70
|
+
pip install lazylabel-gui
|
71
|
+
lazylabel-gui
|
72
|
+
```
|
73
|
+
|
74
|
+
### Usage
|
75
|
+
1. **Open Folder** → Select your image directory
|
76
|
+
2. **Click on image** → AI generates instant masks
|
77
|
+
3. **Fine-tune** → Edit polygons, merge segments, adjust classes
|
78
|
+
4. **Export** → Clean `.npz` files ready for ML training
|
79
|
+
|
80
|
+
---
|
81
|
+
|
82
|
+
## ✨ Key Features
|
83
|
+
|
84
|
+
### **🧠 AI-Powered Segmentation**
|
85
|
+
- **One-click masking** with Meta's SAM model
|
86
|
+
- **Smart prompting** via positive/negative points
|
87
|
+
- **Fragment filtering** to remove small artifacts
|
88
|
+
- **Multiple model support** (VIT-H, VIT-L, VIT-B)
|
89
|
+
|
90
|
+
### **🎨 Advanced Editing**
|
91
|
+
- **Polygon drawing** with full vertex control
|
92
|
+
- **Bounding box** annotation mode
|
93
|
+
- **Shape merging** and class assignment
|
94
|
+
- **Edit mode** for precision adjustments
|
95
|
+
|
96
|
+
### **⚡ Productivity Tools**
|
97
|
+
- **Image adjustments** (brightness, contrast, gamma)
|
98
|
+
- **Customizable hotkeys** for all functions
|
99
|
+
- **Undo/redo** with full history
|
100
|
+
- **Auto-save** and session persistence
|
101
|
+
|
102
|
+
### **📊 ML-Ready Outputs**
|
103
|
+
- **One-hot encoded** `.npz` format
|
104
|
+
- **Clean class separation** with shape `(H, W, Classes)`
|
105
|
+
- **Batch processing** support
|
106
|
+
- **Existing mask loading** for iterative work
|
107
|
+
|
108
|
+
---
|
109
|
+
|
110
|
+
## ⌨️ Essential Controls
|
111
|
+
|
112
|
+
| Mode | Key | Action |
|
113
|
+
|------|-----|--------|
|
114
|
+
| **AI Segmentation** | `1` | Point mode for SAM |
|
115
|
+
| | `Left Click` | Add positive point |
|
116
|
+
| | `Right Click` | Add negative point |
|
117
|
+
| | `Space` | Save segment |
|
118
|
+
| **Manual Drawing** | `2` | Polygon mode |
|
119
|
+
| | `Left Click` | Add vertex |
|
120
|
+
| | `Enter` | Close polygon |
|
121
|
+
| **Editing** | `E` | Selection mode |
|
122
|
+
| | `R` | Edit selected shapes |
|
123
|
+
| | `M` | Merge selected segments |
|
124
|
+
| **Navigation** | `Q` | Pan mode |
|
125
|
+
| | `W/A/S/D` | Pan image |
|
126
|
+
| | `Scroll` | Zoom in/out |
|
127
|
+
|
128
|
+
**💡 All hotkeys are customizable** - Click "Hotkeys" button to personalize shortcuts
|
129
|
+
|
130
|
+
---
|
131
|
+
|
132
|
+
## 📦 Output Format
|
133
|
+
|
134
|
+
LazyLabel exports clean, ML-ready data:
|
135
|
+
|
136
|
+
```python
|
137
|
+
import numpy as np
|
138
|
+
|
139
|
+
# Load your labeled data
|
140
|
+
data = np.load('your_image.npz')
|
141
|
+
mask = data['mask'] # Shape: (height, width, num_classes)
|
142
|
+
|
143
|
+
# Each channel is a binary mask for one class
|
144
|
+
class_0_mask = mask[:, :, 0] # Binary mask for class 0
|
145
|
+
class_1_mask = mask[:, :, 1] # Binary mask for class 1
|
146
|
+
# ... and so on
|
147
|
+
```
|
148
|
+
|
149
|
+
**Perfect for:**
|
150
|
+
- Semantic segmentation training
|
151
|
+
- Instance segmentation datasets
|
152
|
+
- Computer vision research
|
153
|
+
- Automated annotation pipelines
|
154
|
+
|
155
|
+
---
|
156
|
+
|
157
|
+
## 🛠️ Advanced Features
|
158
|
+
|
159
|
+
### **Image Enhancement**
|
160
|
+
- **Brightness/Contrast** adjustment sliders
|
161
|
+
- **Gamma correction** for better visibility
|
162
|
+
- **Live preview** of adjustments
|
163
|
+
- **SAM integration** with adjusted images
|
164
|
+
|
165
|
+
### **Smart Filtering**
|
166
|
+
- **Fragment threshold** removes small segments
|
167
|
+
- **Size-based filtering** (0-100% of largest segment)
|
168
|
+
- **Quality control** for clean annotations
|
169
|
+
|
170
|
+
### **Professional Workflow**
|
171
|
+
- **Class management** with custom aliases
|
172
|
+
- **Segment organization** with sortable tables
|
173
|
+
- **Batch export** for large datasets
|
174
|
+
- **Model switching** without restart
|
175
|
+
|
176
|
+
---
|
177
|
+
|
178
|
+
## 🏗️ Development
|
179
|
+
|
180
|
+
### Installation from Source
|
181
|
+
```bash
|
182
|
+
git clone https://github.com/dnzckn/LazyLabel.git
|
183
|
+
cd LazyLabel
|
184
|
+
pip install -e .
|
185
|
+
lazylabel-gui
|
186
|
+
```
|
187
|
+
|
188
|
+
### Code Quality & Testing
|
189
|
+
```bash
|
190
|
+
# Linting & formatting
|
191
|
+
ruff check . && ruff format .
|
192
|
+
|
193
|
+
# Run tests with coverage
|
194
|
+
python -m pytest --cov=lazylabel --cov-report=html
|
195
|
+
|
196
|
+
# All tests pass with 60%+ coverage
|
197
|
+
```
|
198
|
+
|
199
|
+
### Architecture
|
200
|
+
- **Modular design** with clean separation of concerns
|
201
|
+
- **Signal-based communication** between components
|
202
|
+
- **Extensible model system** for new SAM variants
|
203
|
+
- **Comprehensive test suite** with 95% speed optimization
|
204
|
+
|
205
|
+
---
|
206
|
+
|
207
|
+
## 📋 Requirements
|
208
|
+
|
209
|
+
- **Python 3.10+**
|
210
|
+
- **OpenCV** for image processing
|
211
|
+
- **PyQt6** for GUI
|
212
|
+
- **NumPy** for data handling
|
213
|
+
- **2.5GB** disk space for SAM model (auto-downloaded)
|
214
|
+
|
215
|
+
---
|
216
|
+
|
217
|
+
## 🤝 Contributing
|
218
|
+
|
219
|
+
LazyLabel welcomes contributions! Check out our:
|
220
|
+
- [Architecture Guide](src/lazylabel/ARCHITECTURE.md) for technical details
|
221
|
+
- [Hotkey System](src/lazylabel/HOTKEY_FEATURE.md) for customization
|
222
|
+
- Issues page for feature requests and bug reports
|
223
|
+
|
224
|
+
---
|
225
|
+
|
226
|
+
## 🙏 Acknowledgments
|
227
|
+
|
228
|
+
LazyLabel was inspired by and builds upon the excellent work of:
|
229
|
+
- [LabelMe](https://github.com/wkentaro/labelme) - The pioneering open-source image annotation tool
|
230
|
+
- [Segment-Anything-UI](https://github.com/branislavhesko/segment-anything-ui) - Early SAM integration concepts
|
231
|
+
|
232
|
+
---
|
233
|
+
|
234
|
+
## ☕ Support
|
235
|
+
|
236
|
+
If LazyLabel saves you time on annotation tasks, [consider supporting the project!](https://buymeacoffee.com/dnzckn)
|
237
|
+
|
238
|
+
---
|
239
|
+
|
240
|
+
**Made with ❤️ for the computer vision community**
|
@@ -17,7 +17,7 @@ lazylabel/ui/editable_vertex.py,sha256=nAFC2UuFfbvMbGBbAiLWA77cS5-Hn3a08xe1_QLz2
|
|
17
17
|
lazylabel/ui/hotkey_dialog.py,sha256=U_B76HLOxWdWkfA4d2XgRUaZTJPAAE_m5fmwf7Rh-5Y,14743
|
18
18
|
lazylabel/ui/hoverable_pixelmap_item.py,sha256=kJFOp7WXiyHpNf7l73TZjiob85jgP30b5MZvu_z5L3c,728
|
19
19
|
lazylabel/ui/hoverable_polygon_item.py,sha256=aclUwd0P8H8xbcep6GwhnfaVs1zSkqeZKAL-xeDyMiU,1222
|
20
|
-
lazylabel/ui/main_window.py,sha256=
|
20
|
+
lazylabel/ui/main_window.py,sha256=7i0SQ3gX8RsRcnyrX2F9vaiKMigLU4iWApCQcVKgIqo,83728
|
21
21
|
lazylabel/ui/numeric_table_widget_item.py,sha256=dQUlIFu9syCxTGAHVIlmbgkI7aJ3f3wmDPBz1AGK9Bg,283
|
22
22
|
lazylabel/ui/photo_viewer.py,sha256=f93Mn9ajR2CYakJbbhhHvD5blKrwiGq3ZYgro-k2npc,4217
|
23
23
|
lazylabel/ui/reorderable_class_table.py,sha256=sxHhQre5O_MXLDFgKnw43QnvXXoqn5xRKMGitgO7muI,2371
|
@@ -25,15 +25,15 @@ lazylabel/ui/right_panel.py,sha256=-PeXcu7Lr-xhZniBMvWLDPiFb_RAHYAcILyw8fPJs6I,1
|
|
25
25
|
lazylabel/ui/widgets/__init__.py,sha256=bYjLRTqWdi4hcPfSSXmXuT-0c5Aee7HnnQurv_k5bfY,314
|
26
26
|
lazylabel/ui/widgets/adjustments_widget.py,sha256=CJXtq19hfy12ggCA3_RMwETKNnVAQsn-rT_lIYxpAT4,13458
|
27
27
|
lazylabel/ui/widgets/model_selection_widget.py,sha256=kMPaBMfdfnEVH-Be1d5OxLEuioO0c04FZT1Hr904axM,3497
|
28
|
-
lazylabel/ui/widgets/settings_widget.py,sha256=
|
28
|
+
lazylabel/ui/widgets/settings_widget.py,sha256=ShTaLJeXxwrSuTV4kmtV2JiWjfREil2D1nvPUIfAgDs,4859
|
29
29
|
lazylabel/ui/widgets/status_bar.py,sha256=wTbMQNEOBfmtNj8EVFZS_lxgaemu-CbRXeZzEQDaVz8,4014
|
30
30
|
lazylabel/utils/__init__.py,sha256=V6IR5Gim-39HgM2NyTVT-n8gy3mjilCSFW9y0owN5nc,179
|
31
31
|
lazylabel/utils/custom_file_system_model.py,sha256=-3EimlybvevH6bvqBE0qdFnLADVtayylmkntxPXK0Bk,4869
|
32
32
|
lazylabel/utils/logger.py,sha256=R7z6ifgA-NY-9ZbLlNH0i19zzwXndJ_gkG2J1zpVEhg,1306
|
33
33
|
lazylabel/utils/utils.py,sha256=sYSCoXL27OaLgOZaUkCAhgmKZ7YfhR3Cc5F8nDIa3Ig,414
|
34
|
-
lazylabel_gui-1.1.
|
35
|
-
lazylabel_gui-1.1.
|
36
|
-
lazylabel_gui-1.1.
|
37
|
-
lazylabel_gui-1.1.
|
38
|
-
lazylabel_gui-1.1.
|
39
|
-
lazylabel_gui-1.1.
|
34
|
+
lazylabel_gui-1.1.7.dist-info/licenses/LICENSE,sha256=kSDEIgrWAPd1u2UFGGpC9X71dhzrlzBFs8hbDlENnGE,1092
|
35
|
+
lazylabel_gui-1.1.7.dist-info/METADATA,sha256=9C9ppy_0pAwHmlNKlP5_0i1mkqNLABpskyuRtRjxEwo,8064
|
36
|
+
lazylabel_gui-1.1.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
37
|
+
lazylabel_gui-1.1.7.dist-info/entry_points.txt,sha256=Hd0WwEG9OPTa_ziYjiD0aRh7R6Fupt-wdQ3sspdc1mM,54
|
38
|
+
lazylabel_gui-1.1.7.dist-info/top_level.txt,sha256=YN4uIyrpDBq1wiJaBuZLDipIzyZY0jqJOmmXiPIOUkU,10
|
39
|
+
lazylabel_gui-1.1.7.dist-info/RECORD,,
|
@@ -1,244 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.4
|
2
|
-
Name: lazylabel-gui
|
3
|
-
Version: 1.1.6
|
4
|
-
Summary: An image segmentation GUI for generating ML ready mask tensors and annotations.
|
5
|
-
Author-email: "Deniz N. Cakan" <deniz.n.cakan@gmail.com>
|
6
|
-
License: MIT License
|
7
|
-
|
8
|
-
Copyright (c) 2025 Deniz N. Cakan
|
9
|
-
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
12
|
-
in the Software without restriction, including without limitation the rights
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
15
|
-
furnished to do so, subject to the following conditions:
|
16
|
-
|
17
|
-
The above copyright notice and this permission notice shall be included in all
|
18
|
-
copies or substantial portions of the Software.
|
19
|
-
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
26
|
-
SOFTWARE.
|
27
|
-
|
28
|
-
Project-URL: Homepage, https://github.com/dnzckn/lazylabel
|
29
|
-
Project-URL: Bug Tracker, https://github.com/dnzckn/lazylabel/issues
|
30
|
-
Classifier: Programming Language :: Python :: 3
|
31
|
-
Classifier: License :: OSI Approved :: MIT License
|
32
|
-
Classifier: Operating System :: OS Independent
|
33
|
-
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
34
|
-
Classifier: Environment :: X11 Applications :: Qt
|
35
|
-
Requires-Python: >=3.10
|
36
|
-
Description-Content-Type: text/markdown
|
37
|
-
License-File: LICENSE
|
38
|
-
Requires-Dist: PyQt6>=6.9.0
|
39
|
-
Requires-Dist: pyqtdarktheme==2.1.0
|
40
|
-
Requires-Dist: torch>=2.7.1
|
41
|
-
Requires-Dist: torchvision>=0.22.1
|
42
|
-
Requires-Dist: segment-anything==1.0
|
43
|
-
Requires-Dist: numpy>=2.1.2
|
44
|
-
Requires-Dist: opencv-python>=4.11.0.86
|
45
|
-
Requires-Dist: scipy>=1.15.3
|
46
|
-
Requires-Dist: requests>=2.32.4
|
47
|
-
Requires-Dist: tqdm>=4.67.1
|
48
|
-
Provides-Extra: dev
|
49
|
-
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
50
|
-
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
51
|
-
Requires-Dist: pytest-mock>=3.10.0; extra == "dev"
|
52
|
-
Requires-Dist: pytest-qt>=4.2.0; extra == "dev"
|
53
|
-
Requires-Dist: ruff>=0.8.0; extra == "dev"
|
54
|
-
Dynamic: license-file
|
55
|
-
|
56
|
-
# <img src="https://raw.githubusercontent.com/dnzckn/LazyLabel/main/src/lazylabel/demo_pictures/logo2.png" alt="LazyLabel Logo" style="height:60px; vertical-align:middle;" /> <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;" />
|
57
|
-
|
58
|
-
LazyLabel is an intuitive, AI-assisted image segmentation tool built with a modern, modular architecture. It uses Meta's Segment Anything Model (SAM) for quick, precise mask generation, alongside advanced polygon editing for fine-tuned control. Features comprehensive model management, customizable hotkeys, and outputs in clean, one-hot encoded `.npz` format for easy machine learning integration.
|
59
|
-
|
60
|
-
Inspired by [LabelMe](https://github.com/wkentaro/labelme?tab=readme-ov-file#installation) and [Segment-Anything-UI](https://github.com/branislavhesko/segment-anything-ui/tree/main).
|
61
|
-
|
62
|
-

|
63
|
-
|
64
|
-
---
|
65
|
-
|
66
|
-
## ✨ Core Features
|
67
|
-
|
68
|
-
### **AI-Powered Segmentation**
|
69
|
-
* Generate masks with simple left-click (positive) and right-click (negative) interactions
|
70
|
-
* Multiple SAM model support with easy switching
|
71
|
-
* Custom model loading from any directory
|
72
|
-
|
73
|
-
### **Advanced Editing Tools**
|
74
|
-
* **Vector Polygon Tool**: Full control to draw, edit, and reshape polygons
|
75
|
-
* **Vertex Editing**: Drag vertices or move entire shapes with precision
|
76
|
-
* **Selection & Merging**: Select, merge, and re-order segments intuitively
|
77
|
-
|
78
|
-
### **Professional Workflow**
|
79
|
-
* **Customizable Hotkeys**: Personalize keyboard shortcuts for all functions
|
80
|
-
* **Advanced Class Management**: Assign multiple segments to single class IDs
|
81
|
-
* **Smart I/O**: Load existing `.npz` masks; save as clean, one-hot encoded outputs
|
82
|
-
* **Interactive UI**: Color-coded segments, sortable lists, and hover highlighting
|
83
|
-
|
84
|
-
### **Modern Architecture**
|
85
|
-
* **Modular Design**: Clean, maintainable codebase with separated concerns
|
86
|
-
* **Model Management**: Dedicated model storage and switching system
|
87
|
-
* **Persistent Settings**: User preferences saved between sessions
|
88
|
-
|
89
|
-
---
|
90
|
-
|
91
|
-
## 🚀 Getting Started
|
92
|
-
|
93
|
-
### Prerequisites
|
94
|
-
**Python 3.10+**
|
95
|
-
|
96
|
-
### Installation
|
97
|
-
|
98
|
-
#### For Users [via PyPI](https://pypi.org/project/lazylabel-gui/)
|
99
|
-
1. Install LazyLabel directly:
|
100
|
-
```bash
|
101
|
-
pip install lazylabel-gui
|
102
|
-
```
|
103
|
-
2. Run the application:
|
104
|
-
```bash
|
105
|
-
lazylabel-gui
|
106
|
-
```
|
107
|
-
|
108
|
-
#### For Developers (from Source)
|
109
|
-
1. Clone the repository:
|
110
|
-
```bash
|
111
|
-
git clone https://github.com/dnzckn/LazyLabel.git
|
112
|
-
cd LazyLabel
|
113
|
-
```
|
114
|
-
2. Install in editable mode:
|
115
|
-
```bash
|
116
|
-
pip install -e .
|
117
|
-
```
|
118
|
-
3. Run the application:
|
119
|
-
```bash
|
120
|
-
lazylabel-gui
|
121
|
-
```
|
122
|
-
|
123
|
-
### Model Management
|
124
|
-
* **Default Storage**: Models are stored in `src/lazylabel/models/` directory
|
125
|
-
* **Custom Models**: Click "Browse Models" to select custom model folders
|
126
|
-
* **Model Switching**: Use the dropdown to switch between available models
|
127
|
-
* **Auto-Detection**: Application automatically detects all `.pth` files in selected directories
|
128
|
-
|
129
|
-
**Note**: On the first run, the application will automatically download the SAM model checkpoint (~2.5 GB) from Meta's repository to the models directory. This is a one-time download.
|
130
|
-
|
131
|
-
---
|
132
|
-
|
133
|
-
## ⌨️ Controls & Keybinds
|
134
|
-
|
135
|
-
> **💡 Tip**: All hotkeys are fully customizable! Click the "Hotkeys" button in the control panel to personalize your shortcuts.
|
136
|
-
|
137
|
-
### Modes
|
138
|
-
| Key | Action |
|
139
|
-
|---|---|
|
140
|
-
| `1` | Enter **Point Mode** (for AI segmentation). |
|
141
|
-
| `2` | Enter **Polygon Drawing Mode**. |
|
142
|
-
| `3` | Enter **Bounding Box Mode**. |
|
143
|
-
| `E` | Toggle **Selection Mode** to select existing segments. |
|
144
|
-
| `R` | Enter **Edit Mode** for selected polygons (drag shape or vertices). |
|
145
|
-
| `Q` | Toggle **Pan Mode** (click and drag the image). |
|
146
|
-
|
147
|
-
### Actions
|
148
|
-
| Key(s) | Action |
|
149
|
-
|---|---|
|
150
|
-
| `L-Click` | Add positive point (Point Mode) or polygon vertex. |
|
151
|
-
| `R-Click` | Add negative point (Point Mode). |
|
152
|
-
| `Ctrl + Z` | Undo last action. |
|
153
|
-
| `Ctrl + Y` / `Ctrl + Shift + Z` | Redo last action. |
|
154
|
-
| `Spacebar` | Finalize and save current AI segment. |
|
155
|
-
| `Enter` | **Save final mask for the current image to a `.npz` file.** |
|
156
|
-
| `M` | **Merge** selected segments into a single class. |
|
157
|
-
| `V` / `Delete` / `Backspace`| **Delete** selected segments. |
|
158
|
-
| `C` | Clear temporary points/vertices. |
|
159
|
-
| `W/A/S/D` | Pan image. |
|
160
|
-
| `Scroll Wheel` | Zoom-in or -out. |
|
161
|
-
|
162
|
-
---
|
163
|
-
|
164
|
-
## 📦 Output Format
|
165
|
-
|
166
|
-
LazyLabel saves your work as a compressed NumPy array (`.npz`) with the same name as your image file.
|
167
|
-
|
168
|
-
The file contains a single data key, `'mask'`, holding a **one-hot encoded tensor** with the shape `(H, W, C)`:
|
169
|
-
* `H`: Image height.
|
170
|
-
* `W`: Image width.
|
171
|
-
* `C`: Total unique classes.
|
172
|
-
|
173
|
-
Each channel is a binary mask for a class, combining all assigned segments into a clean, ML-ready output.
|
174
|
-
|
175
|
-
---
|
176
|
-
|
177
|
-
## 🏗️ Architecture
|
178
|
-
|
179
|
-
LazyLabel features a modern, modular architecture designed for maintainability and extensibility:
|
180
|
-
|
181
|
-
* **Modular Design**: Clean separation between UI, business logic, and configuration
|
182
|
-
* **Signal-Based Communication**: Loose coupling between components using PyQt signals
|
183
|
-
* **Persistent Configuration**: User settings and preferences saved between sessions
|
184
|
-
* **Extensible Model System**: Easy integration of new SAM models and types
|
185
|
-
|
186
|
-
For detailed technical documentation, see [ARCHITECTURE.md](src/lazylabel/ARCHITECTURE.md).
|
187
|
-
|
188
|
-
---
|
189
|
-
|
190
|
-
## ⌨️ Hotkey Customization
|
191
|
-
|
192
|
-
LazyLabel includes a comprehensive hotkey management system:
|
193
|
-
|
194
|
-
* **Full Customization**: Personalize keyboard shortcuts for all 27+ functions
|
195
|
-
* **Category Organization**: Hotkeys organized by function (Modes, Actions, Navigation, etc.)
|
196
|
-
* **Primary & Secondary Keys**: Set multiple shortcuts for the same action
|
197
|
-
* **Persistent Settings**: Custom hotkeys saved between sessions
|
198
|
-
* **Conflict Prevention**: System prevents duplicate key assignments
|
199
|
-
|
200
|
-
For complete hotkey documentation, see [HOTKEY_FEATURE.md](src/lazylabel/HOTKEY_FEATURE.md).
|
201
|
-
|
202
|
-
## Development
|
203
|
-
|
204
|
-
### Code Quality
|
205
|
-
This project uses Ruff for linting and formatting:
|
206
|
-
|
207
|
-
```bash
|
208
|
-
# Activate virtual environment first
|
209
|
-
& e:\venv\lazylabel\Scripts\Activate.ps1
|
210
|
-
|
211
|
-
# Run linter
|
212
|
-
ruff check .
|
213
|
-
|
214
|
-
# Fix auto-fixable issues
|
215
|
-
ruff check --fix .
|
216
|
-
|
217
|
-
# Format code
|
218
|
-
ruff format .
|
219
|
-
|
220
|
-
# Check if code is properly formatted
|
221
|
-
ruff format --check .
|
222
|
-
```
|
223
|
-
|
224
|
-
### Testing
|
225
|
-
|
226
|
-
Run tests using pytest:
|
227
|
-
|
228
|
-
```bash
|
229
|
-
# Run all tests
|
230
|
-
python -m pytest
|
231
|
-
|
232
|
-
# Run tests with coverage
|
233
|
-
python -m pytest --cov=lazylabel --cov-report=html --cov-report=term-missing
|
234
|
-
|
235
|
-
# Run specific test file
|
236
|
-
python -m pytest tests/unit/ui/test_undo_redo.py -v
|
237
|
-
```
|
238
|
-
|
239
|
-
The HTML coverage report will be generated in `htmlcov/` directory.
|
240
|
-
|
241
|
-
---
|
242
|
-
|
243
|
-
## ☕ Support LazyLabel
|
244
|
-
[If you found LazyLabel helpful, consider supporting the project!](https://buymeacoffee.com/dnzckn)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|