Skip to content

Commit

Permalink
align imports with current main of dynamic network architectures
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianIsensee committed Feb 6, 2024
1 parent fa552d3 commit 52cab35
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

import numpy as np
from batchgenerators.utilities.file_and_folder_operations import load_json, join, save_json, isfile, maybe_mkdir_p
from dynamic_network_architectures.architectures.unet import PlainConvUNet, ResidualEncoderUNet
from dynamic_network_architectures.architectures.residual_unet import ResidualEncoderUNet
from dynamic_network_architectures.architectures.unet import PlainConvUNet
from dynamic_network_architectures.building_blocks.helper import convert_dim_to_conv_op, get_matching_instancenorm

from nnunetv2.configuration import ANISO_THRESHOLD
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from torch import nn

from nnunetv2.experiment_planning.experiment_planners.default_experiment_planner import ExperimentPlanner
from dynamic_network_architectures.architectures.unet import ResidualEncoderUNet
from dynamic_network_architectures.architectures.residual_unet import ResidualEncoderUNet


class ResEncUNetPlanner(ExperimentPlanner):
Expand Down
2 changes: 2 additions & 0 deletions nnunetv2/inference/data_iterators.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def preprocess_fromfiles_save_to_queue(list_of_lists: List[List[str]],
pass
done_event.set()
except Exception as e:
# print(Exception, e)
abort_event.set()
raise e

Expand Down Expand Up @@ -99,6 +100,7 @@ def preprocessing_iterator_fromfiles(list_of_lists: List[List[str]],

worker_ctr = 0
while (not done_events[worker_ctr].is_set()) or (not target_queues[worker_ctr].empty()):
# import IPython;IPython.embed()
if not target_queues[worker_ctr].empty():
item = target_queues[worker_ctr].get()
worker_ctr = (worker_ctr + 1) % num_processes
Expand Down
14 changes: 8 additions & 6 deletions nnunetv2/inference/predict_from_raw_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,8 @@ def predict_from_data_iterator(self,

if ofile is not None:
# this needs to go into background processes
# export_prediction_from_logits(prediction, properties, configuration_manager, plans_manager,
# dataset_json, ofile, save_probabilities)
# export_prediction_from_logits(prediction, properties, self.configuration_manager, self.plans_manager,
# self.dataset_json, ofile, save_probabilities)
print('sending off prediction to background worker for resampling and export')
r.append(
export_pool.starmap_async(
Expand All @@ -379,10 +379,12 @@ def predict_from_data_iterator(self,
)
)
else:
# convert_predicted_logits_to_segmentation_with_correct_shape(prediction, plans_manager,
# configuration_manager, label_manager,
# properties,
# save_probabilities)
# convert_predicted_logits_to_segmentation_with_correct_shape(
# prediction, self.plans_manager,
# self.configuration_manager, self.label_manager,
# properties,
# save_probabilities)

print('sending off prediction to background worker for resampling')
r.append(
export_pool.starmap_async(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from dynamic_network_architectures.architectures.unet import ResidualEncoderUNet, PlainConvUNet
from dynamic_network_architectures.architectures.residual_unet import ResidualEncoderUNet
from dynamic_network_architectures.architectures.unet import PlainConvUNet
from dynamic_network_architectures.building_blocks.helper import convert_dim_to_conv_op, get_matching_batchnorm
from dynamic_network_architectures.initialization.weight_init import init_last_bn_before_add_to_0, InitWeights_He
from nnunetv2.training.nnUNetTrainer.nnUNetTrainer import nnUNetTrainer
Expand Down
3 changes: 2 additions & 1 deletion nnunetv2/utilities/get_network_from_plans.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from dynamic_network_architectures.architectures.unet import PlainConvUNet, ResidualEncoderUNet
from dynamic_network_architectures.architectures.residual_unet import ResidualEncoderUNet
from dynamic_network_architectures.architectures.unet import PlainConvUNet
from dynamic_network_architectures.building_blocks.helper import get_matching_instancenorm, convert_dim_to_conv_op
from dynamic_network_architectures.initialization.weight_init import init_last_bn_before_add_to_0
from nnunetv2.utilities.network_initialization import InitWeights_He
Expand Down

0 comments on commit 52cab35

Please sign in to comment.