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

update some log

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