Search code examples
pythongoogle-colaboratoryonnx

Python NSFW detection module nudenet not longer working?


I have been using the python module nudenet for my final degree project. I'm using google colab to run it.

It worked correctly and without any problem during this last months until yesterday, when I tried to import it, this error happenend:

!pip install --upgrade nudenet
from nudenet import NudeClassifier

ImportError: cannot import name '_registerMatType' from 'cv2.cv2' (/usr/local/lib/python3.7/dist-packages/cv2/cv2.cpython-37m-x86_64-linux-gnu.so)

I tried to solve this error by downgrading opencv-python-headless to a previous version

!pip uninstall opencv-python-headless==4.5.5.62 
!pip install opencv-python-headless==4.5.1.48

But then, when I load the classifier this error appears:

classifier = NudeClassifier()


Downloading the checkpoint to /root/.NudeNet/classifier_model.onnx
MB| |#                                                | 0 Elapsed Time: 0:00:00
Content-length not found, file size cannot be estimated.
Succefully Downloaded to: /root/.NudeNet/classifier_model.onnx

InvalidProtobuf: [ONNXRuntimeError] : 7 : INVALID_PROTOBUF : Load model from /root/.NudeNet/classifier_model.onnx failed:Protobuf parsing failed.

I have also tried to downgrade the version of the module nudenet, and still nothing works.

Thank you in advance.

This is the link for the module in github


Solution

  • replace the rile classifier_model.onnx with nudenet classifier and file classifier_lite.onnx with nudenet lite classifier