notAI-tech / NudeNet

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

Re-initialize model, onnxruntime log warning #73

Closed Andrew-Chen-Wang closed 3 years ago

Andrew-Chen-Wang commented 3 years ago

Describe the bug and error messages (if any)

Logged onnx saying:

2021-01-27 23:09:24.889319 [W:onnxruntime:, graph.cc:1069 Graph] Initializer block1_conv1_bn/keras_learning_phase:0 appears in graph inputs and will not be treated as constant value/weight. This may prevent some of the graph optimizations, like const folding. Move it out of graph inputs if there is no need to override it, by either re-generating the model with latest exporter/converter or with the tool onnxruntime/tools/python/remove_initializer_from_input.py.

**The code snippet which gave this error***

from nudenet import NudeClassifier

if __name__ == "__main__":
    classifier = NudeClassifier()
    file = str(Path(__file__).parent.absolute() / "file.jpeg")
    print(classifier.classify(file))

Specify versions of the following libraries

  1. nudenet (main branch, latest)
All packages:
``` certifi 2020.12.5 chardet 4.0.0 cycler 0.10.0 decorator 4.4.2 idna 2.10 imageio 2.9.0 kiwisolver 1.3.1 matplotlib 3.3.3 memory-profiler 0.58.0 networkx 2.5 NudeNet 2.0.7 numpy 1.19.5 onnxruntime 1.6.0 opencv-python-headless 4.5.1.48 Pillow 8.1.0 pip 21.0 progressbar2 3.53.1 protobuf 3.14.0 psutil 5.8.0 pydload 1.0.9 pyparsing 2.4.7 python-dateutil 2.8.1 python-utils 2.5.5 PyWavelets 1.1.1 requests 2.25.1 scikit-image 0.18.1 scipy 1.6.0 setuptools 41.2.0 six 1.15.0 tifffile 2021.1.14 urllib3 1.26.3 ```

Expected behavior

No logs of needing to rework the models

Screenshots

Afterwards, the actual results printed just fine.

bedapudi6788 commented 3 years ago

@Andrew-Chen-Wang that warning can be safely ignored.

seizoux commented 3 years ago

@Andrew-Chen-Wang that warning can be safely ignored.

there is a way to remove it? it's so weird see that message in the shell every 5 min

Andrew-Chen-Wang commented 3 years ago

If it's annoying, here some resources @Daishiky : https://stackoverflow.com/a/9134842 Hope this helps

nonetrix commented 3 years ago

If it's annoying, here some resources @Daishiky : https://stackoverflow.com/a/9134842 Hope this helps

thx might use this else where to hide the fact my code is shitting itself every 20 seconds.