Open Marryli opened 7 years ago
Do you have a line number where the error occurs in the code?
File "/home/jwh/project/py-faster-rcnn/tools/../lib/datasets/pascal_voc.py", line 193, in _load_pascal_annotation obj for obj in objs if int(obj.find('difficult').text) == 0] AttributeError: 'NoneType' object has no attribute 'text'
can anyone help me?thanks in advance
i think you need to add import this "import google.protobuf.text_format" it may fix the problem
@jcyl is your problem solved? i met the same problem, i fix the problem by delete the codes in voc_eval.py. the reason is your xml file, i guess your xml were generated by yourself, and there was no 'difficult' node
@wuyuzaizai What codes did you delete in voc_eval.py? Thanks in advance.
@Marcus208 i get the same error as below
obj_struct['pose'] = obj.find('pose').text
AttributeError: 'NoneType' object has no attribute 'text'
And i fix the problem by comment out two lines in the function parse_rec()
of voc_eval.py
def parse_rec(filename):
""" Parse a PASCAL VOC xml file """
tree = ET.parse(filename)
objects = []
for obj in tree.findall('object'):
obj_struct = {}
obj_struct['name'] = obj.find('name').text
# obj_struct['pose'] = obj.find('pose').text
# obj_struct['truncated'] = int(obj.find('truncated').text)
obj_struct['difficult'] = int(obj.find('difficult').text)
bbox = obj.find('bndbox')
obj_struct['bbox'] = [int(bbox.find('xmin').text),
int(bbox.find('ymin').text),
int(bbox.find('xmax').text),
int(bbox.find('ymax').text)]
objects.append(obj_struct)
return objects
I have same error ./lib/datasets/icdar_str.py", line 170, in _load_pascal_annotation obj for obj in objs if int(obj.find('difficult').text) == 0] AttributeError: 'NoneType' object has no attribute 'text'
still not resolved tried all the above options.
Thanks in advance
Hello, To resolve this problem you have to either:
i get the same error but i do not have any idea what it means