getNNUnet has been tested on Linux (Ubuntu 22.04)! It should work out of the box!
We support GPU (recommended) and CPU
We strongly recommend that you install nnU-Net in a virtual environment! Pip or anaconda (e.g. pip or conda install) are both recommened.
Use a recent version of Python! 3.9 or newer is guaranteed to work!
nnU-Net v2 can coexist with nnU-Net v1! Both can be installed at the same time.
- Install nnU-Net, please following the instruction shown in the following website: https://github.com/MIC-DKFZ/nnUNet/blob/master/documentation/installation_instructions.md
pip install nnunetv2
- Install ONNX libary either with pip or anaconda using the following:
pip install onnx
or
conda install -c conda-forge onnx
-
Download and import getNNUnet.py and called getNNUNet2ONNX(...), example can be found in the code
-
Note that you can easily convert a .onnx model to pytorch by using "onnx2torch" library:
pip install onnx2torch
or
conda install -c conda-forge onnx2torch
For example:
import torch
from onnx2torch import convert
# Path to ONNX model
onnx_model_path = '/some/path/mobile_net_v2.onnx'
# You can pass the path to the onnx model to convert it or...
torch_model_1 = convert(onnx_model_path)
# Or you can load a regular onnx model and pass it to the converter
onnx_model = onnx.load(onnx_model_path)
torch_model_2 = convert(onnx_model)
Please used "getNNUnet.py" and import getNNUNet2ONNX
Please used "modiNNUNET.py" and import modifyNNUNET
- Only work with 3D
- We assumed that your model are trained using CUDA