diff --git a/ppdet/data/source/voc.py b/ppdet/data/source/voc.py index 1c2a7ef98ccbac760430befc375a79cdebc51a7c..fb58f3a4d47fdfbc06648db7993d95af5d2dc0c7 100644 --- a/ppdet/data/source/voc.py +++ b/ppdet/data/source/voc.py @@ -143,7 +143,7 @@ class VOCDataSet(DetDataset): # user dataset may not contain difficult field _difficult = obj.find('difficult') _difficult = int( - _difficult.text) if _difficult is not None else 0 + _difficult.text) if _difficult is not None and _difficult.text is not None else 0 x1 = float(obj.find('bndbox').find('xmin').text) y1 = float(obj.find('bndbox').find('ymin').text)