def process_edge(body2gtbody, nomerge_hist, tot_hist, nomerge_hist2, tot_hist2, dirtybodies, bodyremap): priority = neuroproof.get_next_edge() (body1, body2) = priority.body_pair weight = neuroproof.get_edge_val(priority) if body1 not in dirtybodies and body2 not in dirtybodies: tot_hist[int(weight*100)] += 1 tot_hist2[int(weight*100)] += 1 link = True if body2gtbody[body1] != body2gtbody[body2]: if body1 not in dirtybodies and body2 not in dirtybodies: nomerge_hist[int(weight*100)] += 1 nomerge_hist2[int(weight*100)] += 1 link = False else: if body2 not in bodyremap: bodyremap[body2] = [body2] if body1 not in bodyremap: bodyremap[body1] = [body1] dirtybodies.add(body1) bodyremap[body1].extend(bodyremap[body2]) del bodyremap[body2] neuroproof.set_edge_result(priority.body_pair, link)
decision = 0 undo = 0 num_undo = 0 npp.estimate_work() estimated = npp.get_estimated_num_remaining_edges() print(("Num estimated edges: ", estimated)) while npp.get_estimated_num_remaining_edges() > 0: priority_info = npp.get_next_edge() xyzlocation = priority_info.location (body1, body2) = priority_info.body_pair # proofread body pair at location npp.set_edge_result(priority_info.body_pair, decision%2) decision+=1 num_examined += 1 undo += 1 if not undo%5: num_examined -= 1 decision -= 1 status = npp.undo() if not status: print("Won't undo") decision += 1 num_examined += 1 else: num_undo += 1 #npp.set_body_mode(25000, 0) print(("Num body: ", num_examined))
decision = 0 undo = 0 num_undo = 0 npp.estimate_work() estimated = npp.get_estimated_num_remaining_edges() print(("Num estimated edges: ", estimated)) while npp.get_estimated_num_remaining_edges() > 0: priority_info = npp.get_next_edge() xyzlocation = priority_info.location (body1, body2) = priority_info.body_pair # proofread body pair at location npp.set_edge_result(priority_info.body_pair, decision % 2) decision += 1 num_examined += 1 undo += 1 if not undo % 5: num_examined -= 1 decision -= 1 status = npp.undo() if not status: print("Won't undo") decision += 1 num_examined += 1 else: num_undo += 1 #npp.set_body_mode(25000, 0) print(("Num body: ", num_examined))
num_examined = 0 if not status: exit(1) npp.set_edge_mode(0.1, 0.9, 0.5) while npp.get_estimated_num_remaining_edges() > 0: priority_info = npp.get_next_edge() xyzlocation = priority_info.location (body1, body2) = priority_info.body_pair # proofread body pair at location npp.set_edge_result(priority_info.body_pair, False) num_examined += 1 if num_examined != 610: exit(1) npp.export_priority_scheduler(sys.argv[2]) tempfile = open(sys.argv[2]) groundfile = open(sys.argv[3]) tempout = tempfile.read() groundout = groundfile.read() if tempout != groundout: exit(1)
#!/usr/bin/python import libNeuroProofPriority as npp status = npp.initialize_priority_scheduler("examples/graph.json", .1, .9, .5) num_examined = 0 if status: while npp.get_estimated_num_remaining_edges() > 0: priority_info = npp.get_next_edge() xyzlocation = priority_info.location (body1, body2) = priority_info.body_pair # proofread body pair at location npp.set_edge_result(priority_info.body_pair, 1.0) num_examined += 1 print "Num examined: " , num_examined npp.export_priority_scheduler("output.json")