Page 1 of 3
NudeNet - automatic censoring AI software
Posted: Sat Mar 27, 2021 3:10 pm
by Miss_Leah.
Hey guys!
I was wondering if anyone had any experiences with NudeNet. I was hoping to use it to streamline the progress for a current project, but I'm not too skilled yet, currently wrapping up my first year studying computer science. If anyone could share they're knowledge/take a quick look at it to see if they can figure it out, I would love to chat
https://github.com/notAI-tech/NudeNet
Love, Leah

Re: NudeNet - automatic censoring AI software
Posted: Sat Mar 27, 2021 3:58 pm
by kerkersklave
Hi Leah,
it quickly took a look at it as it seemed quite interesting.
I tried it on one random picture and it seems to work very well. I used the installation via pip which at least on Linux worked like a charm. What is the project you're working on? And how can I help you?
Re: NudeNet - automatic censoring AI software
Posted: Sat Mar 27, 2021 6:08 pm
by Miss_Leah.
kerkersklave wrote: Sat Mar 27, 2021 3:58 pm
Hi Leah,
it quickly took a look at it as it seemed quite interesting.
I tried it on one random picture and it seems to work very well. I used the installation via pip which at least on Linux worked like a charm. What is the project you're working on? And how can I help you?
Thanks for taking a look at it :)
Do you mind sending the files from the folder you used to run it? I get the detector to work and analyze the photos, but when I run the censor method I get an error say the "modelproto does not have a graph" or something like that. Googling it presents me with all sorts of nonsense I don't understand, so I'm at a loss here.
Im currently fiddling with a tease ai personality, and was hoping to do a bit of censoring in there, not sure how its gonna work, but either way it seems like its a great tool, that can censor videos as well, as far as I understand
Re: NudeNet - automatic censoring AI software
Posted: Sat Mar 27, 2021 6:48 pm
by kerkersklave
I've tested it on the following picture. It censors face, breasts, and pussy. I've tried other pictures but those are private
Which API are you using? The python one as well? I have not seen that error message.
Re: NudeNet - automatic censoring AI software
Posted: Sat Mar 27, 2021 6:58 pm
by bonsec
I used this as well for a project, however I only used their detect method and did my own censoring in frontend javascript.
I had a quick look at the error and it comes from the detector model, so if detect is working fine but censor is giving that error, I suspect the args passed to censor had some mixup.
Re: NudeNet - automatic censoring AI software
Posted: Sat Mar 27, 2021 7:40 pm
by Miss_Leah.
kerkersklave wrote: Sat Mar 27, 2021 6:48 pm
I've tested it on the following picture. It censors face, breasts, and pussy. I've tried other pictures but those are private
Which API are you using? The python one as well? I have not seen that error message.
I was actually mainly referring to the python file, I'm unsure if I'm writing the code right, I haven't really gotten the hang of interpreting other peoples code, and its been a short while since I dabbled with python last, do you mind sending it?
Re: NudeNet - automatic censoring AI software
Posted: Sat Mar 27, 2021 7:42 pm
by Miss_Leah.
bonsec wrote: Sat Mar 27, 2021 6:58 pm
I used this as well for a project, however I only used their detect method and did my own censoring in frontend javascript.
I had a quick look at the error and it comes from the detector model, so if detect is working fine but censor is giving that error, I suspect the args passed to censor had some mixup.
I'm passing the same args as with the detect method, so it shouldn't be any issue, but maybe im wrong, literally copied the code from a guide, and changed the filenames to match. The guide in question is the following
https://ourcodeworld.com/articles/read/ ... -in-python
Re: NudeNet - automatic censoring AI software
Posted: Sat Mar 27, 2021 8:46 pm
by kerkersklave
The guide matches what I did. Can you maybe copy a minimal code example that causes the error? Best just copy it, sometimes one can read their own code over and over again without spotting a subtle problem or difference.
Re: NudeNet - automatic censoring AI software
Posted: Sat Mar 27, 2021 8:49 pm
by kerkersklave
Miss_Leah. wrote: Sat Mar 27, 2021 7:40 pm
I was actually mainly referring to the python file, I'm unsure if I'm writing the code right, I haven't really gotten the hang of interpreting other peoples code, and its been a short while since I dabbled with python last, do you mind sending it?
My code looks like this:
Code: Select all
from nudenet import NudeDetector
detector = NudeDetector()
detector.censor('test.jpeg', out_path = 'out.jpeg')
Re: NudeNet - automatic censoring AI software
Posted: Sat Mar 27, 2021 9:05 pm
by Miss_Leah.
kerkersklave wrote: Sat Mar 27, 2021 8:49 pm
Miss_Leah. wrote: Sat Mar 27, 2021 7:40 pm
I was actually mainly referring to the python file, I'm unsure if I'm writing the code right, I haven't really gotten the hang of interpreting other peoples code, and its been a short while since I dabbled with python last, do you mind sending it?
My code looks like this:
Code: Select all
from nudenet import NudeDetector
detector = NudeDetector()
detector.censor('test.jpeg', out_path = 'out.jpeg')
My code looks like the following
Code: Select all
from nudenet import NudeDetector
from nudenet import NudeClassifier
detector = NudeDetector()
detector.censor(
'./image1.jpeg',
out_path='./image1_censored.jpeg',
visualize=False
)
Re: NudeNet - automatic censoring AI software
Posted: Sat Mar 27, 2021 9:09 pm
by Miss_Leah.
Copying your code didn't seem to do anything for me either.. /:
Re: NudeNet - automatic censoring AI software
Posted: Sat Mar 27, 2021 9:20 pm
by kerkersklave
Your code works fine for me, can't see any problem either.
This error comes somewhere from within the neural net engine from googling it. Sounds like the model has not been loaded properly. From looking at the code of censor() it just calls detect() and then manipulates the images.
Did you try calling detect() directly and does that work? (Not quite sure form your previous posts).
Can you copy the complete error message including the stack trace?
Re: NudeNet - automatic censoring AI software
Posted: Sat Mar 27, 2021 9:27 pm
by Miss_Leah.
kerkersklave wrote: Sat Mar 27, 2021 9:20 pm
Your code works fine for me, can't see any problem either.
This error comes somewhere from within the neural net engine from googling it. Sounds like the model has not been loaded properly. From looking at the code of censor() it just calls detect() and then manipulates the images.
Did you try calling detect() directly and does that work? (Not quite sure form your previous posts).
Can you copy the complete error message including the stack trace?
Aha, detect() throws the same error, here's the complete error message
Code: Select all
Traceback (most recent call last):
File "test.py", line 3, in <module>
detector = NudeDetector()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/nudenet/detector.py", line 57, in __init__
self.detection_model = onnxruntime.InferenceSession(checkpoint_path)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 280, in __init__
self._create_inference_session(providers, provider_options)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 307, 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 /Users/leah/.NudeNet/detector_v2_default_checkpoint.onnx failed:/Users/runner/work/1/s/onnxruntime/core/graph/model.cc:101 onnxruntime::Model::Model(onnx::ModelProto &&, const onnxruntime::PathString &, const onnxruntime::IOnnxRuntimeOpSchemaRegistryList *, const logging::Logger &) ModelProto does not have a graph.
Re: NudeNet - automatic censoring AI software
Posted: Sat Mar 27, 2021 9:35 pm
by Miss_Leah.
Aha, even my noob ass can see that its the constructor that throws the error now, not that it explains much to me
Re: NudeNet - automatic censoring AI software
Posted: Sat Mar 27, 2021 9:57 pm
by kerkersklave
When I first ran the detector, it did download the model file and put it in
Code: Select all
.NudeNet/detector_v2_default_checkpoint.onnx
in my home directory.
Does that file exist? Should be about 140MB.