notAI-tech / NudeNet

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

Segmentation fault (core dumped) pthread_setaffinity_np failed #108

Open htoohtoowai opened 2 years ago

htoohtoowai commented 2 years ago

I cann't run in server. My server is 8cpu 16ram testing vps in Canada. This project is fine in local. (venv) root@trtest1:/home/nudeProject# python demoClassify.py Downloading the checkpoint to /root/.NudeNet/classifier_model.onnx MB100% (80.0 of 80.0) |#############################################################################################################################################| Elapsed Time: 0:00:00 Time: 0:00:00 Succefully Downloaded to: /root/.NudeNet/classifier_model.onnx Traceback (most recent call last): Segmentation fault (core dumped) (venv) root@trtest1:/home/nudeProject# python demoClassify.py Traceback (most recent call last): File "demoClassify.py", line 11, in classifier = NudeClassifier() File "/home/nudeProject/venv/lib/python3.7/site-packages/nudenet/classifier.py", line 37, in init self.nsfw_model = onnxruntime.InferenceSession(model_path) File "/home/nudeProject/venv/lib/python3.7/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 283, in init self._create_inference_session(providers, provider_options, disabled_optimizers) File "/home/nudeProject/venv/lib/python3.7/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 310, in _create_inference_session sess = C.InferenceSession(session_options, self._model_path, True, self._read_config_from_model) RuntimeError: /onnxruntime_src/onnxruntime/core/platform/posix/env.cc:142 onnxruntime::{anonymous}::PosixThread::PosixThread(const char, int, unsigned int ()(int, Eigen::ThreadPoolInterface), Eigen::ThreadPoolInterface, const onnxruntime::ThreadOptions&) pthread_setaffinity_np failed

Segmentation fault (core dumped) (venv) root@trtest1:/home/nudeProject# ls core.45476 core.45494 demoClassify.py venv (venv) root@trtest1:/home/nudeProject# ++++++++++++ tensorflow==1.15 nudenet --upgrade ubuntu 20.04.1 Code Example

Import module

from nudenet import NudeClassifier import imageio from PIL import Image

initialize classifier (downloads the checkpoint file automatically the first time)

classifier = NudeClassifier()

A. Classify single image

print(classifier.classify('/media/classification/sexy.jpg'))