EdjeElectronics / TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10

How to train a TensorFlow Object Detection Classifier for multiple object detection on Windows
Apache License 2.0
2.92k stars 1.3k forks source link

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

Open charlesdewandel opened 3 years ago

charlesdewandel commented 3 years ago

this is the error I get

Gaodelike commented 3 years ago

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

Gaodelike commented 3 years ago

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

kaln27 commented 2 years ago

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