-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtablefindings.py
executable file
·51 lines (43 loc) · 1 KB
/
tablefindings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python
import numpy as np
f = open("detections.csv",'r')
files = {}
betterfiles = {}
f.readline()
for line in f:
line=line.replace('\0', '').replace("\"",'').strip()
fname = line.split(",")[0]
#print line
score = float(line.split(",")[1])
cls = line.split(",")[2]
if fname not in files:
files[fname]=[]
files[fname].append(cls)
if score > .8:
if fname not in betterfiles:
betterfiles[fname]=[]
betterfiles[fname].append(cls)
for d in [files,betterfiles]:
finalcounts={}
for fname in d:
classes={}
for cls in d[fname]:
if cls not in classes:
classes[cls]=0
classes[cls]+=1
for cls in classes:
if classes[cls]>1:
if cls+"+" not in finalcounts:
finalcounts[cls+"+"]=0
finalcounts[cls+"+"]+=1
if cls not in finalcounts:
finalcounts[cls]=0
finalcounts[cls]+=1
for key in sorted(finalcounts, key=finalcounts.get)[-10:]:
print key+"&"+str(finalcounts[key])+"\\\\"
tot=0
for key in finalcounts:
tot+=finalcounts[key]
print tot
print
print