Skip to content

Commit

Permalink
upds (#109)
Browse files Browse the repository at this point in the history
Co-authored-by: anna-grim <[email protected]>
  • Loading branch information
anna-grim and anna-grim authored Apr 9, 2024
1 parent 11bd64d commit 551e412
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 19 deletions.
4 changes: 1 addition & 3 deletions src/deep_neurographs/intake.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def download_gcs_zips(bucket_name, gcs_path, min_size, anisotropy):
# Initializations
bucket = storage.Client().bucket(bucket_name)
zip_paths = utils.list_gcs_filenames(bucket, gcs_path, ".zip")
chunk_size = int(len(zip_paths) * 0.05)
chunk_size = int(len(zip_paths) * 0.02)

# Parse
cnt = 1
Expand All @@ -259,8 +259,6 @@ def download_gcs_zips(bucket_name, gcs_path, min_size, anisotropy):
cnt, t1 = report_progress(
i, len(zip_paths), chunk_size, cnt, t0, t1
)
break

return swc_dicts


Expand Down
6 changes: 3 additions & 3 deletions src/deep_neurographs/machine_learning/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def run_without_seeds(
for i, batch in enumerate(batches):
# Prediction
proposals_i = [proposals[j] for j in batch]
accepts_i = predict(
accepts_i, graph = predict(
neurograph,
graph,
img_path,
Expand Down Expand Up @@ -160,15 +160,15 @@ def predict(

# Run model
proposal_probs = run_model(dataset, model, model_type)
accepts = build.get_accepted_proposals(
accepts, graph = build.get_accepted_proposals(
neurograph,
graph,
proposal_probs,
dataset["idx_to_edge"],
high_threshold=0.95,
low_threshold=confidence_threshold,
)
return accepts
return accepts, graph


def build_from_soma(
Expand Down
19 changes: 6 additions & 13 deletions src/deep_neurographs/reconstruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def get_structure_aware_accepts(
):
# Add best preds
best_preds, best_probs = get_best_preds(neurograph, preds, high_threshold)
accepts = check_cycles_sequential(graph, best_preds, best_probs)
accepts, graph = check_cycles_sequential(graph, best_preds, best_probs)
if len(best_preds) == len(preds.keys()):
return accepts

Expand All @@ -128,9 +128,9 @@ def get_structure_aware_accepts(
good_preds.append(edge)
good_probs.append(prob)

more_accepts = check_cycles_sequential(graph, good_preds, good_probs)
accepts.extend(more_accepts)
return accepts
more_accepts, graph = check_cycles_sequential(graph, good_preds, good_probs)
accepts.extend(more_accepts)
return accepts, graph


def get_subgraphs(graph, edge):
Expand Down Expand Up @@ -203,7 +203,7 @@ def check_cycles_sequential(graph, edges, probs):
if not created_cycle:
graph.add_edges_from([tuple(edges[i])])
accepts.append(edges[i])
return accepts
return accepts, graph


def get_best_preds(neurograph, preds, threshold):
Expand All @@ -220,14 +220,7 @@ def fuse_branches(neurograph, edges):
simple_cnt = 0
complex_cnt = 0
for edge in edges:
if neurograph.is_simple(edge):
simple_cnt += 1
neurograph.merge_proposal(edge)
else:
complex_cnt += 1
#print("merge not implemented for complex")
print("# simple:", simple_cnt)
print("# complex:", complex_cnt)
neurograph.merge_proposal(edge)
return neurograph


Expand Down

0 comments on commit 551e412

Please sign in to comment.