convert2Yolo icon indicating copy to clipboard operation
convert2Yolo copied to clipboard

Error in VOC Parsing

Open ilyasmg opened this issue 5 years ago • 3 comments

I'm converting this dataset (https://www.di.ens.fr/willow/research/headdetection/) from xml to txt to use it in YOLO but I'm getting this error. VOC Parsing Result : False, msg : ERROR : 'NoneType' object has no attribute 'text', moreInfo : <class 'AttributeError'> Format.py 258

this is line 258 in Format.py tmp = { "name": _object.find("name").text }

Do you know how to solve it?

ilyasmg avatar Apr 01 '19 04:04 ilyasmg

I think one or more of your XML files is missing the tag...

7thstorm avatar Apr 17 '19 04:04 7thstorm

you have to check your xml file and tags in that xml file. For example I got my xml files from labelbox.com (as a voc format) and every object has instead of bndbox and x1,y1,x2,y2 instead of xmin,ymin,xmax,ymax. So I chaged code from line 261 on Format.py as

                xml_bndbox = _object.find("polygon")
                bndbox = {
                    "xmin": float(xml_bndbox.find("x1").text), 
                    "ymin": float(xml_bndbox.find("y1").text), 
                    "xmax": float(xml_bndbox.find("x2").text),
                    "ymax": float(xml_bndbox.find("y2").text)
                }

fakturk avatar Jun 22 '19 12:06 fakturk

I also got my xml file from labelbox as voc format but I have both bndbox and polygon. Moreover, some xml files have x1 x2 x3 x4 y1 y2 y3 y4. I dont know how todeal with it.

Alzheimancer avatar Jun 26 '19 14:06 Alzheimancer