-
Notifications
You must be signed in to change notification settings - Fork 398
Description
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}")