我是python新手,尝试解析csv。为MNIST制作了一些边框。现在我想把csv转换成xmls来训练yolo检测器
但我发现了一件非常奇怪的事情:(python关键字^^)
这些是我的行,有上千行,10比1的图像:
filename mnist_images_300_300_bigger_all/mnist_1.jpg
width 300
height 300
class 7
xmin 0
ymin 0
xmax 42
ymax 42
Name: 0, dtype: object
Path were to write xml: Bilder_LabelXML/mnist_images_300_300_bigger_all/mnist_1.xml
Path were image from: mnist_images_300_300_bigger_all/mnist_1.jpg
如果我现在想访问它们,我在脚本中写道:
for index, row in group.object.iterrows():
print(row.class)
这给了我一个错误:
File "annotations_CSV_to_XML.py", line 81
ET.SubElement(size, "name").text = row.class
^
SyntaxError: invalid syntax
如果我访问ymax,一切正常:
for index, row in group.object.iterrows():
print(row.ymin)
如何界定或屏蔽关键字“class”,即python理解它,而不是我想创建一个新类的东西
提前谢谢
目前没有回答
相关问题 更多 >
编程相关推荐