-
Notifications
You must be signed in to change notification settings - Fork 5
/
score_sc1.py
34 lines (29 loc) · 1.03 KB
/
score_sc1.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
'''
@author: bhoff
'''
import csv
import os
import time
if __name__ == '__main__':
crossWalkPath='/metadata/images_crosswalk.tsv'
if not os.path.isfile(crossWalkPath):
raise Exception(crossWalkPath+' does not exist')
time.sleep(15) # sleep
existingsamples = []
with open(crossWalkPath,'r') as tsvin:
tsvin = csv.reader(tsvin, delimiter='\t')
f = open('/output/predictions.tsv', 'w')
f.write("subjectId\tlaterality\tconfidence\n")
first=True
for row in tsvin:
if first: # skip the header row
first=False
continue
sample = row[0] + row[4] #Make sure there are no duplicated samples
if sample not in existingsamples:
f.write('%s\t%s\t0\n' % (row[0], row[4]))
existingsamples.append(rsample)
imageFile='/scoringData/'+row[5]
if not os.path.isfile(imageFile):
raise Exception(imageFile+' does not exist')
f.close()