notAI-tech / NudeNet

Lightweight nudity detection
https://nudenet.notai.tech/
GNU Affero General Public License v3.0
1.66k stars 335 forks source link

ONNX Model wont load #136

Closed annee2009 closed 6 months ago

annee2009 commented 6 months ago

Traceback (most recent call last): File "/nudedetection_test.py", line 2, in nude_detector = NudeDetector() File "C:\Program Files\Python36\lib\site-packages\nudenet\nudenet.py", line 115, in init providers=C.get_available_providers() if not providers else providers, File "C:\Program Files\Python36\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 335, in init self._create_inference_session(providers, provider_options, disabled_optimizers) File "C:\Program Files\Python36\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 368, in _create_inference_session sess = C.InferenceSession(session_options, self._model_path, True, self._read_config_from_model) onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL : Load model from C:\Program Files\Python36\lib\site-packages\nudenet\best.onnx failed:D:\a_work\1\s\onnxruntime\core/graph/model_load_utils.h:57 onnxruntime::model_load_utils::ValidateOpsetForDomain ONNX Runtime only guarantees support for models stamped with official released onnx opset versions. Opset 17 is under development and support for this is limited. The operator schemas and or other functionality may change before next ONNX release and in this case ONNX Runtime will not guarantee backward compatibility. Current official support for domain ai.onnx is till opset 15.

nudenet 3.0.8 numpy 1.19.5 onnxruntime 1.10.0 opencv-python-headless 4.6.0.66 scikit-build 0.16.7

Edit:

If I use onnxruntime 1.7.0, I'll get: sess = C.InferenceSession(session_options, self._model_path, True, self._read_config_from_model) onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL : Load model from C:\Program Files\Python36\lib\site-packages\nudenet\best.onnx failed:D:\a_work\1\s\onnxruntime\core\graph\model.cc:111 onnxruntime::Model::Model Unknown model file format version.

bedapudi6788 commented 6 months ago

can you reproduce on colab and share?

annee2009 commented 6 months ago

I did a clean reinstall of Python (3.10.11) and it works just fine for me now