|
@@ -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):
|
|
|
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)
|