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

Custom (MONAI) networks performing poorly #1479

Open
ibro45 opened this issue May 31, 2023 · 2 comments
Open

Custom (MONAI) networks performing poorly #1479

ibro45 opened this issue May 31, 2023 · 2 comments
Assignees

Comments

@ibro45
Copy link

ibro45 commented May 31, 2023

Hi! I am trying to train UNet-like networks available in MONAI by extending the build_network_architecture. So far, I have tried FlexibleUNet and VNet. Both performed extremely poorly. Neither of the networks apply the activation function on their output, so that isn't the issue.

The dataset in question is the TotalSegmentator dataset. I am replicating their low-res model, i.e., the network that predicts all 104 classes on 3mm isotropic spacing. The default network that uses PlainConvEncoder performs as expected. The custom (MONAI) ones fail.

This is the implementation:

from monai.networks.nets import FlexibleUNet
from .variants.network_architecture.nnUNetTrainerNoDeepSupervision import nnUNetTrainerNoDeepSupervision


class nnUNetTrainerNoDeepSupervision_ibro(nnUNetTrainerNoDeepSupervision):
    @staticmethod
    def build_network_architecture(plans_manager,
                                   dataset_json,
                                   configuration_manager,
                                   num_input_channels,
                                   enable_deep_supervision=False):

        out_channels = plans_manager.get_label_manager(dataset_json).num_segmentation_heads
        spatial_dims = len(configuration_manager.conv_kernel_sizes[0])

        model = FlexibleUNet(
            in_channels=num_input_channels,
            out_channels=out_channels,
            spatial_dims=spatial_dims,
            upsample="deconv",
            backbone="efficientnet-b4"
        )

        return model

Any idea what may be the issue?

Thank you so much!

@ibro45
Copy link
Author

ibro45 commented Jun 1, 2023

It'd be great to have an example in https://github.com/MIC-DKFZ/nnUNet/tree/master/nnunetv2/training/nnUNetTrainer/variants/network_architecture demonstrating such extension

@laughingpyu
Copy link

Hello I have a question if I alredy write a file like nnUNetTrainerNodeepSupervison.py. Where should I call it. I only find:
network = nw_class() in get_network_from_plans.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants