提交 adf63794 编写于 作者: M mamingjie-China

update

上级 038724f1
......@@ -93,7 +93,7 @@ def arg_parser():
default=False,
help="split dataset with the split value")
parser.add_argument(
"--form",
"--format",
"-f",
default=None,
help="define dataset format(ImageNet/COCO/VOC/Seg)")
......@@ -187,22 +187,22 @@ def main():
assert args.val_value is not None, "--val_value should be defined while spliting dataset"
dataset_dir = args.dataset_dir
dataset_form = args.form.lower()
dataset_format = args.format.lower()
val_value = float(args.val_value)
test_value = float(args.test_value
if args.test_value is not None else 0)
save_dir = dataset_dir
if not dataset_form in ["coco", "imagenet", "voc", "seg"]:
if not dataset_format in ["coco", "imagenet", "voc", "seg"]:
logging.error(
"The dataset form is not correct defined.(support COCO/ImageNet/VOC/Seg)"
"The dataset format is not correct defined.(support COCO/ImageNet/VOC/Seg)"
)
if not osp.exists(dataset_dir):
logging.error("The path of dataset to be splited doesn't exist.")
if val_value <= 0 or val_value >= 1 or test_value < 0 or test_value >= 1 or val_value + test_value >= 1:
logging.error("The value of split is not correct.")
pdx.tools.split.dataset_split(dataset_dir, dataset_form, val_value,
pdx.tools.split.dataset_split(dataset_dir, dataset_format, val_value,
test_value, save_dir)
......
......@@ -20,17 +20,18 @@ from .dataset_split.imagenet_split import split_imagenet_dataset
from .dataset_split.seg_split import split_seg_dataset
def dataset_split(dataset_dir, dataset_form, val_value, test_value, save_dir):
if dataset_form == "coco":
def dataset_split(dataset_dir, dataset_format, val_value, test_value,
save_dir):
if dataset_format == "coco":
train_num, val_num, test_num = split_coco_dataset(
dataset_dir, val_value, test_value, save_dir)
elif dataset_form == "voc":
elif dataset_format == "voc":
train_num, val_num, test_num = split_voc_dataset(
dataset_dir, val_value, test_value, save_dir)
elif dataset_form == "seg":
elif dataset_format == "seg":
train_num, val_num, test_num = split_seg_dataset(
dataset_dir, val_value, test_value, save_dir)
elif dataset_form == "imagenet":
elif dataset_format == "imagenet":
train_num, val_num, test_num = split_imagenet_dataset(
dataset_dir, val_value, test_value, save_dir)
print("Dataset Split Done.")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册