-
Notifications
You must be signed in to change notification settings - Fork 1
/
estimate_human_classifier_error.py
54 lines (48 loc) · 1.3 KB
/
estimate_human_classifier_error.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
52
53
54
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 20 19:15:13 2019
@author: Artur Donaldson
Estimates human error in classification of branchpoints
"""
from setup import bp_directory,areas_directory,im_directory
from read_branchpoints import read_branchpoints
import numpy as np
names = ["01_dr","01_dr","01_g","02_g"]
ad=list()
ss = list()
for name in names:
directory = bp_directory+"HRF\\"
branchpoints_path = directory+name+"_final_BPs.txt"
sites_ss = read_branchpoints(branchpoints_path)
ss.extend(sites_ss)
branchpoints_path = directory+name+"_final_BPs_ad.txt"
sites_ad = read_branchpoints(branchpoints_path)
ad.extend(sites_ad)
all_bps = ad.copy()
all_bps.extend(ss)
print(len(all_bps))
x=0
all_bps.sort()
while x < len(all_bps)-1:
if all_bps[x]==all_bps[x+1]:
all_bps.pop(x+1)
else:
x+=1
def set_recur(l):
s = set()
for x in l:
s.add(frozenset(x))
return s
ad_set=set_recur(ad)
ss_set=set_recur(ss)
bp_set = set_recur(all_bps)
print("All points labelled BPs by either classifier",len(all_bps))
print("Classifier 1: ",len(ad))
print("Classifier 2: ",len(ss))
print("Classifiers differed in the labelling of {} points".format(len(ad_set.difference(ss_set))))
#ss = np.array(ss)
#ad = np.array(ad)
#
#N = len(ad)
#
#diff = (ss!=ad).sum()