darkflow 和 python 的新手。我正在尝试使用https://github.com/thtrieu/darkflow和 yolo 权重来训练我自己的数据集。我目前遇到错误:AttributeError: 'NoneType' object has no attribute 'find'执行pascal_voc_clean_xml.py第 41 行时:'w = (imsize.find('width').text) '这是来自https://github.com/thtrieu/darkflow/blob/master/darkflow/utils/pascal_voc_clean_xml.py的代码的一部分:in_file = open(file) tree=ET.parse(in_file) root = tree.getroot() jpg = str(root.find('filename').text) imsize = root.find('size') w = int(imsize.find('width').text) h = int(imsize.find('height').text) all = list() for obj in root.iter('object'): current = list() name = obj.find('name').text if name not in pick: continue xmlbox = obj.find('bndbox') xn = int(float(xmlbox.find('xmin').text)) xx = int(float(xmlbox.find('xmax').text)) yn = int(float(xmlbox.find('ymin').text)) yx = int(float(xmlbox.find('ymax').text)) current = [name,xn,yn,xx,yx] all += [current] add = [[jpg, [w, h, all]]] dumps += add in_file.close()这是我的 xml 文件:我知道'find'是python中ElementTree.py的一个函数,但为什么'find'函数不能正常工作?
添加回答
举报
0/150
提交
取消