def analyze_decimation_error_types_single_frame(im, scale=0.5, xform=zoom): ims = xform(im, scale) shape = ims.shape px_scale = shape[0] / float(im.shape[0]) hits = lambda (x, sc): set( zip(*where(pixelize(trace.find_segments(x), sc, shape)))) gold, test = map(hits, ((im, px_scale), (ims, 1.0))) false_positives = test - gold false_negatives = gold - test common = gold & test torate = lambda x: len(x) / float(len(gold)) # print "false positive rate : %f"%(torate( false_positives )) # print "false negative rate : %f"%(torate( false_negatives )) # print "true positive rate : %f"%(torate( common )) # print "sum : %f"%sum(map( torate, (false_positives, false_negatives, common) ) ) return map(torate, (false_positives, false_negatives, common))
def analyze_decimation_error_types_single_frame( im, scale=0.5, xform = zoom ): ims = xform(im,scale) shape = ims.shape px_scale = shape[0] / float( im.shape[0] ) hits = lambda (x,sc): set( zip(*where(pixelize( trace.find_segments(x), sc, shape ))) ) gold,test = map(hits, ((im ,px_scale ), (ims,1.0 )) ) false_positives = test - gold false_negatives = gold - test common = gold & test torate = lambda x: len(x)/float(len(gold)) # print "false positive rate : %f"%(torate( false_positives )) # print "false negative rate : %f"%(torate( false_negatives )) # print "true positive rate : %f"%(torate( common )) # print "sum : %f"%sum(map( torate, (false_positives, false_negatives, common) ) ) return map(torate, (false_positives, false_negatives, common) )
def setUp(self): self.movie = Reader('data/curated/huber/whisker_data_0024.seq') self.gold_wv = trace.find_segments(self.movie[0])