dataflow-cv 0.6.2__tar.gz → 1.0.1__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.
- {dataflow_cv-0.6.2/dataflow_cv.egg-info → dataflow_cv-1.0.1}/PKG-INFO +79 -33
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/README.md +78 -32
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow/__init__.py +1 -1
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow/cli/__init__.py +1 -1
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow/cli/commands/convert.py +83 -72
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow/cli/commands/utils.py +9 -4
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow/cli/commands/visualize.py +36 -30
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow/convert/__init__.py +13 -12
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow/convert/base.py +0 -12
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow/convert/coco_and_labelme.py +97 -24
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow/convert/labelme_and_yolo.py +167 -35
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow/convert/rle_converter.py +8 -16
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow/convert/utils.py +2 -2
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow/convert/yolo_and_coco.py +165 -36
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow/label/__init__.py +12 -17
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow/label/base.py +107 -10
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow/label/coco_handler.py +185 -301
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow/label/labelme_handler.py +102 -144
- dataflow_cv-1.0.1/dataflow/label/models.py +168 -0
- dataflow_cv-1.0.1/dataflow/label/utils.py +89 -0
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow/label/yolo_handler.py +31 -70
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow/util/file_util.py +2 -1
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow/visualize/__init__.py +11 -9
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow/visualize/base.py +208 -264
- dataflow_cv-1.0.1/dataflow/visualize/coco_visualizer.py +96 -0
- dataflow_cv-1.0.1/dataflow/visualize/labelme_visualizer.py +92 -0
- dataflow_cv-1.0.1/dataflow/visualize/yolo_visualizer.py +102 -0
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1/dataflow_cv.egg-info}/PKG-INFO +79 -33
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow_cv.egg-info/SOURCES.txt +0 -1
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/pyproject.toml +52 -2
- dataflow_cv-0.6.2/dataflow/cli/models.py +0 -42
- dataflow_cv-0.6.2/dataflow/label/models.py +0 -306
- dataflow_cv-0.6.2/dataflow/label/utils.py +0 -363
- dataflow_cv-0.6.2/dataflow/visualize/coco_visualizer.py +0 -53
- dataflow_cv-0.6.2/dataflow/visualize/labelme_visualizer.py +0 -50
- dataflow_cv-0.6.2/dataflow/visualize/yolo_visualizer.py +0 -57
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/LICENSE +0 -0
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow/cli/commands/__init__.py +0 -0
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow/cli/exceptions.py +0 -0
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow/cli/main.py +0 -0
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow/util/__init__.py +0 -0
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow/util/logging_util.py +0 -0
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow/visualize/utils.py +0 -0
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow_cv.egg-info/dependency_links.txt +0 -0
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow_cv.egg-info/entry_points.txt +0 -0
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow_cv.egg-info/not-zip-safe +0 -0
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow_cv.egg-info/requires.txt +0 -0
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/dataflow_cv.egg-info/top_level.txt +0 -0
- {dataflow_cv-0.6.2 → dataflow_cv-1.0.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dataflow-cv
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.1
|
|
4
4
|
Summary: A computer vision dataset processing library
|
|
5
5
|
Author-email: DataFlow-CV Team <example@example.com>
|
|
6
6
|
License: MIT
|
|
@@ -49,17 +49,19 @@ Dynamic: license-file
|
|
|
49
49
|
[](https://www.python.org/downloads/)  [](https://pypi.org/project/dataflow-cv/)  [](https://github.com/zjykzj/DataFlow-CV/actions/workflows/python-publish.yml)
|
|
50
50
|
  
|
|
51
51
|
|
|
52
|
-
A computer vision dataset processing library for seamless format conversion and visualization between
|
|
52
|
+
A computer vision dataset processing library for seamless format conversion and visualization between YOLO, LabelMe, and COCO annotation formats. Designed for researchers and developers working with multi-format annotation pipelines.
|
|
53
53
|
|
|
54
54
|
## Features
|
|
55
55
|
|
|
56
|
-
- **Bidirectional Conversion**: Convert between
|
|
56
|
+
- **Bidirectional Conversion**: Convert between YOLO, LabelMe, and COCO formats in any direction
|
|
57
57
|
- **Multi-format Support**: Handle object detection bounding boxes and instance segmentation polygons
|
|
58
|
-
- **
|
|
58
|
+
- **Native Coordinate Storage**: Coordinates stored in format-native representation (YOLO normalized, LabelMe/COCO absolute pixels)
|
|
59
59
|
- **Visualization**: Visualize annotations with OpenCV, supporting both display and save modes
|
|
60
60
|
- **Command-line Interface**: User-friendly CLI with `convert` and `visualize` subcommands
|
|
61
61
|
- **Python API**: Programmatic access for integration into larger pipelines
|
|
62
62
|
- **Verbose Logging**: Detailed logging with file output for debugging
|
|
63
|
+
- **Headless Mode**: Run visualization in server/Docker environments with `--no-display`
|
|
64
|
+
- **Flexible Error Handling**: Choose between strict (abort on error) or lenient (skip and continue) modes
|
|
63
65
|
- **Cross-platform**: Full support for Windows, Linux, and macOS
|
|
64
66
|
|
|
65
67
|
## Table of Contents
|
|
@@ -131,12 +133,6 @@ dataflow-cv convert yolo2coco images/ yolo_labels/ classes.txt coco_annotations.
|
|
|
131
133
|
# YOLO to LabelMe
|
|
132
134
|
dataflow-cv convert yolo2labelme images/ yolo_labels/ classes.txt labelme_json/
|
|
133
135
|
|
|
134
|
-
# COCO to YOLO
|
|
135
|
-
dataflow-cv convert coco2yolo coco_annotations.json yolo_labels/
|
|
136
|
-
|
|
137
|
-
# COCO to LabelMe
|
|
138
|
-
dataflow-cv convert coco2labelme coco_annotations.json labelme_json/
|
|
139
|
-
|
|
140
136
|
# LabelMe to YOLO
|
|
141
137
|
dataflow-cv convert labelme2yolo labelme_json/ classes.txt yolo_labels/
|
|
142
138
|
|
|
@@ -146,8 +142,17 @@ dataflow-cv convert labelme2coco labelme_json/ classes.txt coco_annotations.json
|
|
|
146
142
|
# With RLE encoding
|
|
147
143
|
dataflow-cv convert labelme2coco labelme_json/ classes.txt coco_annotations.json --do-rle
|
|
148
144
|
|
|
145
|
+
# COCO to YOLO
|
|
146
|
+
dataflow-cv convert coco2yolo coco_annotations.json yolo_labels/
|
|
147
|
+
|
|
148
|
+
# COCO to LabelMe
|
|
149
|
+
dataflow-cv convert coco2labelme coco_annotations.json labelme_json/
|
|
150
|
+
|
|
149
151
|
# Enable verbose logging
|
|
150
152
|
dataflow-cv convert yolo2coco images/ yolo_labels/ classes.txt coco_annotations.json --verbose
|
|
153
|
+
|
|
154
|
+
# Disable strict mode (skip invalid annotations instead of aborting)
|
|
155
|
+
dataflow-cv convert yolo2coco --no-strict images/ yolo_labels/ classes.txt coco_annotations.json
|
|
151
156
|
```
|
|
152
157
|
|
|
153
158
|
#### Visualization
|
|
@@ -155,14 +160,17 @@ dataflow-cv convert yolo2coco images/ yolo_labels/ classes.txt coco_annotations.
|
|
|
155
160
|
# Visualize YOLO annotations
|
|
156
161
|
dataflow-cv visualize yolo images/ yolo_labels/ classes.txt --save visualized/
|
|
157
162
|
|
|
158
|
-
# Visualize COCO annotations
|
|
159
|
-
dataflow-cv visualize coco images/ coco_annotations.json --save visualized/
|
|
160
|
-
|
|
161
163
|
# Visualize LabelMe annotations
|
|
162
164
|
dataflow-cv visualize labelme images/ labelme_json/ --save visualized/
|
|
163
165
|
|
|
166
|
+
# Visualize COCO annotations
|
|
167
|
+
dataflow-cv visualize coco images/ coco_annotations.json --save visualized/
|
|
168
|
+
|
|
164
169
|
# Enable verbose logging for detailed debug output
|
|
165
170
|
dataflow-cv visualize yolo --verbose images/ yolo_labels/ classes.txt --save visualized/
|
|
171
|
+
|
|
172
|
+
# Run on headless server (no display window)
|
|
173
|
+
dataflow-cv visualize yolo --no-display images/ yolo_labels/ classes.txt --save visualized/
|
|
166
174
|
```
|
|
167
175
|
|
|
168
176
|
### Python API
|
|
@@ -203,37 +211,53 @@ See the `samples/` directory for complete examples:
|
|
|
203
211
|
|
|
204
212
|
## Documentation
|
|
205
213
|
|
|
206
|
-
- **[CLAUDE.md](CLAUDE.md)**: Detailed architecture and
|
|
207
|
-
-
|
|
208
|
-
-
|
|
209
|
-
- **`
|
|
214
|
+
- **[CLAUDE.md](CLAUDE.md)**: Detailed architecture, development guide, and known gotchas
|
|
215
|
+
- **[CHANGELOG.md](CHANGELOG.md)**: Version history and breaking changes
|
|
216
|
+
- **[specs/](specs/)**: Canonical specifications organized into two layers:
|
|
217
|
+
- **`formats/`** — External format contracts (YOLO, LabelMe, COCO) and conversion rules
|
|
218
|
+
- **`modules/`** — Internal module architecture, interface contracts, and dependency constraints
|
|
210
219
|
|
|
211
220
|
### Key Concepts
|
|
212
221
|
|
|
213
|
-
- **
|
|
214
|
-
- **
|
|
215
|
-
- **Strict Mode**: Validation errors raise exceptions (default
|
|
222
|
+
- **Format-Native Coordinates**: Coordinates stored in each format's native representation — YOLO normalized [0,1] center-based, LabelMe/COCO absolute pixels top-left. See `DatasetAnnotations.format` to determine semantics
|
|
223
|
+
- **Explicit Coordinate Transforms**: Converters handle all coordinate transformations between formats. No hidden normalization — lossy vs lossless behavior is explicitly documented
|
|
224
|
+
- **Strict Mode**: Validation errors raise exceptions (default). Disable in CLI with `--no-strict`, or in Python API with `strict_mode=False`
|
|
216
225
|
- **Verbose Logging**: Detailed debug logs saved to files when `--verbose` is used. The CLI prints "Verbose log saved to: <path>" after operations.
|
|
217
|
-
- **
|
|
226
|
+
- **Headless Support**: Use `--no-display` for servers/Docker; use `--save` to output visualization images without a window
|
|
227
|
+
- **Keyboard Shortcuts**: During visualization, press `q` or `ESC` to exit early; `Enter`/`Space` to advance; any other key continues
|
|
218
228
|
- **Missing Image Handling**: Missing images are skipped with warnings, allowing processing to continue
|
|
219
229
|
- **RLE Mask Visualization**: COCO RLE masks are displayed with semi-transparent fills for better visibility
|
|
220
|
-
- **Color Management**: Each class ID gets a unique color from
|
|
230
|
+
- **Color Management**: Each class ID gets a unique color from an HSV-based palette for consistent visualization
|
|
231
|
+
- **Specifications**: The `specs/` directory contains the canonical format and module specifications — the authoritative reference for expected behavior
|
|
221
232
|
|
|
222
233
|
## Development
|
|
223
234
|
For detailed developer guidance including advanced test commands, debugging, and architecture overview, see [CLAUDE.md](CLAUDE.md).
|
|
224
235
|
|
|
225
236
|
### Testing
|
|
237
|
+
|
|
238
|
+
289 tests, **73%** code coverage.
|
|
239
|
+
|
|
226
240
|
```bash
|
|
227
241
|
# Run all tests
|
|
228
242
|
pytest
|
|
229
243
|
|
|
230
|
-
# Run tests with coverage
|
|
231
|
-
pytest --cov=dataflow
|
|
244
|
+
# Run tests with coverage report
|
|
245
|
+
pytest --cov=dataflow --cov-report=term
|
|
232
246
|
|
|
233
247
|
# Run specific test module
|
|
234
248
|
pytest tests/convert/test_yolo_and_coco.py
|
|
235
249
|
```
|
|
236
250
|
|
|
251
|
+
**Coverage by module:**
|
|
252
|
+
|
|
253
|
+
| Module | Coverage | Notes |
|
|
254
|
+
|--------|----------|-------|
|
|
255
|
+
| `dataflow/label/` | 78% | Core data models (66%), handlers (67-82%) |
|
|
256
|
+
| `dataflow/convert/` | 83% | Converters (81-92%), base pipeline (62%) |
|
|
257
|
+
| `dataflow/visualize/` | 69% | Visualizers (94-100%), base drawing (79%) |
|
|
258
|
+
| `dataflow/cli/` | 76% | CLI commands (47-96%), utils (86%) |
|
|
259
|
+
| `dataflow/util/` | 87% | File ops (84%), logging (99%) |
|
|
260
|
+
|
|
237
261
|
### Linting and Formatting
|
|
238
262
|
```bash
|
|
239
263
|
# Install development dependencies
|
|
@@ -252,17 +276,39 @@ mypy dataflow
|
|
|
252
276
|
flake8 dataflow tests samples
|
|
253
277
|
```
|
|
254
278
|
|
|
279
|
+
### Pre-commit Hooks (Optional)
|
|
280
|
+
|
|
281
|
+
Automatically check code quality before each commit:
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
# Install pre-commit
|
|
285
|
+
pip install pre-commit
|
|
286
|
+
|
|
287
|
+
# Install git hooks (run once)
|
|
288
|
+
pre-commit install
|
|
289
|
+
|
|
290
|
+
# After this, every `git commit` will auto-run:
|
|
291
|
+
# black (code formatting)
|
|
292
|
+
# isort (import sorting)
|
|
293
|
+
# flake8 (linting)
|
|
294
|
+
# trailing-whitespace / end-of-file-fixer / check-yaml / check-toml
|
|
295
|
+
|
|
296
|
+
# Manually run against all files
|
|
297
|
+
pre-commit run --all-files
|
|
298
|
+
```
|
|
299
|
+
|
|
255
300
|
### Project Structure
|
|
256
301
|
```
|
|
257
302
|
dataflow/
|
|
258
|
-
├── label/ # Annotation handlers (YOLO, LabelMe, COCO)
|
|
259
|
-
├── convert/ # Format converters
|
|
260
|
-
├── visualize/ # Visualization modules
|
|
261
|
-
├── util/
|
|
262
|
-
└── cli/
|
|
263
|
-
tests/
|
|
264
|
-
samples/
|
|
265
|
-
assets/
|
|
303
|
+
├── label/ # Annotation handlers + data models (YOLO, LabelMe, COCO)
|
|
304
|
+
├── convert/ # Format converters + RLE conversion utility
|
|
305
|
+
├── visualize/ # Visualization modules (OpenCV-based)
|
|
306
|
+
├── util/ # Logging and file operation utilities
|
|
307
|
+
└── cli/ # CLI entry point, commands, and validation
|
|
308
|
+
tests/ # Unit and integration tests (label, convert, visualize, cli, util)
|
|
309
|
+
samples/ # Python API usage examples (visualize, convert, label, cli)
|
|
310
|
+
assets/ # Test data organized by format (det/seg) and annotation type
|
|
311
|
+
specs/ # Canonical specifications (formats/ + modules/ layers)
|
|
266
312
|
```
|
|
267
313
|
|
|
268
314
|
## Contributing
|
|
@@ -284,6 +330,6 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|
|
284
330
|
|
|
285
331
|
## Acknowledgments
|
|
286
332
|
|
|
287
|
-
- Thanks to the creators of
|
|
333
|
+
- Thanks to the creators of YOLO, LabelMe, and COCO formats for establishing these annotation standards
|
|
288
334
|
- Built with OpenCV, NumPy, and Click
|
|
289
335
|
- Inspired by the need for seamless format conversion in multi-tool CV pipelines
|
|
@@ -6,17 +6,19 @@
|
|
|
6
6
|
[](https://www.python.org/downloads/)  [](https://pypi.org/project/dataflow-cv/)  [](https://github.com/zjykzj/DataFlow-CV/actions/workflows/python-publish.yml)
|
|
7
7
|
  
|
|
8
8
|
|
|
9
|
-
A computer vision dataset processing library for seamless format conversion and visualization between
|
|
9
|
+
A computer vision dataset processing library for seamless format conversion and visualization between YOLO, LabelMe, and COCO annotation formats. Designed for researchers and developers working with multi-format annotation pipelines.
|
|
10
10
|
|
|
11
11
|
## Features
|
|
12
12
|
|
|
13
|
-
- **Bidirectional Conversion**: Convert between
|
|
13
|
+
- **Bidirectional Conversion**: Convert between YOLO, LabelMe, and COCO formats in any direction
|
|
14
14
|
- **Multi-format Support**: Handle object detection bounding boxes and instance segmentation polygons
|
|
15
|
-
- **
|
|
15
|
+
- **Native Coordinate Storage**: Coordinates stored in format-native representation (YOLO normalized, LabelMe/COCO absolute pixels)
|
|
16
16
|
- **Visualization**: Visualize annotations with OpenCV, supporting both display and save modes
|
|
17
17
|
- **Command-line Interface**: User-friendly CLI with `convert` and `visualize` subcommands
|
|
18
18
|
- **Python API**: Programmatic access for integration into larger pipelines
|
|
19
19
|
- **Verbose Logging**: Detailed logging with file output for debugging
|
|
20
|
+
- **Headless Mode**: Run visualization in server/Docker environments with `--no-display`
|
|
21
|
+
- **Flexible Error Handling**: Choose between strict (abort on error) or lenient (skip and continue) modes
|
|
20
22
|
- **Cross-platform**: Full support for Windows, Linux, and macOS
|
|
21
23
|
|
|
22
24
|
## Table of Contents
|
|
@@ -88,12 +90,6 @@ dataflow-cv convert yolo2coco images/ yolo_labels/ classes.txt coco_annotations.
|
|
|
88
90
|
# YOLO to LabelMe
|
|
89
91
|
dataflow-cv convert yolo2labelme images/ yolo_labels/ classes.txt labelme_json/
|
|
90
92
|
|
|
91
|
-
# COCO to YOLO
|
|
92
|
-
dataflow-cv convert coco2yolo coco_annotations.json yolo_labels/
|
|
93
|
-
|
|
94
|
-
# COCO to LabelMe
|
|
95
|
-
dataflow-cv convert coco2labelme coco_annotations.json labelme_json/
|
|
96
|
-
|
|
97
93
|
# LabelMe to YOLO
|
|
98
94
|
dataflow-cv convert labelme2yolo labelme_json/ classes.txt yolo_labels/
|
|
99
95
|
|
|
@@ -103,8 +99,17 @@ dataflow-cv convert labelme2coco labelme_json/ classes.txt coco_annotations.json
|
|
|
103
99
|
# With RLE encoding
|
|
104
100
|
dataflow-cv convert labelme2coco labelme_json/ classes.txt coco_annotations.json --do-rle
|
|
105
101
|
|
|
102
|
+
# COCO to YOLO
|
|
103
|
+
dataflow-cv convert coco2yolo coco_annotations.json yolo_labels/
|
|
104
|
+
|
|
105
|
+
# COCO to LabelMe
|
|
106
|
+
dataflow-cv convert coco2labelme coco_annotations.json labelme_json/
|
|
107
|
+
|
|
106
108
|
# Enable verbose logging
|
|
107
109
|
dataflow-cv convert yolo2coco images/ yolo_labels/ classes.txt coco_annotations.json --verbose
|
|
110
|
+
|
|
111
|
+
# Disable strict mode (skip invalid annotations instead of aborting)
|
|
112
|
+
dataflow-cv convert yolo2coco --no-strict images/ yolo_labels/ classes.txt coco_annotations.json
|
|
108
113
|
```
|
|
109
114
|
|
|
110
115
|
#### Visualization
|
|
@@ -112,14 +117,17 @@ dataflow-cv convert yolo2coco images/ yolo_labels/ classes.txt coco_annotations.
|
|
|
112
117
|
# Visualize YOLO annotations
|
|
113
118
|
dataflow-cv visualize yolo images/ yolo_labels/ classes.txt --save visualized/
|
|
114
119
|
|
|
115
|
-
# Visualize COCO annotations
|
|
116
|
-
dataflow-cv visualize coco images/ coco_annotations.json --save visualized/
|
|
117
|
-
|
|
118
120
|
# Visualize LabelMe annotations
|
|
119
121
|
dataflow-cv visualize labelme images/ labelme_json/ --save visualized/
|
|
120
122
|
|
|
123
|
+
# Visualize COCO annotations
|
|
124
|
+
dataflow-cv visualize coco images/ coco_annotations.json --save visualized/
|
|
125
|
+
|
|
121
126
|
# Enable verbose logging for detailed debug output
|
|
122
127
|
dataflow-cv visualize yolo --verbose images/ yolo_labels/ classes.txt --save visualized/
|
|
128
|
+
|
|
129
|
+
# Run on headless server (no display window)
|
|
130
|
+
dataflow-cv visualize yolo --no-display images/ yolo_labels/ classes.txt --save visualized/
|
|
123
131
|
```
|
|
124
132
|
|
|
125
133
|
### Python API
|
|
@@ -160,37 +168,53 @@ See the `samples/` directory for complete examples:
|
|
|
160
168
|
|
|
161
169
|
## Documentation
|
|
162
170
|
|
|
163
|
-
- **[CLAUDE.md](CLAUDE.md)**: Detailed architecture and
|
|
164
|
-
-
|
|
165
|
-
-
|
|
166
|
-
- **`
|
|
171
|
+
- **[CLAUDE.md](CLAUDE.md)**: Detailed architecture, development guide, and known gotchas
|
|
172
|
+
- **[CHANGELOG.md](CHANGELOG.md)**: Version history and breaking changes
|
|
173
|
+
- **[specs/](specs/)**: Canonical specifications organized into two layers:
|
|
174
|
+
- **`formats/`** — External format contracts (YOLO, LabelMe, COCO) and conversion rules
|
|
175
|
+
- **`modules/`** — Internal module architecture, interface contracts, and dependency constraints
|
|
167
176
|
|
|
168
177
|
### Key Concepts
|
|
169
178
|
|
|
170
|
-
- **
|
|
171
|
-
- **
|
|
172
|
-
- **Strict Mode**: Validation errors raise exceptions (default
|
|
179
|
+
- **Format-Native Coordinates**: Coordinates stored in each format's native representation — YOLO normalized [0,1] center-based, LabelMe/COCO absolute pixels top-left. See `DatasetAnnotations.format` to determine semantics
|
|
180
|
+
- **Explicit Coordinate Transforms**: Converters handle all coordinate transformations between formats. No hidden normalization — lossy vs lossless behavior is explicitly documented
|
|
181
|
+
- **Strict Mode**: Validation errors raise exceptions (default). Disable in CLI with `--no-strict`, or in Python API with `strict_mode=False`
|
|
173
182
|
- **Verbose Logging**: Detailed debug logs saved to files when `--verbose` is used. The CLI prints "Verbose log saved to: <path>" after operations.
|
|
174
|
-
- **
|
|
183
|
+
- **Headless Support**: Use `--no-display` for servers/Docker; use `--save` to output visualization images without a window
|
|
184
|
+
- **Keyboard Shortcuts**: During visualization, press `q` or `ESC` to exit early; `Enter`/`Space` to advance; any other key continues
|
|
175
185
|
- **Missing Image Handling**: Missing images are skipped with warnings, allowing processing to continue
|
|
176
186
|
- **RLE Mask Visualization**: COCO RLE masks are displayed with semi-transparent fills for better visibility
|
|
177
|
-
- **Color Management**: Each class ID gets a unique color from
|
|
187
|
+
- **Color Management**: Each class ID gets a unique color from an HSV-based palette for consistent visualization
|
|
188
|
+
- **Specifications**: The `specs/` directory contains the canonical format and module specifications — the authoritative reference for expected behavior
|
|
178
189
|
|
|
179
190
|
## Development
|
|
180
191
|
For detailed developer guidance including advanced test commands, debugging, and architecture overview, see [CLAUDE.md](CLAUDE.md).
|
|
181
192
|
|
|
182
193
|
### Testing
|
|
194
|
+
|
|
195
|
+
289 tests, **73%** code coverage.
|
|
196
|
+
|
|
183
197
|
```bash
|
|
184
198
|
# Run all tests
|
|
185
199
|
pytest
|
|
186
200
|
|
|
187
|
-
# Run tests with coverage
|
|
188
|
-
pytest --cov=dataflow
|
|
201
|
+
# Run tests with coverage report
|
|
202
|
+
pytest --cov=dataflow --cov-report=term
|
|
189
203
|
|
|
190
204
|
# Run specific test module
|
|
191
205
|
pytest tests/convert/test_yolo_and_coco.py
|
|
192
206
|
```
|
|
193
207
|
|
|
208
|
+
**Coverage by module:**
|
|
209
|
+
|
|
210
|
+
| Module | Coverage | Notes |
|
|
211
|
+
|--------|----------|-------|
|
|
212
|
+
| `dataflow/label/` | 78% | Core data models (66%), handlers (67-82%) |
|
|
213
|
+
| `dataflow/convert/` | 83% | Converters (81-92%), base pipeline (62%) |
|
|
214
|
+
| `dataflow/visualize/` | 69% | Visualizers (94-100%), base drawing (79%) |
|
|
215
|
+
| `dataflow/cli/` | 76% | CLI commands (47-96%), utils (86%) |
|
|
216
|
+
| `dataflow/util/` | 87% | File ops (84%), logging (99%) |
|
|
217
|
+
|
|
194
218
|
### Linting and Formatting
|
|
195
219
|
```bash
|
|
196
220
|
# Install development dependencies
|
|
@@ -209,17 +233,39 @@ mypy dataflow
|
|
|
209
233
|
flake8 dataflow tests samples
|
|
210
234
|
```
|
|
211
235
|
|
|
236
|
+
### Pre-commit Hooks (Optional)
|
|
237
|
+
|
|
238
|
+
Automatically check code quality before each commit:
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
# Install pre-commit
|
|
242
|
+
pip install pre-commit
|
|
243
|
+
|
|
244
|
+
# Install git hooks (run once)
|
|
245
|
+
pre-commit install
|
|
246
|
+
|
|
247
|
+
# After this, every `git commit` will auto-run:
|
|
248
|
+
# black (code formatting)
|
|
249
|
+
# isort (import sorting)
|
|
250
|
+
# flake8 (linting)
|
|
251
|
+
# trailing-whitespace / end-of-file-fixer / check-yaml / check-toml
|
|
252
|
+
|
|
253
|
+
# Manually run against all files
|
|
254
|
+
pre-commit run --all-files
|
|
255
|
+
```
|
|
256
|
+
|
|
212
257
|
### Project Structure
|
|
213
258
|
```
|
|
214
259
|
dataflow/
|
|
215
|
-
├── label/ # Annotation handlers (YOLO, LabelMe, COCO)
|
|
216
|
-
├── convert/ # Format converters
|
|
217
|
-
├── visualize/ # Visualization modules
|
|
218
|
-
├── util/
|
|
219
|
-
└── cli/
|
|
220
|
-
tests/
|
|
221
|
-
samples/
|
|
222
|
-
assets/
|
|
260
|
+
├── label/ # Annotation handlers + data models (YOLO, LabelMe, COCO)
|
|
261
|
+
├── convert/ # Format converters + RLE conversion utility
|
|
262
|
+
├── visualize/ # Visualization modules (OpenCV-based)
|
|
263
|
+
├── util/ # Logging and file operation utilities
|
|
264
|
+
└── cli/ # CLI entry point, commands, and validation
|
|
265
|
+
tests/ # Unit and integration tests (label, convert, visualize, cli, util)
|
|
266
|
+
samples/ # Python API usage examples (visualize, convert, label, cli)
|
|
267
|
+
assets/ # Test data organized by format (det/seg) and annotation type
|
|
268
|
+
specs/ # Canonical specifications (formats/ + modules/ layers)
|
|
223
269
|
```
|
|
224
270
|
|
|
225
271
|
## Contributing
|
|
@@ -241,6 +287,6 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|
|
241
287
|
|
|
242
288
|
## Acknowledgments
|
|
243
289
|
|
|
244
|
-
- Thanks to the creators of
|
|
290
|
+
- Thanks to the creators of YOLO, LabelMe, and COCO formats for establishing these annotation standards
|
|
245
291
|
- Built with OpenCV, NumPy, and Click
|
|
246
292
|
- Inspired by the need for seamless format conversion in multi-tool CV pipelines
|
|
@@ -6,7 +6,7 @@ offering convenient access to visualization and format conversion functionality
|
|
|
6
6
|
through a unified command-line interface.
|
|
7
7
|
|
|
8
8
|
The CLI follows a `<main-task> <sub-task>` structure:
|
|
9
|
-
- `dataflow-cv visualize <format>`: Visualize annotations in YOLO,
|
|
9
|
+
- `dataflow-cv visualize <format>`: Visualize annotations in YOLO, LabelMe, or COCO format
|
|
10
10
|
- `dataflow-cv convert <direction>`: Convert between six annotation format combinations
|
|
11
11
|
|
|
12
12
|
Example usage:
|