提交 9ab19fff 编写于 作者: S sunyanfang01

modify the coco

上级 ca669355
...@@ -19,8 +19,6 @@ import copy ...@@ -19,8 +19,6 @@ import copy
import json import json
import cv2 import cv2
import numpy as np import numpy as np
from pycocotools.coco import COCO
from pycocotools.mask import decode
import paddlex.utils.logging as logging import paddlex.utils.logging as logging
from .voc import VOCDetection from .voc import VOCDetection
from .dataset import is_pic from .dataset import is_pic
...@@ -82,6 +80,7 @@ class EasyDataDet(VOCDetection): ...@@ -82,6 +80,7 @@ class EasyDataDet(VOCDetection):
'name': k 'name': k
}) })
from pycocotools.mask import decode
ct = 0 ct = 0
ann_ct = 0 ann_ct = 0
with open(file_list, encoding=get_encoding(file_list)) as f: with open(file_list, encoding=get_encoding(file_list)) as f:
...@@ -133,7 +132,7 @@ class EasyDataDet(VOCDetection): ...@@ -133,7 +132,7 @@ class EasyDataDet(VOCDetection):
'area': 'area':
float((x2 - x1 + 1) * (y2 - y1 + 1)), float((x2 - x1 + 1) * (y2 - y1 + 1)),
'segmentation': 'segmentation':
[] if gt_poly[i] is None else gt_poly[i], [[x1, y1, x1, y2, x2, y2, x2, y1]] if gt_poly[i] is None else gt_poly[i],
'category_id': 'category_id':
cname2cid[cname], cname2cid[cname],
'id': 'id':
...@@ -175,6 +174,7 @@ class EasyDataDet(VOCDetection): ...@@ -175,6 +174,7 @@ class EasyDataDet(VOCDetection):
logging.info("{} samples in file {}".format( logging.info("{} samples in file {}".format(
len(self.file_list), file_list)) len(self.file_list), file_list))
self.num_samples = len(self.file_list) self.num_samples = len(self.file_list)
from pycocotools.coco import COCO
self.coco_gt = COCO() self.coco_gt = COCO()
self.coco_gt.dataset = annotations self.coco_gt.dataset = annotations
self.coco_gt.createIndex() self.coco_gt.createIndex()
......
...@@ -19,7 +19,6 @@ import copy ...@@ -19,7 +19,6 @@ import copy
import json import json
import cv2 import cv2
import numpy as np import numpy as np
from pycocotools.mask import decode
import paddlex.utils.logging as logging import paddlex.utils.logging as logging
from .dataset import Dataset from .dataset import Dataset
from .dataset import get_encoding from .dataset import get_encoding
...@@ -59,6 +58,7 @@ class EasyDataSeg(Dataset): ...@@ -59,6 +58,7 @@ class EasyDataSeg(Dataset):
self.labels = list() self.labels = list()
self._epoch = 0 self._epoch = 0
from pycocotools.mask import decode
cname2cid = {} cname2cid = {}
label_id = 0 label_id = 0
with open(label_list, encoding=get_encoding(label_list)) as fr: with open(label_list, encoding=get_encoding(label_list)) as fr:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册