|
|
@@ -143,12 +143,15 @@ class VOCDetection(Dataset):
|
|
|
cname = obj.find(name_tag).text.strip()
|
|
|
gt_class[i][0] = cname2cid[cname]
|
|
|
pattern = re.compile('<difficult>', re.IGNORECASE)
|
|
|
- diff_tag = pattern.findall(str(ET.tostringlist(obj)))[0][1:
|
|
|
- -1]
|
|
|
- try:
|
|
|
- _difficult = int(obj.find(diff_tag).text)
|
|
|
- except Exception:
|
|
|
+ diff_tag = pattern.findall(str(ET.tostringlist(obj)))
|
|
|
+ if len(diff_tag) == 0:
|
|
|
_difficult = 0
|
|
|
+ else:
|
|
|
+ diff_tag = diff_tag[0][1:-1]
|
|
|
+ try:
|
|
|
+ _difficult = int(obj.find(diff_tag).text)
|
|
|
+ except Exception:
|
|
|
+ _difficult = 0
|
|
|
pattern = re.compile('<bndbox>', re.IGNORECASE)
|
|
|
box_tag = pattern.findall(str(ET.tostringlist(obj)))
|
|
|
if len(box_tag) == 0:
|