Skip to content

Commit

Permalink
Unify description
Browse files Browse the repository at this point in the history
  • Loading branch information
SWHL committed Apr 24, 2024
1 parent 72320e4 commit f6c325c
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion label_convert/darknet_to_coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def read_txt(txt_path: str) -> List:


def main():
parser = argparse.ArgumentParser()
parser = argparse.ArgumentParser("Datasets convert from darknet to COCO")
parser.add_argument(
"--data_dir",
default="dataset/darknet_dataset",
Expand Down
2 changes: 1 addition & 1 deletion label_convert/labelImg_to_publaynet.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def mkdir(dir_path: Union[Path, str]) -> None:


def main():
parser = argparse.ArgumentParser()
parser = argparse.ArgumentParser("Datasets convert from labelImg to PubLayNet")
parser.add_argument("--data_dir", type=str, default=None)
parser.add_argument("--save_dir", type=str, default=None)
parser.add_argument("--val_ratio", type=float, default=0.2)
Expand Down
6 changes: 3 additions & 3 deletions label_convert/labelImg_to_yolov5.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
ValueType = Union[str, Path, None]


class LabelImgToYOLOV5:
class LabelImgToYOLOv5:
def __init__(
self,
data_dir: ValueType = None,
Expand Down Expand Up @@ -142,15 +142,15 @@ def cp_file(self, file_path: Path, dst_dir: Path):


def main():
parser = argparse.ArgumentParser()
parser = argparse.ArgumentParser("Datasets convert from labelImg to YOLOv5")
parser.add_argument("--data_dir", type=str, default=None)
parser.add_argument("--save_dir", type=str, default=None)
parser.add_argument("--val_ratio", type=float, default=0.2)
parser.add_argument("--have_test", action="store_true", default=False)
parser.add_argument("--test_ratio", type=float, default=0.2)
args = parser.parse_args()

converter = LabelImgToYOLOV5(
converter = LabelImgToYOLOv5(
args.data_dir, args.save_dir, args.val_ratio, args.have_test, args.test_ratio
)
converter()
Expand Down
2 changes: 1 addition & 1 deletion label_convert/labelme_to_coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def cp_file(self, file_path: Path, dst_dir: Path):


def main():
parser = argparse.ArgumentParser("Datasets converter from YOLOV5 to COCO")
parser = argparse.ArgumentParser("Datasets converter from labelme to COCO")
parser.add_argument("--data_dir", type=str, default=None)
parser.add_argument("--save_dir", type=str, default=None)
parser.add_argument("--val_ratio", type=float, default=0.2)
Expand Down
6 changes: 3 additions & 3 deletions label_convert/yolov5_to_coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
ValueType = Union[str, Path, None]


class YOLOV5ToCOCO:
class YOLOv5ToCOCO:
def __init__(self, data_dir: ValueType = None, save_dir: ValueType = None):
if data_dir is None:
raise ValueError("data_dir must not be None")
Expand Down Expand Up @@ -248,7 +248,7 @@ def write_json(json_path, content: dict):


def main():
parser = argparse.ArgumentParser("Datasets converter from YOLOV5 to COCO")
parser = argparse.ArgumentParser("Datasets converter from YOLOv5 to COCO")
parser.add_argument(
"--data_dir",
type=str,
Expand All @@ -261,7 +261,7 @@ def main():
)
args = parser.parse_args()

converter = YOLOV5ToCOCO(args.data_dir, args.save_dir)
converter = YOLOv5ToCOCO(args.data_dir, args.save_dir)
converter(mode_list=args.mode_list.split(","))


Expand Down
6 changes: 3 additions & 3 deletions label_convert/yolov5_to_yolov8.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
ValueType = Union[str, Path, None]


class YOLOV5ToYOLOV8:
class YOLOv5ToYOLOv8:
def __init__(self, data_dir: ValueType = None, save_dir: ValueType = None):
if data_dir is None:
raise ValueError("data_dir must not be None")
Expand Down Expand Up @@ -77,7 +77,7 @@ def verify_exists(file_path: Union[Path, str]):


def main():
parser = argparse.ArgumentParser("Datasets converter from YOLOV5 to COCO")
parser = argparse.ArgumentParser("Datasets converter from YOLOv5 to YOLOv8")
parser.add_argument(
"--data_dir",
type=str,
Expand All @@ -90,7 +90,7 @@ def main():
)
args = parser.parse_args()

converter = YOLOV5ToYOLOV8(args.data_dir, args.save_dir)
converter = YOLOv5ToYOLOv8(args.data_dir, args.save_dir)
converter(mode_list=args.mode_list.split(","))


Expand Down
6 changes: 3 additions & 3 deletions label_convert/yolov5_yaml_to_coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from tqdm import tqdm


class YOLOV5CfgToCOCO:
class YOLOv5CfgToCOCO:
def __init__(
self,
yaml_path: Union[str, Path, None] = None,
Expand Down Expand Up @@ -256,7 +256,7 @@ def verify_exists(file_path):


def main():
parser = argparse.ArgumentParser("Datasets converter from YOLOV5 to COCO")
parser = argparse.ArgumentParser("Datasets converter from YOLOv5 YAML to COCO")
parser.add_argument(
"--yaml_path",
type=str,
Expand All @@ -266,7 +266,7 @@ def main():
parser.add_argument("--save_dir", type=str, default=None)
args = parser.parse_args()

converter = YOLOV5CfgToCOCO(args.yaml_path, args.save_dir)
converter = YOLOv5CfgToCOCO(args.yaml_path, args.save_dir)
converter()


Expand Down
6 changes: 3 additions & 3 deletions label_convert/yolov8_to_yolov5.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
ValueType = Union[str, Path, None]


class YOLOV8ToYOLOV5:
class YOLOv8ToYOLOv5:
def __init__(
self,
data_dir: ValueType = None,
Expand Down Expand Up @@ -108,7 +108,7 @@ def read_yaml(yaml_path):


def main():
parser = argparse.ArgumentParser("Datasets converter from YOLOV5 to COCO")
parser = argparse.ArgumentParser("Datasets converter from YOLOv8 to YOLOv5")
parser.add_argument(
"--data_dir",
type=str,
Expand All @@ -122,7 +122,7 @@ def main():
parser.add_argument("--yaml_path", type=str, default=None)
args = parser.parse_args()

converter = YOLOV8ToYOLOV5(args.data_dir, args.save_dir, args.yaml_path)
converter = YOLOv8ToYOLOv5(args.data_dir, args.save_dir, args.yaml_path)
converter(mode_list=args.mode_list.split(","))


Expand Down
4 changes: 2 additions & 2 deletions tests/test_labelImg_to_yolov5.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

sys.path.append(str(root_dir))

from label_convert.labelImg_to_yolov5 import LabelImgToYOLOV5
from label_convert.labelImg_to_yolov5 import LabelImgToYOLOv5

test_file_dir = cur_dir / "test_files"

Expand All @@ -20,7 +20,7 @@

def test_normal():
data_dir = test_file_dir / dataset_name
convert = LabelImgToYOLOV5(data_dir)
convert = LabelImgToYOLOv5(data_dir)
convert()

save_dir = test_file_dir / f"{dataset_name}_yolov5"
Expand Down
4 changes: 2 additions & 2 deletions tests/test_yolov5_to_coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

sys.path.append(str(root_dir))

from label_convert.yolov5_to_coco import YOLOV5ToCOCO
from label_convert.yolov5_to_coco import YOLOv5ToCOCO

test_file_dir = cur_dir / "test_files"

Expand All @@ -19,7 +19,7 @@

def test_normal():
data_dir = test_file_dir / data_dir_name
converter = YOLOV5ToCOCO(data_dir)
converter = YOLOv5ToCOCO(data_dir)
converter()

save_dir: Path = test_file_dir / f"{data_dir_name}_coco"
Expand Down
4 changes: 2 additions & 2 deletions tests/test_yolov5_to_yolov8.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

sys.path.append(str(root_dir))

from label_convert.yolov5_to_yolov8 import YOLOV5ToYOLOV8
from label_convert.yolov5_to_yolov8 import YOLOv5ToYOLOv8

test_file_dir = cur_dir / "test_files"

Expand All @@ -19,7 +19,7 @@

def test_normal():
data_dir = test_file_dir / data_dir_name
converter = YOLOV5ToYOLOV8(data_dir)
converter = YOLOv5ToYOLOv8(data_dir)
converter()

save_dir: Path = test_file_dir / f"{data_dir_name}_yolov8"
Expand Down
4 changes: 2 additions & 2 deletions tests/test_yolov5_yaml_to_coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

sys.path.append(str(root_dir))

from label_convert.yolov5_yaml_to_coco import YOLOV5CfgToCOCO
from label_convert.yolov5_yaml_to_coco import YOLOv5CfgToCOCO

test_file_dir = cur_dir / "test_files"

Expand All @@ -19,7 +19,7 @@

def test_normal():
yaml_path = test_file_dir / data_dir_name / "sample.yaml"
converter = YOLOV5CfgToCOCO(yaml_path=yaml_path)
converter = YOLOv5CfgToCOCO(yaml_path=yaml_path)
converter()

save_dir: Path = test_file_dir / f"{data_dir_name}_coco"
Expand Down
4 changes: 2 additions & 2 deletions tests/test_yolov8_to_yolov5.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

sys.path.append(str(root_dir))

from label_convert.yolov8_to_yolov5 import YOLOV8ToYOLOV5
from label_convert.yolov8_to_yolov5 import YOLOv8ToYOLOv5

test_file_dir = cur_dir / "test_files"

Expand All @@ -19,7 +19,7 @@

def test_normal():
data_dir = test_file_dir / data_dir_name
converter = YOLOV8ToYOLOV5(data_dir)
converter = YOLOv8ToYOLOv5(data_dir)
converter()

save_dir: Path = test_file_dir / f"{data_dir_name}_yolov5"
Expand Down

0 comments on commit f6c325c

Please sign in to comment.