onehahaha756 / yolov5_rotation

GNU General Public License v3.0
106 stars 20 forks source link

AttributeError: 'NoneType' object has no attribute 'find' #23

Open pengwenkao opened 2 years ago

pengwenkao commented 2 years ago

Hello, Could you please help me?How can I deal with this problem? I use yolov5 to train my dataset. The annotation file is an XML file annotated with rolabelimg. Now run voc_ label.py file converts the XML file into a TXT file recognized by yolov5. The following problems occur after running:

File "E:/yolov5/ voclabel.py", line 42, in convert annotation b =(float(xmlbox.find('cx'). text),float(xmlbox.find('cy'). text),float(xmlbox.find('w'). text),float(xmlbox.find('h'). text)) AttributeError: 'NoneType' object has no attribute 'find'

By the way, the voc_label.py file is written according to the Internet, which is used to convert XML files into txt files. I just started learning object detection, and the teacher assigned this task which is very difficult for me.The teacher's task is to label the pictures with rolabelimg, and then we find an algorithm to recognize the pictures.

onehahaha756 commented 2 years ago

Hi,I think that this problem is caused by xml file parse process,you can check whether your codes(voc_label.py) is match with your xml files.

pengwenkao commented 2 years ago

OK,I will check it.Thank you!