-
Notifications
You must be signed in to change notification settings - Fork 0
/
noship_eda.py
41 lines (26 loc) · 1.26 KB
/
noship_eda.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
import pandas as pd
import numpy as np
from tqdm import tqdm
test_image_dir = '../data2/v2/test/'
resnet_seg = pd.read_csv('submissions/resnet34_768_ohem_best_loss_th_05_so_60_submission.csv')
resnet_noship = pd.read_csv('csvs/768_resnet_noship_ohem_dice_prob.csv')
resnet_seg_none = resnet_seg.loc[resnet_seg['EncodedPixels'].isnull()]
#print(resnet_seg_none.sample(10))
resnet_seg_none_image = set(resnet_seg_none['ImageId'])
#print(resnet_seg_none_image)
summary_probs = pd.read_csv('csvs/summary_noship_prob.csv')
test_prob_none_img = {}
steps = 20
total = len(summary_probs)
print('total = {}'.format(total))
for i in range(0, steps):
percent = (i+1) * 1./(steps)
test_prob_none_img['{:.2f}'.format(percent)] = set(summary_probs.loc[summary_probs['Average'] < (percent)]['ImageId'])
num_pass = len(summary_probs.loc[summary_probs['Average'] > percent])
print('threshold[{:.2f}] = {} ({:.2f})'.format(percent, num_pass, num_pass/total))
for test_name, test_set in test_prob_none_img.items():
intersection = len(test_set.intersection(resnet_seg_none_image))
union = len(test_set.union(resnet_seg_none_image))
print('threshold: {} intersection = {} union = {}, IoU = {:.2f}'.format(test_name, intersection, union, intersection / union))
'''
'''