TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10 icon indicating copy to clipboard operation
TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10 copied to clipboard

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 125: invalid continuation byte

Open charlesdewandel opened this issue 4 years ago • 3 comments

this is the error I get

charlesdewandel avatar Jan 30 '21 17:01 charlesdewandel

This problem also happend on my script,and have you solved this problem?

Gaodelike avatar Feb 09 '21 01:02 Gaodelike

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

Gaodelike avatar Feb 09 '21 02:02 Gaodelike

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 !')

kaln27 avatar Jan 07 '22 09:01 kaln27