pip install -r requirements.txt
- CSV: filename, width, height, class, xmin, ymin, xmax, ymax
- YOLO TXT: one .txt per image with normalized rows: class_id x_center y_center width height
- Pascal VOC XML: annotation/object/bndbox structure
- Convert CSV to YOLO TXT
python3 csv_to_txt.py -i annotations.csv -o yolo_txt_output
- Convert CSV to Pascal VOC XML
python3 csv_to_xml.py -i annotations.csv -o voc_xml_output
- Convert YOLO TXT to CSV
python3 txt_to_csv.py -i txt_dir -img images_dir -o annotations.csv --classes classes.json --image-ext .jpg
- Convert YOLO TXT to Pascal VOC XML
python3 txt_to_xml.py -i txt_dir -img images_dir -o voc_xml_output --classes classes.json --image-ext .jpg
- Convert Pascal VOC XML to CSV
python3 xml_to_csv.py -i xml_dir -o annotations.csv
- When reading YOLO TXT, you may pass
--classes
with a JSON mapping such as{ "0": "person", "1": "car" }
. - When writing YOLO TXT, class names are enumerated to integer identifiers starting from zero.
conversion/models.py
: data modelsImageAnnotation
,ObjectAnnotation
,BoundingBox
,ImageSize
conversion/protocols.py
: interfacesAnnotationReader
,AnnotationWriter
conversion/readers_*.py
: readers for CSV, YOLO TXT, Pascal VOC XMLconversion/writers_*.py
: writers for CSV, YOLO TXT, Pascal VOC XML
Each CLI tool composes readers and writers. The design follows single responsibility, clear dependencies, and extensibility principles.