6 # Calculates the total error in coordinates of GPU bounds rectangles of objects
8 def ComputeError(reference, other):
9 reference = open(reference, "r")
10 other = open(other, "r")
13 a = reference.readline()
15 if a == "" and b == "":
19 if a[0] == '#' and b[0] == '#':
21 a = map(float, a.strip(" \r\n").split("\t"))
22 b = map(float, b.strip(" \r\n").split("\t"))
23 deltaArea = abs(b[3]*b[4] - a[3]*a[4])
25 deltaCoord = b[1] - a[1] + b[2] - a[2]
26 total += math.sqrt(deltaArea) + abs(deltaCoord)
28 # Counts the number of unique bounds
29 def UniqueBounds(other):
30 other = open(other, "r")
32 for l in other.readlines():
35 #print "L is " + str(l)
36 l = map(float, l.strip(" \r\n").split("\t"))
38 if not l in store.keys():
43 return len(store.keys())
46 print str(ComputeError(argv[1], argv[2])) + "\t" + str(UniqueBounds(argv[1])) + "\t" + str(UniqueBounds(argv[2]))
50 if __name__ == "__main__":
51 sys.exit(main(sys.argv))