def output_xls(xls_path, cato, recall, prec, ap, mrecall, mprec, mAP):
book = xlwt.Workbook() #创建一个Excel
sheet1 = book.add_sheet('1')
sheet1.write(0,0,'catogory_name')
sheet1.write(0,1,'recall')
sheet1.write(0,2,'precision')
sheet1.write(0,3,'ap')
for i, label in enumerate(cato):
sheet1.write(i+1,0,label.decode('utf-8')) #一定要解码
sheet1.write(i+1,1,recall[i])
sheet1.write(i+1,2,prec[i])
sheet1.write(i+1,3,ap[i])
sheet1.write(i+2,0,'average')
sheet1.write(i+2,1, mrecall)
sheet1.write(i+2,2, mprec)
sheet1.write(i+2,3, mAP)
book.save(xls_path) #创建保存文件
python创建表格并写入内容
猜你喜欢
转载自blog.csdn.net/Mr_health/article/details/88394064
今日推荐
周排行