from nudenet import NudeDetector
detector = NudeDetector()
Traceback(最近一次调用):文件"anti_porn_bot.py",第3行检测器= NudeDetector()文件"/usr/local/lib/python3.8/dist-packages/nudenet/detector.py",第57行,在initself.detection_model = onnxruntime. interencesession (checkpoint_path)文件"/usr/local/lib/python3.8/dist_packages/onnxruntime/capi/onnxruntime_interence_collection .py",第347行,在init自我。_create_interence_session (providers, provider_options, disabled_optimizers)文件"/usr/local/lib/python3.8/dist_packages/onnxruntime/capi/onnxruntime_interence_collection .py",第384行,在_create_interence_sessionsess = c . interencesession (session_options, self. properties)_model_path, True, self._read_config_from_modelonnxruntime.capi.onnxruntime_pybind11_state。InvalidProtobuf: [ONNXRuntimeError]: 7: INVALID_PROTOBUF: Load model from/root/.NudeNet/detector_v2_default_checkpoint。onnx failed:Protobuf解析失败。
我该如何解决这个问题
这里有一个有用的解决方案:
不使用detector_v2_default_checkpoint_back。在onnx上,您可以将其替换为以下文件:https://github.com/notAI-tech/NudeNet/releases/download/v0/detector_v2_default_checkpoint.onnx
我在论坛的一个帖子里发现了这个链接:https://forum.opencv.org/t/unable-to-import-onnx-model/3730
希望这能解决你的问题!