예제 #1
0
def auto_proofread(body2gtbody, rag_file, size_threshold, master_logger, test_stack, session_location):
    nomerge_hist = []
    tot_hist = []
    nomerge_hist2 = []
    tot_hist2 = []
    dirtybodies = set()
    for iter1 in range(0, 101):
        nomerge_hist.append(0)
        tot_hist.append(0)
        nomerge_hist2.append(0)
        tot_hist2.append(0)

    neuroproof.initialize_priority_scheduler(rag_file, 0.1, 0.9, 0.1)

    bodyremap = {}

    num_body = 0   
    neuroproof.set_body_mode(size_threshold, 0) 
    while neuroproof.get_estimated_num_remaining_edges() > 0:
        process_edge(body2gtbody, nomerge_hist, tot_hist, nomerge_hist2, tot_hist2, dirtybodies, bodyremap)
        num_body += 1

    num_synapse = 0   
    neuroproof.set_synapse_mode(0.1) 
    while neuroproof.get_estimated_num_remaining_edges() > 0:
        process_edge(body2gtbody, nomerge_hist, tot_hist, nomerge_hist2, tot_hist2, dirtybodies, bodyremap)
        num_synapse += 1

    num_orphan = 0   
    neuroproof.set_orphan_mode(size_threshold, size_threshold, size_threshold) 
    while neuroproof.get_estimated_num_remaining_edges() > 0:
        process_edge(body2gtbody, nomerge_hist, tot_hist, nomerge_hist2, tot_hist2, dirtybodies, bodyremap)
        num_orphan += 1

    master_logger.info("Probability Actual Agreement with Groundtruth Flat")
    for iter1 in range(0, 101):
        if tot_hist[iter1] == 0:
            per = 0
        else:
            per = (float(nomerge_hist[iter1])/float(tot_hist[iter1]) * 100)
        print iter1, ", ", per , ", " , tot_hist[iter1] 

    master_logger.info("Probability Actual Agreement with Groundtruth Est")
    for iter1 in range(0, 101):
        if tot_hist2[iter1] == 0:
            per = 0
        else:
            per = (float(nomerge_hist2[iter1])/float(tot_hist2[iter1]) * 100)
        print iter1, ", ", per , ", " , tot_hist2[iter1] 

    body2body = {}
    for key, vallist in bodyremap.items():
        for body in vallist:
            body2body[body] = key

    os.system("cp -R " + test_stack + "/superpixel_maps " + session_location + "/") 
    os.system("cp " + test_stack + "/superpixel_to_segment_map.txt " + session_location + "/") 

    mapping_file = open(test_stack + "/segment_to_body_map.txt")
    outfile = open(session_location + "/segment_to_body_map.txt", 'w')

    for line in mapping_file.readlines():
        vals = line.split(' ')
        
        seg = int(vals[0])
        body = int(vals[1])

        if body in body2body:
            body = body2body[body]
        outfile.write(str(seg) + " " + str(body) + "\n")

    master_logger.info("Num body: " + str(num_body))
    master_logger.info("Num synapse: " + str(num_synapse))
    master_logger.info("Num orphan: " + str(num_orphan))
    master_logger.info("Num total: " + str(num_body + num_synapse + num_orphan))
import libNeuroProofPriority as npp
import sys
import random

# read file
status = npp.initialize_priority_scheduler(sys.argv[1], .1, .9, .5)
print(status)


# body mode
#npp.set_edge_mode(0.1, 0.9, 0.5)
num_examined = 0
npp.set_body_mode(25000, 0)

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
예제 #3
0
#!/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")
예제 #4
0
import libNeuroProofPriority as npp
import sys

status = npp.initialize_priority_scheduler(sys.argv[1], .1, .9, .5)

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()
예제 #5
0
import libNeuroProofPriority as npp
import sys

graph_json = sys.argv[1]
output_path = sys.argv[2]
groundtruth_path = sys.argv[3]

status = npp.initialize_priority_scheduler(graph_json, .1, .9, .5)
assert status, "initialize_priority_scheduler() failed."

npp.set_edge_mode(0.1, 0.9, 0.5)

num_examined = 0
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

assert num_examined == 610

npp.export_priority_scheduler(output_path)

tempout = open(output_path).read()
groundout = open(groundtruth_path).read()

assert tempout == groundout, \