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

fix import pycocotools

上级 7f67465e
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
import os.path as osp import os.path as osp
import random import random
import json import json
from pycocotools.coco import COCO
from .utils import MyEncoder from .utils import MyEncoder
import paddlex.utils.logging as logging import paddlex.utils.logging as logging
...@@ -23,12 +24,6 @@ def split_coco_dataset(dataset_dir, val_percent, test_percent, save_dir): ...@@ -23,12 +24,6 @@ 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")):
logging.error("\'annotations.json\' is not found in {}!".format( logging.error("\'annotations.json\' is not found in {}!".format(
dataset_dir)) dataset_dir))
try:
from pycocotools.coco import COCO
except:
logging.error(
"pycococotools is not installed, follow this doc install pycocotools: https://paddlex.readthedocs.io/zh_CN/develop/install.html#pycocotools"
)
annotation_file = osp.join(dataset_dir, "annotations.json") annotation_file = osp.join(dataset_dir, "annotations.json")
coco = COCO(annotation_file) coco = COCO(annotation_file)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册