'GBK' codec can 't decode byte 0 x86 position in 119: illegal multibyte sequence
Put forward a method of batch change path:
# - * - coding: utf-8 - * -
The from XML. Etree. ElementTree import ElementTree, Element
The import XML. Etree. ElementTree as ET
The import pickled
The import OS
The from OS import listdir, getcwd
The from OS. Path import join
Def convert_annotation (image_id) :
In_file='C:/Users/xiaoming/Documents/yolov3/coco/label/' +' nomask '+' 06 % d % int (image_id) + 'XML'
Out_file='C:/Users/xiaoming/Documents/yolov3/coco/label/' +' nomask '+' 06 % d % int (image_id) + 'XML'
The tree=ET. Parse (in_file)
Root=tree. Getroot ()
For elem in root. The iter (" path ") :
New_elem='C:/Users/xiaoming/Documents/yolov3/coco/label'
Elem. Text=new_elem
Tree. Write (out_file)
For image_id in range (1100, 00) :
Convert_annotation (image_id)