drawbox-cv 0.1.0__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.
- drawbox/__init__.py +7 -0
- drawbox/__main__.py +67 -0
- drawbox/app.py +1097 -0
- drawbox/box.py +42 -0
- drawbox/canvas.py +408 -0
- drawbox/classes.py +79 -0
- drawbox/colors.py +31 -0
- drawbox/config.py +44 -0
- drawbox/dataset.py +245 -0
- drawbox/formats/__init__.py +41 -0
- drawbox/formats/base.py +44 -0
- drawbox/formats/coco_format.py +85 -0
- drawbox/formats/tf_format.py +37 -0
- drawbox/formats/voc_format.py +82 -0
- drawbox/formats/yolo_format.py +43 -0
- drawbox_cv-0.1.0.dist-info/METADATA +145 -0
- drawbox_cv-0.1.0.dist-info/RECORD +19 -0
- drawbox_cv-0.1.0.dist-info/WHEEL +4 -0
- drawbox_cv-0.1.0.dist-info/entry_points.txt +2 -0
drawbox/__init__.py
ADDED
drawbox/__main__.py
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
import sys
|
|
3
|
+
from .app import AnnotatorApp
|
|
4
|
+
from .config import AnnotatorConfig
|
|
5
|
+
|
|
6
|
+
def main():
|
|
7
|
+
# Prompt the user for parameters like the original script
|
|
8
|
+
frames_dir = input("Enter input frames directory path: ").strip()
|
|
9
|
+
if not frames_dir:
|
|
10
|
+
print("Error: Input frames directory path is required.")
|
|
11
|
+
sys.exit(1)
|
|
12
|
+
|
|
13
|
+
output_dir = input("Enter base output directory path (default: output): ").strip()
|
|
14
|
+
if not output_dir:
|
|
15
|
+
output_dir = "output"
|
|
16
|
+
|
|
17
|
+
start_frame = input("Enter starting frame index (default: 0): ").strip()
|
|
18
|
+
start_frame = int(start_frame) if start_frame.isdigit() else 0
|
|
19
|
+
|
|
20
|
+
init_lbl = input("Enter initial label file path (optional, press Enter to skip): ").strip()
|
|
21
|
+
init_fmt = "tf"
|
|
22
|
+
if init_lbl:
|
|
23
|
+
init_fmt = input("Enter format of initial label (tf, yolo, coco, voc) (default: tf): ").strip().lower()
|
|
24
|
+
if not init_fmt:
|
|
25
|
+
init_fmt = "tf"
|
|
26
|
+
|
|
27
|
+
# Flexible multi-format selection
|
|
28
|
+
formats_in = input("Enter output format(s) comma-separated (tf, yolo, coco, voc) (default: yolo): ").strip().lower()
|
|
29
|
+
if not formats_in:
|
|
30
|
+
formats = ["yolo"]
|
|
31
|
+
else:
|
|
32
|
+
formats = [f.strip() for f in formats_in.split(",") if f.strip()]
|
|
33
|
+
|
|
34
|
+
# Validate selected formats
|
|
35
|
+
valid_formats = {"tf", "yolo", "coco", "voc"}
|
|
36
|
+
invalid_formats = [f for f in formats if f not in valid_formats]
|
|
37
|
+
if invalid_formats:
|
|
38
|
+
print(f"Error: Invalid format(s) selected: {', '.join(invalid_formats)}")
|
|
39
|
+
print(f"Supported formats are: {', '.join(valid_formats)}")
|
|
40
|
+
sys.exit(1)
|
|
41
|
+
|
|
42
|
+
carry_over = input("Carry over edited labels to subsequent frames? (y/n) (default: y): ").strip().lower() != "n"
|
|
43
|
+
save_crops = input("Save cropped bounding boxes? (y/n) (default: n): ").strip().lower() == "y"
|
|
44
|
+
|
|
45
|
+
crops_dir = None
|
|
46
|
+
if save_crops:
|
|
47
|
+
crops_dir = input("Enter directory path to save crops (default: output/crops): ").strip()
|
|
48
|
+
if not crops_dir:
|
|
49
|
+
crops_dir = None
|
|
50
|
+
|
|
51
|
+
config = AnnotatorConfig(
|
|
52
|
+
frames_dir=frames_dir,
|
|
53
|
+
output_dir=output_dir,
|
|
54
|
+
start_frame=start_frame,
|
|
55
|
+
initial_label_file=init_lbl,
|
|
56
|
+
initial_label_format=init_fmt,
|
|
57
|
+
formats=formats,
|
|
58
|
+
save_crops=save_crops,
|
|
59
|
+
crops_out_dir=crops_dir,
|
|
60
|
+
carry_over_labels=carry_over,
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
app = AnnotatorApp(config)
|
|
64
|
+
app.mainloop()
|
|
65
|
+
|
|
66
|
+
if __name__ == "__main__":
|
|
67
|
+
main()
|