import csv from pprint import pprint import os, sys from time import sleep sleep(1) print("start") results = [] with open("raw_results.csv", "r") as f: reader = csv.reader(f) next(reader) # Skip the first row for row in reader: results.append(row + [row[0].replace("image.orig/", "")[0]]) max_val = max([float(row[5]) for row in results]) min_val = min([float(row[5]) for row in results]) wanted_cat = "2" i = 0 for result in results: diff = 0 if result[-1] == wanted_cat: print("put result with -ve value to +ve value in weight") col_name = ["gray", "rgb", "sift", "contour", "cld"] for i in [0, 1, 2, 3, 4]: pprint((col_name[i]).ljust(10) + ": " + str(float(results[0][10 + i]) - float(result[10 + i]))) diff += float(results[0][10 + i]) - float(result[10 + i]) if diff == 0: print("\033[92m PARA OK \033[0m") break i = 0 for j in range(0, 100): if results[j][-1] == wanted_cat: i += 1 print("total matched category(" + wanted_cat + ") found in first 100 row: " + str(i)) # pprint([results[0], max_val, min_val])