Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor datasets models #231

Merged
merged 7 commits into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/deep_neurographs/intake.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from deep_neurographs.utils import graph_util as gutil
from deep_neurographs.utils import img_util, swc_util, util


MIN_SIZE = 30
NODE_SPACING = 2
SMOOTH_BOOL = True
Expand Down Expand Up @@ -125,7 +124,7 @@ def run(self, swc_pointer):
# Graph size
n_components = util.reformat_number(len(irreducibles))
print("\nGraph Overview...")
print("# connected components:", n_connected_components)
print("# connected components:", n_components)
print("# nodes:", util.reformat_number(n_nodes))
print("# edges:", util.reformat_number(n_edges))

Expand Down Expand Up @@ -155,15 +154,17 @@ def get_irreducibles(self, swc_dicts):
i += 1

# Store results
desc = "Extract Graphs"
irreducibles = []
n_nodes, n_edges = 0, 0
for process in tqdm(as_completed(processes), desc="Extract Graphs"):
for process in tqdm(as_completed(processes), desc=desc):
irreducibles_i = process.result()
irreducibles.extend(irreducibles_i)
n_nodes += count_nodes(irreducibles_i)
n_edges += count_edges(irreducibles_i)
return irreducibles, n_nodes, n_edges


# --- utils ---
def count_nodes(irreducibles):
"""
Expand Down
2 changes: 1 addition & 1 deletion src/deep_neurographs/machine_learning/graph_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import torch
from torch_geometric.data import Data as GraphData

from deep_neurographs.machine_learning import feature_generation, datasets
from deep_neurographs.machine_learning import datasets, feature_generation
from deep_neurographs.utils import gnn_util


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import torch
from torch_geometric.data import HeteroData as HeteroGraphData

from deep_neurographs.machine_learning import feature_generation, datasets
from deep_neurographs.machine_learning import datasets, feature_generation
from deep_neurographs.utils import gnn_util

DTYPE = torch.float32
Expand Down
4 changes: 3 additions & 1 deletion src/deep_neurographs/neurograph.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@

from deep_neurographs import generate_proposals, geometry
from deep_neurographs.geometry import dist as get_dist
from deep_neurographs.machine_learning.groundtruth_generation import init_targets
from deep_neurographs.machine_learning.groundtruth_generation import (
init_targets,
)
from deep_neurographs.utils import graph_util as gutil
from deep_neurographs.utils import img_util, swc_util, util

Expand Down
2 changes: 1 addition & 1 deletion src/deep_neurographs/utils/ml_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
from sklearn.ensemble import AdaBoostClassifier, RandomForestClassifier

from deep_neurographs.machine_learning import (
feature_generation,
datasets,
feature_generation,
graph_datasets,
heterograph_datasets,
)
Expand Down
11 changes: 8 additions & 3 deletions src/deep_neurographs/utils/swc_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,20 @@

"""

from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor, as_completed
from google.cloud import storage
import os
from concurrent.futures import (
ProcessPoolExecutor,
ThreadPoolExecutor,
as_completed,
)
from io import BytesIO
from tqdm import tqdm
from zipfile import ZipFile

import networkx as nx
import numpy as np
import os
from google.cloud import storage
from tqdm import tqdm

from deep_neurographs.utils import util

Expand Down
Loading