我想将不同变量的值保存在 CSV 文件中。但它每次都会打印另一个标题。我不想要这个,我附上我的 CSV 文件快照以供您理解。输出 csv
file_orimg = open('Org_image.csv', 'a', newline='')
writer_orimg = csv.writer(file_orimg, delimiter='\t',lineterminator='\n',)
writer_orimg.writerow(["Image Name", "epsilon","MSE", "SSIM", "Prediction", "Probability"])
for i in images:
writer_orimg.writerow([i, epsilon, mse, ssim, clean_pred, clean_prob, label_idx.item()])