Skip to content

Missing custom trainer nnUNetTrainer_4000epochs_NoMirroring.py when building exe with PyInstaller #506

@evamonclus

Description

@evamonclus

Hello,

I’m trying to generate an executable of the project using PyInstaller, but I encounter the following error when running the built exe:

RuntimeError: Unable to locate trainer class nnUNetTrainer_4000epochs_NoMirroring in nnunetv2.training.nnUNetTrainer. Please place it there (in any .py file).

It seems that nnUNetTrainer_4000epochs_NoMirroring is a custom trainer that isn’t part of the official nnU-Net package and is not included in this repository. Could you please share the corresponding .py file or provide instructions on how to recreate it so that the executable can run correctly?

Thank you for your help!

I also copy the Python script used for generating the executable:

import nibabel as nib
from totalsegmentator.python_api import totalsegmentator
#from nnunetv2.training.nnUNetTrainer.nnUNetTrainer_4000epochs_NoMirroring import nnUNetTrainer_4000epochs_NoMirroring
import argparse
from pathlib import Path

if name == "main":
parser = argparse.ArgumentParser(description="Call TotalSegmentator in folder")
parser.add_argument("base_path", type=str, help="Path to the base folder containing the nifti.")
args = parser.parse_args()
base_path = Path(args.base_path)
input_file = base_path / "volume_in_to_segm.nii.gz"
output_file = base_path / "volume_totalSegmentator_out"
print(f"This is the filename: {input_file}")
device = "cpu" # "cpu" or "gpu"
task = "total"
totalsegmentator(input_file, output_file, fast=True, ml=True, task=task, device=device)
print(f"Segmentation saved in: {output_file}")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions