我已经使用blender-python来创建一个XML文件(注释),但问题是当我使用它与Matlab代码来读取它时,它会给我以下错误:
Error in VOCxml2struct>parse (line 10)
if ~isempty(parent)&&xml(ind)~='
从这个功能:
res=[];
if ~isempty(parent)&&xml(ind)~='
i=findchar(xml,ind,'
res=trim(xml(ind:i-1));
ind=i;
[tag,ind]=gettag(xml,i);
if ~strcmp(tag,['/' parent])
error(' closed with ',parent,tag);
end
考虑到Pascal_Voc数据集中的XML文件使用相同的代码可以正常工作,当你看到两个XML文件看起来相同时,我有点混乱,我手动创建了所需的标签,下面是我的blender-python代码,希望有建议我解决它。
谢谢大家的时间。
with open("000007.xml", "w", encoding="utf-8") as file:
file.write ("\n")
file.write (" VOC2007\n")
file.write (" " + '000007.jpg' + "\n")
file.write (" \n")
file.write (" The VOC2007 Database\n")
file.write (" PASCAL VOC2007\n")
file.write (" flickr\n")
file.write (" 194179466\n")
file.write (" \n")
file.write (" \n")
file.write (" monsieurrompu\n")
file.write (" Thom Zemanek\n")
file.write (" \n")
file.write (" \n")
file.write (" 500\n")
file.write (" 333\n")
file.write (" 3\n")
file.write (" \n")
file.write (" 0\n")
file.write (" \n")
file.write (" car\n")
file.write (" Unspecified\n")
file.write (" 1\n")
file.write (" 0\n")
file.write (" ")
file.write ("\n " + '141' + "")
file.write ("\n " + '50' + "")
file.write ("\n " + '500' + "")
file.write ("\n " + '330' + "")
file.write ("\n \n")
file.write (" \n")
file.write ("\n")