4

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

Pablo Cordon
  • 249
  • 2
  • 4
  • 11
  • I'm having the same issue even after downgrading opencv, just as you did. Were you able to find a solution? – Nahuel Mel Jun 22 '22 at 18:33

1 Answers1

9

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

Chandan Kumar
  • 128
  • 1
  • 9
  • Hello, I'm running NudeNet on a Google Colab notebook. How would I go about replacing the .onnx files so I too can get around this issue. Thank you for your time – Nahuel Mel Jun 22 '22 at 18:32
  • 2
    I had the same problem and to solve it I cloned the project locally and changed the download link in the code to the locally downloaded file. – Virgaux Pierre Jul 27 '22 at 12:54
  • Hello Chandan, how did you find this ? I'm curious to know what was broken and how you fixed it. Thanks a lot – ichafai Sep 13 '22 at 14:14