lazylabel-gui 1.1.4__tar.gz → 1.1.6__tar.gz

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.
Files changed (47) hide show
  1. {lazylabel_gui-1.1.4/src/lazylabel_gui.egg-info → lazylabel_gui-1.1.6}/PKG-INFO +2 -1
  2. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/README.md +189 -188
  3. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/pyproject.toml +1 -1
  4. lazylabel_gui-1.1.6/src/lazylabel/__main__.py +6 -0
  5. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel/config/settings.py +72 -65
  6. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel/core/file_manager.py +123 -122
  7. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel/core/model_manager.py +96 -95
  8. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel/core/segment_manager.py +188 -183
  9. lazylabel_gui-1.1.6/src/lazylabel/main.py +39 -0
  10. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel/models/sam_model.py +211 -200
  11. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel/ui/control_panel.py +283 -245
  12. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel/ui/editable_vertex.py +2 -2
  13. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel/ui/hotkey_dialog.py +417 -416
  14. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel/ui/main_window.py +2020 -1860
  15. lazylabel_gui-1.1.6/src/lazylabel/ui/photo_viewer.py +105 -0
  16. lazylabel_gui-1.1.6/src/lazylabel/ui/widgets/adjustments_widget.py +372 -0
  17. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel/ui/widgets/settings_widget.py +125 -113
  18. lazylabel_gui-1.1.6/src/lazylabel/utils/logger.py +45 -0
  19. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6/src/lazylabel_gui.egg-info}/PKG-INFO +2 -1
  20. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel_gui.egg-info/SOURCES.txt +2 -0
  21. lazylabel_gui-1.1.4/src/lazylabel/main.py +0 -37
  22. lazylabel_gui-1.1.4/src/lazylabel/ui/photo_viewer.py +0 -51
  23. lazylabel_gui-1.1.4/src/lazylabel/ui/widgets/adjustments_widget.py +0 -108
  24. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/LICENSE +0 -0
  25. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/setup.cfg +0 -0
  26. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel/__init__.py +0 -0
  27. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel/config/__init__.py +0 -0
  28. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel/config/hotkeys.py +0 -0
  29. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel/config/paths.py +0 -0
  30. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel/core/__init__.py +0 -0
  31. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel/models/__init__.py +0 -0
  32. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel/ui/__init__.py +0 -0
  33. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel/ui/hoverable_pixelmap_item.py +0 -0
  34. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel/ui/hoverable_polygon_item.py +0 -0
  35. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel/ui/numeric_table_widget_item.py +0 -0
  36. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel/ui/reorderable_class_table.py +0 -0
  37. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel/ui/right_panel.py +0 -0
  38. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel/ui/widgets/__init__.py +0 -0
  39. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel/ui/widgets/model_selection_widget.py +0 -0
  40. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel/ui/widgets/status_bar.py +0 -0
  41. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel/utils/__init__.py +0 -0
  42. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel/utils/custom_file_system_model.py +0 -0
  43. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel/utils/utils.py +0 -0
  44. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel_gui.egg-info/dependency_links.txt +0 -0
  45. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel_gui.egg-info/entry_points.txt +0 -0
  46. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel_gui.egg-info/requires.txt +0 -0
  47. {lazylabel_gui-1.1.4 → lazylabel_gui-1.1.6}/src/lazylabel_gui.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lazylabel-gui
