TotalSegmentator icon indicating copy to clipboard operation
TotalSegmentator copied to clipboard

Unable to locate trainer class nnUNetTrainerNoMirroring when using TotalSegmentator in packaged PySide6 application

Open AtlasCodex opened this issue 1 year ago • 1 comments

Hello,

I am developing a desktop application using PySide6 and packaging it as an exe using PyInstaller. The application uses TotalSegmentator to perform CT segmentation. However, when running the packaged executable, I encounter the following error during the segmentation process:

Unable to locate trainer class nnUNetTrainerNoMirroring in nnunetv2training.nnUNetTrainer, Please place it there (in any .py file)!

I have verified that when packaging the executable, the necessary libraries such as TotalSegmentator, torch, and nnUNetv2 were included. In my hiddenimports section, I have explicitly added these dependencies, but the error persists.

Here are the steps I followed:

Developed the application using PySide6. Used PyInstaller with the appropriate hiddenimports to include the necessary libraries. Ran the application, and during the segmentation phase, the above error occurs. Environment:

TotalSegmentator version: 2.4.0 nnUNetv2 version: 2.5.1 torch version: 2.3.1 Operating system: Windows 10 Could you please provide guidance on what might be causing this issue and how to resolve it? Is there a specific way I should handle this trainer class when packaging the application, or is there something missing in my packaging process?

Thank you for your help!

AtlasCodex avatar Oct 15 '24 03:10 AtlasCodex

the same error, directly run in pycharm or in command line is ok, but failed in packaging with pyinstaller. So I exported all the models to onnx format, configuration files ,and implemented all manipulations by myself, that works.

recreateme avatar Dec 17 '24 07:12 recreateme