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

update some log

上级 ac619fad
......@@ -93,7 +93,10 @@ def arg_parser():
default=False,
help="split dataset with the split value")
parser.add_argument(
"--form", "-f", default=None, help="define dataset format")
"--form",
"-f",
default=None,
help="define dataset format(ImageNet/COCO/VOC/Seg)")
parser.add_argument(
"--dataset_dir",
"-dd",
......@@ -104,12 +107,12 @@ def arg_parser():
"--val_value",
"-vv",
default=None,
help="define the value of validation dataset")
help="define the value of validation dataset(E.g 0.2)")
parser.add_argument(
"--test_value",
"-tv",
default=None,
help="define the value of test dataset")
help="define the value of test dataset(E.g 0.1)")
return parser
......
......@@ -16,19 +16,19 @@ import os.path as osp
import random
import json
from .utils import MyEncoder
import paddlex.utils.logging as logging
def split_coco_dataset(dataset_dir, val_percent, test_percent, save_dir):
if not osp.exists(osp.join(dataset_dir, "annotations.json")):
raise ValueError("\'annotations.json\' is not found in {}!".format(
logging.error("\'annotations.json\' is not found in {}!".format(
dataset_dir))
try:
from pycocotools.coco import COCO
except:
print(
logging.error(
"pycococotools is not installed, follow this doc install pycocotools: https://paddlex.readthedocs.io/zh_CN/develop/install.html#pycocotools"
)
return
annotation_file = osp.join(dataset_dir, "annotations.json")
coco = COCO(annotation_file)
......
......@@ -15,6 +15,7 @@
import os.path as osp
import random
from .utils import list_files, is_pic
import paddlex.utils.logging as logging
def split_imagenet_dataset(dataset_dir, val_percent, test_percent, save_dir):
......
......@@ -15,14 +15,14 @@
import os.path as osp
import random
from .utils import list_files, is_pic, replace_ext, read_seg_ann
import paddlex.utils.logging as logging
def split_seg_dataset(dataset_dir, val_percent, test_percent, save_dir):
if not osp.exists(osp.join(dataset_dir, "JPEGImages")):
raise ValueError("\'JPEGImages\' is not found in {}!".format(
dataset_dir))
logging.error("\'JPEGImages\' is not found in {}!".format(dataset_dir))
if not osp.exists(osp.join(dataset_dir, "Annotations")):
raise ValueError("\'Annotations\' is not found in {}!".format(
logging.error("\'Annotations\' is not found in {}!".format(
dataset_dir))
all_image_files = list_files(osp.join(dataset_dir, "JPEGImages"))
......
......@@ -16,14 +16,14 @@ import os.path as osp
import random
import xml.etree.ElementTree as ET
from .utils import list_files, is_pic, replace_ext
import paddlex.utils.logging as logging
def split_voc_dataset(dataset_dir, val_percent, test_percent, save_dir):
if not osp.exists(osp.join(dataset_dir, "JPEGImages")):
raise ValueError("\'JPEGImages\' is not found in {}!".format(
dataset_dir))
logging.error("\'JPEGImages\' is not found in {}!".format(dataset_dir))
if not osp.exists(osp.join(dataset_dir, "Annotations")):
raise ValueError("\'Annotations\' is not found in {}!".format(
logging.error("\'Annotations\' is not found in {}!".format(
dataset_dir))
all_image_files = list_files(osp.join(dataset_dir, "JPEGImages"))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册