未验证 提交 b176ab3d 编写于 作者: J Jason 提交者: GitHub

Merge pull request #184 from SunAhong1993/syf0703

fix the voc for no object
......@@ -106,8 +106,11 @@ class VOCDetection(Dataset):
ct = int(tree.find('id').text)
im_id = np.array([int(tree.find('id').text)])
pattern = re.compile('<object>', re.IGNORECASE)
obj_tag = pattern.findall(
str(ET.tostringlist(tree.getroot())))[0][1:-1]
obj_match = pattern.findall(
str(ET.tostringlist(tree.getroot())))
if len(obj_match) == 0:
continue
obj_tag = obj_match[0][1:-1]
objs = tree.findall(obj_tag)
pattern = re.compile('<size>', re.IGNORECASE)
size_tag = pattern.findall(
......
......@@ -100,7 +100,7 @@ class LabelMe2COCO(X2COCO):
image["height"] = json_info["imageHeight"]
image["width"] = json_info["imageWidth"]
image["id"] = image_id + 1
image["file_name"] = json_info["imagePath"].split("/")[-1]
image["file_name"] = osp.split(json_info["imagePath"])[-1]
return image
def generate_polygon_anns_field(self, height, width,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册