diff --git a/paddlex/tools/dataset_split/coco_split.py b/paddlex/tools/dataset_split/coco_split.py index e7a67ce13095d286cb876cd9e757ed3e86ea466e..dbedf9c86d3f789593fb571c9e15508c9c8b8f09 100644 --- a/paddlex/tools/dataset_split/coco_split.py +++ b/paddlex/tools/dataset_split/coco_split.py @@ -15,6 +15,7 @@ import os.path as osp import random import json +from pycocotools.coco import COCO from .utils import MyEncoder import paddlex.utils.logging as logging @@ -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")): logging.error("\'annotations.json\' is not found in {}!".format( 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") coco = COCO(annotation_file)