diff --git a/README.md b/README.md index 761a8e4..783ae8f 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ ## Introduction -A tool for object detection and image segmentation dataset format conversion. +A tool for object detection and image segmentation dataset format conversion. Supports conversion between labelme tool annotated data, labelImg tool annotated data, YOLO, PubLayNet and COCO data set formats. @@ -34,6 +34,9 @@ E(labelme) --> B B --> F(labelImg) F --> G(PubLayNet) F --> J(YOLOv5) + +J --> H(YOLOv8) +H --> J ``` ## Installation diff --git a/tests/test_yolov5_to_yolov8.py b/tests/test_yolov5_to_yolov8.py new file mode 100644 index 0000000..26b7b47 --- /dev/null +++ b/tests/test_yolov5_to_yolov8.py @@ -0,0 +1,34 @@ +# -*- encoding: utf-8 -*- +# @Author: SWHL +# @Contact: liekkaskono@163.com +import shutil +import sys +from pathlib import Path + +cur_dir = Path(__file__).resolve().parent +root_dir = cur_dir.parent + +sys.path.append(str(root_dir)) + +from label_convert.yolov5_to_yolov8 import YOLOV5ToYOLOV8 + +test_file_dir = cur_dir / "test_files" + +data_dir_name = "yolov5_dataset" + + +def test_normal(): + data_dir = test_file_dir / data_dir_name + converter = YOLOV5ToYOLOV8(data_dir) + converter() + + save_dir: Path = test_file_dir / f"{data_dir_name}_yolov8" + assert save_dir.exists() + + train_img_dir = save_dir / "images" / "train" + assert train_img_dir.exists() + + val_label_dir = save_dir / "labels" / "val" + assert val_label_dir.exists() + + shutil.rmtree(save_dir) diff --git a/tests/test_yolov8_to_yolov5.py b/tests/test_yolov8_to_yolov5.py new file mode 100644 index 0000000..39d7352 --- /dev/null +++ b/tests/test_yolov8_to_yolov5.py @@ -0,0 +1,40 @@ +# -*- encoding: utf-8 -*- +# @Author: SWHL +# @Contact: liekkaskono@163.com +import shutil +import sys +from pathlib import Path + +cur_dir = Path(__file__).resolve().parent +root_dir = cur_dir.parent + +sys.path.append(str(root_dir)) + +from label_convert.yolov8_to_yolov5 import YOLOV8ToYOLOV5 + +test_file_dir = cur_dir / "test_files" + +data_dir_name = "yolov8_dataset" + + +def test_normal(): + data_dir = test_file_dir / data_dir_name + converter = YOLOV8ToYOLOV5(data_dir) + converter() + + save_dir: Path = test_file_dir / f"{data_dir_name}_yolov5" + assert save_dir.exists() + + train_img_dir = save_dir / "images" + assert train_img_dir.exists() + + val_label_dir = save_dir / "labels" + assert val_label_dir.exists() + + train_txt_path = save_dir / "train.txt" + assert train_txt_path.exists() + + classes_txt_path = save_dir / "classes.txt" + assert classes_txt_path.exists() + + shutil.rmtree(save_dir)