From 2243dd4a16971e83e785b28f586cbfcaa0439c07 Mon Sep 17 00:00:00 2001 From: anna-grim Date: Thu, 17 Oct 2024 04:20:14 +0000 Subject: [PATCH 1/2] removed warning printout --- src/deep_neurographs/utils/img_util.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/deep_neurographs/utils/img_util.py b/src/deep_neurographs/utils/img_util.py index 3abf0a6..f70815d 100644 --- a/src/deep_neurographs/utils/img_util.py +++ b/src/deep_neurographs/utils/img_util.py @@ -142,7 +142,6 @@ def read_tensorstore_with_bbox(img, bbox, normalize=True): shape = [bbox["max"][i] - bbox["min"][i] for i in range(3)] return read_tensorstore(img, bbox["min"], shape, from_center=False) except Exception: - print(f"Unable to read from image with bbox {bbox}") return np.zeros(shape) From 0942992023486300800b1991d01fa5a7a8a11ae6 Mon Sep 17 00:00:00 2001 From: anna-grim Date: Fri, 18 Oct 2024 17:32:26 +0000 Subject: [PATCH 2/2] bug: moving tensors to gpu --- src/deep_neurographs/machine_learning/heterograph_models.py | 2 +- src/deep_neurographs/utils/gnn_util.py | 2 +- src/deep_neurographs/utils/graph_util.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/deep_neurographs/machine_learning/heterograph_models.py b/src/deep_neurographs/machine_learning/heterograph_models.py index 6cc3053..3ecf3d0 100644 --- a/src/deep_neurographs/machine_learning/heterograph_models.py +++ b/src/deep_neurographs/machine_learning/heterograph_models.py @@ -154,7 +154,7 @@ def forward(self, x_dict, edge_index_dict, edge_attr_dict): # Input - Edges for key, f in self.input_edges.items(): - key = reformat_edge_key(key) + #key = reformat_edge_key(key) edge_attr_dict[key] = f(edge_attr_dict[key]) edge_attr_dict = self.activation(edge_attr_dict) diff --git a/src/deep_neurographs/utils/gnn_util.py b/src/deep_neurographs/utils/gnn_util.py index 7621730..1a23f82 100644 --- a/src/deep_neurographs/utils/gnn_util.py +++ b/src/deep_neurographs/utils/gnn_util.py @@ -25,7 +25,7 @@ def get_inputs(data, device=None, is_multimodal=False): x = data.x_dict edge_index = data.edge_index_dict edge_attr = data.edge_attr_dict - if device and torch.cuda.is_available(): + if "cuda" in device and torch.cuda.is_available(): return toGPU(x), toGPU(edge_index), toGPU(edge_attr) else: return x, edge_index, edge_attr diff --git a/src/deep_neurographs/utils/graph_util.py b/src/deep_neurographs/utils/graph_util.py index d97663c..aeb0dd9 100644 --- a/src/deep_neurographs/utils/graph_util.py +++ b/src/deep_neurographs/utils/graph_util.py @@ -340,7 +340,7 @@ def prune_branches(self, graph): # Check whether to stop if length > self.prune_depth or first_pass: - graph.remove_nodes_from(branch[0:min(3, len(branch))]) + graph.remove_nodes_from(branch[0:min(5, len(branch))]) break first_pass = False