convert DeepFaceLab XSegNet's *.npy weights to onnx file. Inference time is optimized from 500ms to 90ms.
- put DeepFaceLab XSegNet weights to weights folder, such as
weights/XSeg_256.npy
. - Set XSegNet class default augment
export_weights=True
. - Then run
python test_seg.py
to generate tensorflow SavedModel format checkpoint file tosaved_model
directory. - install tf2onnx library, run
pip install tf2onnx
. - convert model to onnx file,
python -m tf2onnx.convert --saved-model .\saved_model\ --output xseg.onnx --tag serve
. - (optinal) install onnxsim
pip install onnxsim
and runonnxsim .\xseg.onnx .\xseg.sim.onnx
.
see test_seg_onnx.py
.
Because of Conv2d_transpose requires asymmetric padding which the CUDA EP currently does not support #11312, XSegNet OnnxRuntime Conv2d_transpose layer does not support CudaExcuation.