def run(self): progress = 0. results = dict() self.set_progress_percentage(progress) for s in self.samples: truth = os.path.join('/groups/saalfeld/saalfeldlab/larissa/data/cremieval/', self.de, s + '.' + self.m + '.h5') test = os.path.join(os.path.dirname(self.input()[0].fn), s+'.'+self.m+'.h5') truth = CremiFile(truth, 'a') test = CremiFile(test, 'a') synaptic_partners_eval = SynapticPartners() print(test.read_annotations()) fscore, precision, recall, fp, fn, filtered_matches = synaptic_partners_eval.fscore( test.read_annotations(), truth.read_annotations(), truth.read_neuron_ids(), all_stats=True) results[s] = dict() results[s]['fscore'] = fscore results[s]['precision'] = precision results[s]['recall'] = recall results[s]['fp'] = fp results[s]['fn'] = fn results[s]['filtered_matches'] = filtered_matches progress += 100. / len(self.samples) try: self.set_progress_percentage(progress) except: pass with self.output().open('w') as done: json.dump(results, done)
def evaluate(test, truth): synaptic_partners_eval = SynapticPartners() fscore, precision, recall, fp, fn, filtered_matches = synaptic_partners_eval.fscore(test.read_annotations(), truth.read_annotations(), truth.read_neuron_ids(), all_stats=True) logging.info("\tfscore: " + str(fscore)) logging.info("\tprecision: " + str(precision)) logging.info("\trecall: " + str(recall)) logging.info("\tfp: " + str(fp)) logging.info("\tfn: " + str(fn)) return fscore
def run(self): progress = 0.0 results = dict() self.set_progress_percentage(progress) for s in self.samples: truth = os.path.join( "/groups/saalfeld/saalfeldlab/larissa/data/cremieval/", self.de, s + "." + self.m + ".h5", ) test = os.path.join( os.path.dirname(self.input()[0].fn), s + "." + self.m + ".h5" ) truth = CremiFile(truth, "a") test = CremiFile(test, "a") synaptic_partners_eval = SynapticPartners() print(test.read_annotations()) fscore, precision, recall, fp, fn, filtered_matches = synaptic_partners_eval.fscore( test.read_annotations(), truth.read_annotations(), truth.read_neuron_ids(), all_stats=True, ) results[s] = dict() results[s]["fscore"] = fscore results[s]["precision"] = precision results[s]["recall"] = recall results[s]["fp"] = fp results[s]["fn"] = fn results[s]["filtered_matches"] = filtered_matches progress += 100.0 / len(self.samples) try: self.set_progress_percentage(progress) except: pass with self.output().open("w") as done: json.dump(results, done)
print "Neuron IDs" print "==========" print "\tvoi split : " + str(voi_split) print "\tvoi merge : " + str(voi_merge) print "\tadapted RAND: " + str(adapted_rand) clefts_evaluation = Clefts(test.read_clefts(), truth.read_clefts()) false_positive_count = clefts_evaluation.count_false_positives() false_negative_count = clefts_evaluation.count_false_negatives() false_positive_stats = clefts_evaluation.acc_false_positives() false_negative_stats = clefts_evaluation.acc_false_negatives() print "Clefts" print "======" print "\tfalse positives: " + str(false_positive_count) print "\tfalse negatives: " + str(false_negative_count) print "\tdistance to ground truth: " + str(false_positive_stats) print "\tdistance to proposal : " + str(false_negative_stats) synaptic_partners_evaluation = SynapticPartners() fscore = synaptic_partners_evaluation.fscore(test.read_annotations(), truth.read_annotations(), truth.read_neuron_ids()) print "Synaptic partners" print "=================" print "\tfscore: " + str(fscore)
print "==========" print "\tvoi split : " + str(voi_split) print "\tvoi merge : " + str(voi_merge) print "\tadapted RAND: " + str(adapted_rand) clefts_evaluation = Clefts(test.read_clefts(), truth.read_clefts()) false_positive_count = clefts_evaluation.count_false_positives() false_negative_count = clefts_evaluation.count_false_negatives() false_positive_stats = clefts_evaluation.acc_false_positives() false_negative_stats = clefts_evaluation.acc_false_negatives() print "Clefts" print "======" print "\tfalse positives: " + str(false_positive_count) print "\tfalse negatives: " + str(false_negative_count) print "\tdistance to ground truth: " + str(false_positive_stats) print "\tdistance to proposal : " + str(false_negative_stats) synaptic_partners_evaluation = SynapticPartners() fscore = synaptic_partners_evaluation.fscore(test.read_annotations(), truth.read_annotations(), truth.read_neuron_ids()) print "Synaptic partners" print "=================" print "\tfscore: " + str(fscore)