Open charlesdewandel opened 3 years ago
This problem also happend on my script,and have you solved this problem?
Aha, I have found the cause of the problem. You can check whether your picture can be displayed correctly on labelimg. It may be caused by the picture
Maybe this error caused by filename in xml flie isn't compare with the relative image name. Is occur when we chang our image name after use labelimg. Here I have code put it in to the train and test file . cd into train and file. use terminal run this python code. Have good day.
import xml.etree.ElementTree as ET
import os
docu_list = os.listdir('./')
cwd = os.getcwd()
for item in docu_list:
front, back = item.split('.')
if back == 'xml':
xml = ET.parse(item)
root = xml.getroot()
filename_box = root.find('filename')
filename = filename_box.text
if filename != front + '.jpg':
filename_box.text = front + '.jpg'
path_box = root.find('path')
path = path_box.text
if path != os.path.join(cwd, front, '.jpg'):
path_box.text = os.path.join(cwd, front, '.jpg')
xml.write(item)
print('Successfully union the name !')
this is the error I get