3
- Version: 1.1.4
3
+ Version: 1.1.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
@@ -139,6 +139,7 @@ Inspired by [LabelMe](https://github.com/wkentaro/labelme?tab=readme-ov-file#ins
139
139
  |---|---|
140
140
  | `1` | Enter **Point Mode** (for AI segmentation). |
141
141
  | `2` | Enter **Polygon Drawing Mode**. |
142
+ | `3` | Enter **Bounding Box Mode**. |
142
143
  | `E` | Toggle **Selection Mode** to select existing segments. |
143
144
  | `R` | Enter **Edit Mode** for selected polygons (drag shape or vertices). |
144
145
  | `Q` | Toggle **Pan Mode** (click and drag the image). |
@@ -1,188 +1,189 @@
1
- # <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;" />
2
-
3
- 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.
4
-
5
- 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).
6
-
7
- ![LazyLabel Screenshot](https://raw.githubusercontent.com/dnzckn/LazyLabel/main/src/lazylabel/demo_pictures/gui.PNG)
8
-
9
- ---
10
-
11
- ## ✨ Core Features
12
-
13
- ### **AI-Powered Segmentation**
14
- * Generate masks with simple left-click (positive) and right-click (negative) interactions
15
- * Multiple SAM model support with easy switching
16
- * Custom model loading from any directory
17
-
18
- ### **Advanced Editing Tools**
19
- * **Vector Polygon Tool**: Full control to draw, edit, and reshape polygons
20
- * **Vertex Editing**: Drag vertices or move entire shapes with precision
21
- * **Selection & Merging**: Select, merge, and re-order segments intuitively
22
-
23
- ### **Professional Workflow**
24
- * **Customizable Hotkeys**: Personalize keyboard shortcuts for all functions
25
- * **Advanced Class Management**: Assign multiple segments to single class IDs
26
- * **Smart I/O**: Load existing `.npz` masks; save as clean, one-hot encoded outputs
27
- * **Interactive UI**: Color-coded segments, sortable lists, and hover highlighting
28
-
29
- ### **Modern Architecture**
30
- * **Modular Design**: Clean, maintainable codebase with separated concerns
31
- * **Model Management**: Dedicated model storage and switching system
32
- * **Persistent Settings**: User preferences saved between sessions
33
-
34
- ---
35
-
36
- ## 🚀 Getting Started
37
-
38
- ### Prerequisites
39
- **Python 3.10+**
40
-
41
- ### Installation
42
-
43
- #### For Users [via PyPI](https://pypi.org/project/lazylabel-gui/)
44
- 1. Install LazyLabel directly:
45
- ```bash
46
- pip install lazylabel-gui
47
- ```
48
- 2. Run the application:
49
- ```bash
50
- lazylabel-gui
51
- ```
52
-
53
- #### For Developers (from Source)
54
- 1. Clone the repository:
55
- ```bash
56
- git clone https://github.com/dnzckn/LazyLabel.git
57
- cd LazyLabel
58
- ```
59
- 2. Install in editable mode:
60
- ```bash
61
- pip install -e .
62
- ```
63
- 3. Run the application:
64
- ```bash
65
- lazylabel-gui
66
- ```
67
-
68
- ### Model Management
69
- * **Default Storage**: Models are stored in `src/lazylabel/models/` directory
70
- * **Custom Models**: Click "Browse Models" to select custom model folders
71
- * **Model Switching**: Use the dropdown to switch between available models
72
- * **Auto-Detection**: Application automatically detects all `.pth` files in selected directories
73
-
74
- **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.
75
-
76
- ---
77
-
78
- ## ⌨️ Controls & Keybinds
79
-
80
- > **💡 Tip**: All hotkeys are fully customizable! Click the "Hotkeys" button in the control panel to personalize your shortcuts.
81
-
82
- ### Modes
83
- | Key | Action |
84
- |---|---|
85
- | `1` | Enter **Point Mode** (for AI segmentation). |
86
- | `2` | Enter **Polygon Drawing Mode**. |
87
- | `E` | Toggle **Selection Mode** to select existing segments. |
88
- | `R` | Enter **Edit Mode** for selected polygons (drag shape or vertices). |
89
- | `Q` | Toggle **Pan Mode** (click and drag the image). |
90
-
91
- ### Actions
92
- | Key(s) | Action |
93
- |---|---|
94
- | `L-Click` | Add positive point (Point Mode) or polygon vertex. |
95
- | `R-Click` | Add negative point (Point Mode). |
96
- | `Ctrl + Z` | Undo last action. |
97
- | `Ctrl + Y` / `Ctrl + Shift + Z` | Redo last action. |
98
- | `Spacebar` | Finalize and save current AI segment. |
99
- | `Enter` | **Save final mask for the current image to a `.npz` file.** |
100
- | `M` | **Merge** selected segments into a single class. |
101
- | `V` / `Delete` / `Backspace`| **Delete** selected segments. |
102
- | `C` | Clear temporary points/vertices. |
103
- | `W/A/S/D` | Pan image. |
104
- | `Scroll Wheel` | Zoom-in or -out. |
105
-
106
- ---
107
-
108
- ## 📦 Output Format
109
-
110
- LazyLabel saves your work as a compressed NumPy array (`.npz`) with the same name as your image file.
111
-
112
- The file contains a single data key, `'mask'`, holding a **one-hot encoded tensor** with the shape `(H, W, C)`:
113
- * `H`: Image height.
114
- * `W`: Image width.
115
- * `C`: Total unique classes.
116
-
117
- Each channel is a binary mask for a class, combining all assigned segments into a clean, ML-ready output.
118
-
119
- ---
120
-
121
- ## 🏗️ Architecture
122
-
123
- LazyLabel features a modern, modular architecture designed for maintainability and extensibility:
124
-
125
- * **Modular Design**: Clean separation between UI, business logic, and configuration
126
- * **Signal-Based Communication**: Loose coupling between components using PyQt signals
127
- * **Persistent Configuration**: User settings and preferences saved between sessions
128
- * **Extensible Model System**: Easy integration of new SAM models and types
129
-
130
- For detailed technical documentation, see [ARCHITECTURE.md](src/lazylabel/ARCHITECTURE.md).
131
-
132
- ---
133
-
134
- ## ⌨️ Hotkey Customization
135
-
136
- LazyLabel includes a comprehensive hotkey management system:
137
-
138
- * **Full Customization**: Personalize keyboard shortcuts for all 27+ functions
139
- * **Category Organization**: Hotkeys organized by function (Modes, Actions, Navigation, etc.)
140
- * **Primary & Secondary Keys**: Set multiple shortcuts for the same action
141
- * **Persistent Settings**: Custom hotkeys saved between sessions
142
- * **Conflict Prevention**: System prevents duplicate key assignments
143
-
144
- For complete hotkey documentation, see [HOTKEY_FEATURE.md](src/lazylabel/HOTKEY_FEATURE.md).
145
-
146
- ## Development
147
-
148
- ### Code Quality
149
- This project uses Ruff for linting and formatting:
150
-
151
- ```bash
152
- # Activate virtual environment first
153
- & e:\venv\lazylabel\Scripts\Activate.ps1
154
-
155
- # Run linter
156
- ruff check .
157
-
158
- # Fix auto-fixable issues
159
- ruff check --fix .
160
-
161
- # Format code
162
- ruff format .
163
-
164
- # Check if code is properly formatted
165
- ruff format --check .
166
- ```
167
-
168
- ### Testing
169
-
170
- Run tests using pytest:
171
-
172
- ```bash
173
- # Run all tests
174
- python -m pytest
175
-
176
- # Run tests with coverage
177
- python -m pytest --cov=lazylabel --cov-report=html --cov-report=term-missing
178
-
179
- # Run specific test file
180
- python -m pytest tests/unit/ui/test_undo_redo.py -v
181
- ```
182
-
183
- The HTML coverage report will be generated in `htmlcov/` directory.
184
-
185
- ---
186
-
187
- ## ☕ Support LazyLabel
188
- [If you found LazyLabel helpful, consider supporting the project!](https://buymeacoffee.com/dnzckn)
1
+ # <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;" />
2
+
3
+ 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.
4
+
5
+ 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).
6
+
7
+ ![LazyLabel Screenshot](https://raw.githubusercontent.com/dnzckn/LazyLabel/main/src/lazylabel/demo_pictures/gui.PNG)
8
+
9
+ ---
10
+
11
+ ## ✨ Core Features
12
+
13
+ ### **AI-Powered Segmentation**
14
+ * Generate masks with simple left-click (positive) and right-click (negative) interactions
15
+ * Multiple SAM model support with easy switching
16
+ * Custom model loading from any directory
17
+
18
+ ### **Advanced Editing Tools**
19
+ * **Vector Polygon Tool**: Full control to draw, edit, and reshape polygons
20
+ * **Vertex Editing**: Drag vertices or move entire shapes with precision
21
+ * **Selection & Merging**: Select, merge, and re-order segments intuitively
22
+
23
+ ### **Professional Workflow**
24
+ * **Customizable Hotkeys**: Personalize keyboard shortcuts for all functions
25
+ * **Advanced Class Management**: Assign multiple segments to single class IDs
26
+ * **Smart I/O**: Load existing `.npz` masks; save as clean, one-hot encoded outputs
27
+ * **Interactive UI**: Color-coded segments, sortable lists, and hover highlighting
28
+
29
+ ### **Modern Architecture**
30
+ * **Modular Design**: Clean, maintainable codebase with separated concerns
31
+ * **Model Management**: Dedicated model storage and switching system
32
+ * **Persistent Settings**: User preferences saved between sessions
33
+
34
+ ---
35
+
36
+ ## 🚀 Getting Started
37
+
38
+ ### Prerequisites
39
+ **Python 3.10+**
40
+
41
+ ### Installation
42
+
43
+ #### For Users [via PyPI](https://pypi.org/project/lazylabel-gui/)
44
+ 1. Install LazyLabel directly:
45
+ ```bash
46
+ pip install lazylabel-gui
47
+ ```
48
+ 2. Run the application:
49
+ ```bash
50
+ lazylabel-gui
51
+ ```
52
+
53
+ #### For Developers (from Source)
54
+ 1. Clone the repository:
55
+ ```bash
56
+ git clone https://github.com/dnzckn/LazyLabel.git
57
+ cd LazyLabel
58
+ ```
59
+ 2. Install in editable mode:
60
+ ```bash
61
+ pip install -e .
62
+ ```
63
+ 3. Run the application:
64
+ ```bash
65
+ lazylabel-gui
66
+ ```
67
+
68
+ ### Model Management
69
+ * **Default Storage**: Models are stored in `src/lazylabel/models/` directory
70
+ * **Custom Models**: Click "Browse Models" to select custom model folders
71
+ * **Model Switching**: Use the dropdown to switch between available models
72
+ * **Auto-Detection**: Application automatically detects all `.pth` files in selected directories
73
+
74
+ **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.
75
+
76
+ ---
77
+
78
+ ## ⌨️ Controls & Keybinds
79
+
80
+ > **💡 Tip**: All hotkeys are fully customizable! Click the "Hotkeys" button in the control panel to personalize your shortcuts.
81
+
82
+ ### Modes
83
+ | Key | Action |
84
+ |---|---|
85
+ | `1` | Enter **Point Mode** (for AI segmentation). |
86
+ | `2` | Enter **Polygon Drawing Mode**. |
87
+ | `3` | Enter **Bounding Box Mode**. |
88
+ | `E` | Toggle **Selection Mode** to select existing segments. |
89
+ | `R` | Enter **Edit Mode** for selected polygons (drag shape or vertices). |
90
+ | `Q` | Toggle **Pan Mode** (click and drag the image). |
91
+
92
+ ### Actions
93
+ | Key(s) | Action |
94
+ |---|---|
95
+ | `L-Click` | Add positive point (Point Mode) or polygon vertex. |
96
+ | `R-Click` | Add negative point (Point Mode). |
97
+ | `Ctrl + Z` | Undo last action. |
98
+ | `Ctrl + Y` / `Ctrl + Shift + Z` | Redo last action. |
99
+ | `Spacebar` | Finalize and save current AI segment. |
100
+ | `Enter` | **Save final mask for the current image to a `.npz` file.** |
101
+ | `M` | **Merge** selected segments into a single class. |
102
+ | `V` / `Delete` / `Backspace`| **Delete** selected segments. |
103
+ | `C` | Clear temporary points/vertices. |
104
+ | `W/A/S/D` | Pan image. |
105
+ | `Scroll Wheel` | Zoom-in or -out. |
106
+
107
+ ---
108
+
109
+ ## 📦 Output Format
110
+
111
+ LazyLabel saves your work as a compressed NumPy array (`.npz`) with the same name as your image file.
112
+
113
+ The file contains a single data key, `'mask'`, holding a **one-hot encoded tensor** with the shape `(H, W, C)`:
114
+ * `H`: Image height.
115
+ * `W`: Image width.
116
+ * `C`: Total unique classes.
117
+
118
+ Each channel is a binary mask for a class, combining all assigned segments into a clean, ML-ready output.
119
+
120
+ ---
121
+
122
+ ## 🏗️ Architecture
123
+
124
+ LazyLabel features a modern, modular architecture designed for maintainability and extensibility:
125
+
126
+ * **Modular Design**: Clean separation between UI, business logic, and configuration
127
+ * **Signal-Based Communication**: Loose coupling between components using PyQt signals
128
+ * **Persistent Configuration**: User settings and preferences saved between sessions
129
+ * **Extensible Model System**: Easy integration of new SAM models and types
130
+
131
+ For detailed technical documentation, see [ARCHITECTURE.md](src/lazylabel/ARCHITECTURE.md).
132
+
133
+ ---
134
+
135
+ ## ⌨️ Hotkey Customization
136
+
137
+ LazyLabel includes a comprehensive hotkey management system:
138
+
139
+ * **Full Customization**: Personalize keyboard shortcuts for all 27+ functions
140
+ * **Category Organization**: Hotkeys organized by function (Modes, Actions, Navigation, etc.)
141
+ * **Primary & Secondary Keys**: Set multiple shortcuts for the same action
142
+ * **Persistent Settings**: Custom hotkeys saved between sessions
143
+ * **Conflict Prevention**: System prevents duplicate key assignments
144
+
145
+ For complete hotkey documentation, see [HOTKEY_FEATURE.md](src/lazylabel/HOTKEY_FEATURE.md).
146
+
147
+ ## Development
148
+
149
+ ### Code Quality
150
+ This project uses Ruff for linting and formatting:
151
+
152
+ ```bash
153
+ # Activate virtual environment first
154
+ & e:\venv\lazylabel\Scripts\Activate.ps1
155
+
156
+ # Run linter
157
+ ruff check .
158
+
159
+ # Fix auto-fixable issues
160
+ ruff check --fix .
161
+
162
+ # Format code
163
+ ruff format .
164
+
165
+ # Check if code is properly formatted
166
+ ruff format --check .
167
+ ```
168
+
169
+ ### Testing
170
+
171
+ Run tests using pytest:
172
+
173
+ ```bash
174
+ # Run all tests
175
+ python -m pytest
176
+
177
+ # Run tests with coverage
178
+ python -m pytest --cov=lazylabel --cov-report=html --cov-report=term-missing
179
+
180
+ # Run specific test file
181
+ python -m pytest tests/unit/ui/test_undo_redo.py -v
182
+ ```
183
+
184
+ The HTML coverage report will be generated in `htmlcov/` directory.
185
+
186
+ ---
187
+
188
+ ## Support LazyLabel
189
+ [If you found LazyLabel helpful, consider supporting the project!](https://buymeacoffee.com/dnzckn)
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "lazylabel-gui"
7
- version = "1.1.4"
7
+ version = "1.1.6"
8
8
  authors = [
9
9
  { name="Deniz N. Cakan", email="deniz.n.cakan@gmail.com" },
10
10
  ]
@@ -0,0 +1,6 @@
1
+ """Allow LazyLabel to be run as a module with python -m lazylabel."""
2
+
3
+ from .main import main
4
+
5
+ if __name__ == "__main__":
6
+ main()
@@ -1,65 +1,72 @@
1
- """Application settings and configuration."""
2
-
3
- import json
4
- import os
5
- from dataclasses import asdict, dataclass
6
-
7
-
8
- @dataclass
9
- class Settings:
10
- """Application settings with defaults."""
11
-
12
- # UI Settings
13
- window_width: int = 1600
14
- window_height: int = 900
15
- left_panel_width: int = 250
16
- right_panel_width: int = 350
17
-
18
- # Annotation Settings
19
- point_radius: float = 0.3
20
- line_thickness: float = 0.5
21
- pan_multiplier: float = 1.0
22
- polygon_join_threshold: int = 2
23
-
24
- # Model Settings
25
- default_model_type: str = "vit_h"
26
- default_model_filename: str = "sam_vit_h_4b8939.pth"
27
-
28
- # Save Settings
29
- auto_save: bool = True
30
- save_npz: bool = True
31
- save_txt: bool = True
32
- save_class_aliases: bool = False
33
- yolo_use_alias: bool = True
34
-
35
- # UI State
36
- annotation_size_multiplier: float = 1.0
37
-
38
- def save_to_file(self, filepath: str) -> None:
39
- """Save settings to JSON file."""
40
- os.makedirs(os.path.dirname(filepath), exist_ok=True)
41
- with open(filepath, "w") as f:
42
- json.dump(asdict(self), f, indent=4)
43
-
44
- @classmethod
45
- def load_from_file(cls, filepath: str) -> "Settings":
46
- """Load settings from JSON file."""
47
- if not os.path.exists(filepath):
48
- return cls()
49
-
50
- try:
51
- with open(filepath) as f:
52
- data = json.load(f)
53
- return cls(**data)
54
- except (json.JSONDecodeError, TypeError):
55
- return cls()
56
-
57
- def update(self, **kwargs) -> None:
58
- """Update settings with new values."""
59
- for key, value in kwargs.items():
60
- if hasattr(self, key):
61
- setattr(self, key, value)
62
-
63
-
64
- # Default settings instance
65
- DEFAULT_SETTINGS = Settings()
1
+ """Application settings and configuration."""
2
+
3
+ import json
4
+ import os
5
+ from dataclasses import asdict, dataclass
6
+
7
+
8
+ @dataclass
9
+ class Settings:
10
+ """Application settings with defaults."""
11
+
12
+ # UI Settings
13
+ window_width: int = 1600
14
+ window_height: int = 900
15
+ left_panel_width: int = 250
16
+ right_panel_width: int = 350
17
+
18
+ # Annotation Settings
19
+ point_radius: float = 0.3
20
+ line_thickness: float = 0.5
21
+ pan_multiplier: float = 1.0
22
+ polygon_join_threshold: int = 2
23
+ fragment_threshold: int = 0
24
+
25
+ # Image Adjustment Settings
26
+ brightness: float = 0.0
27
+ contrast: float = 0.0
28
+ gamma: float = 1.0
29
+
30
+ # Model Settings
31
+ default_model_type: str = "vit_h"
32
+ default_model_filename: str = "sam_vit_h_4b8939.pth"
33
+ operate_on_view: bool = False
34
+
35
+ # Save Settings
36
+ auto_save: bool = True
37
+ save_npz: bool = True
38
+ save_txt: bool = True
39
+ save_class_aliases: bool = False
40
+ yolo_use_alias: bool = True
41
+
42
+ # UI State
43
+ annotation_size_multiplier: float = 1.0
44
+
45
+ def save_to_file(self, filepath: str) -> None:
46
+ """Save settings to JSON file."""
47
+ os.makedirs(os.path.dirname(filepath), exist_ok=True)
48
+ with open(filepath, "w") as f:
49
+ json.dump(asdict(self), f, indent=4)
50
+
51
+ @classmethod
52
+ def load_from_file(cls, filepath: str) -> "Settings":
53
+ """Load settings from JSON file."""
54
+ if not os.path.exists(filepath):
55
+ return cls()
56
+
57
+ try:
58
+ with open(filepath) as f:
59
+ data = json.load(f)
60
+ return cls(**data)
61
+ except (json.JSONDecodeError, TypeError):
62
+ return cls()
63
+
64
+ def update(self, **kwargs) -> None:
65
+ """Update settings with new values."""
66
+ for key, value in kwargs.items():
67
+ if hasattr(self, key):
68
+ setattr(self, key, value)
69
+
70
+
71
+ # Default settings instance
72
+ DEFAULT_SETTINGS = Settings()