Open NasaKHw opened 4 months ago
@NasaKHw can you reproduce in a colab and share the link?
sorry im not familiar with it, do we have to install onnx along with onnxrutime too?
thanks i saw it but i dont know how to work with it and how its going to help, i mean i have installed it on my own server with different tools and packages maybe there is an problem with them and not the project, i have installed it right and lunched it like 2 days ago and then i reinstalled the os after that i saw too many errors and solved them one by one to get it right and after all this is the last beast error dont know how to deal with it
i'll be so grateful if u can help me lunch it, i can share ssh access trought anydesk if u can provide me an email
Hey, please create a new clean python 3.10 conda environment and run pip install --upgrade nudenet
and try the same and paste here what's the output you got.
/
import os
import json
from nudenet import NudeDetector
# Initialize the NudeDetector
nude_detector = NudeDetector()
# Define the directory containing the images
image_directory = 'path_to_your_image_directory'
# Define the output file name
output_file = 'nudity_detection_results.json'
# Create a list to store all detection results
all_results = []
# Iterate through all files in the directory
for filename in os.listdir(image_directory):
if filename.endswith('.jpg') or filename.endswith('.png'):
# Detect nudity in the current image
image_path = os.path.join(image_directory, filename)
detections = nude_detector.detect(image_path)
# Store the filename and detection results in a dictionary
image_results = {
'filename': filename,
'detections': detections
}
# Append the dictionary to the list
all_results.append(image_results)
# Write the detection results to the output file in JSON format
with open(output_file, 'w') as f:
json.dump(all_results, f, indent=4)
print(f"Nudity detection results saved to {output_file}")
hello thanks for the great work im getting this error and i dont know why and what can i do , can someone help me out ?
output
Installing collected packages: onnxruntime Successfully installed onnxruntime-1.10.0 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv python3 check.py
Traceback (most recent call last): File "check.py", line 4, in
nude_detector = NudeDetector()
File "/usr/local/lib/python3.6/site-packages/nudenet/nudenet.py", line 115, in init
providers=C.get_available_providers() if not providers else providers,
File "/usr/local/lib64/python3.6/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 335, in init
self._create_inference_session(providers, provider_options, disabled_optimizers)
File "/usr/local/lib64/python3.6/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 368, 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 /usr/local/lib/python3.6/site-packages/nudenet/best.onnx failed:/onnxruntime_src/onnxruntime/core/graph/model_load_utils.h:47 void onnxruntime::model_load_utils::ValidateOpsetForDomain(const std::unordered_map<std::basic_string, int>&, const onnxruntime::logging::Logger&, bool, const string&, int) ONNX Runtime only guarantees support for models stamped with official released onnx opset versions. Opset 17 is under development and support for this is limited. The operator schemas and or other functionality may change before next ONNX release and in this case ONNX Runtime will not guarantee backward compatibility. Current official support for domain ai.onnx is till opset 15.
my pip list
public_html]# python3 -m pip list Package Version
absl-py 1.4.0 astunparse 1.6.3 cachetools 4.2.4 certifi 2024.2.2 charset-normalizer 2.0.12 cmake 3.28.1 dataclasses 0.8 distro 1.9.0 flatbuffers 23.5.26 gast 0.3.3 google-auth 1.35.0 google-auth-oauthlib 0.4.6 google-pasta 0.2.0 grpcio 1.48.2 h5py 2.10.0 idna 3.6 importlib-metadata 4.8.3 Keras-Preprocessing 1.1.2 Markdown 3.3.7 nudenet 3.0.8 numpy 1.19.5 oauthlib 3.2.2 onnxruntime 1.10.0 opencv-python-headless 4.9.0.80 opt-einsum 3.3.0 packaging 21.3 pip 21.3.1 protobuf 3.19.6 pyasn1 0.5.1 pyasn1-modules 0.3.0 pyparsing 3.1.1 requests 2.27.1 requests-oauthlib 1.3.1 rsa 4.9 scikit-build 0.16.7 scipy 1.4.1 setuptools 59.6.0 six 1.16.0 speedtest-cli 2.1.3 tensorboard 2.2.2 tensorboard-plugin-wit 1.8.1 tensorflow 2.2.0 tensorflow-estimator 2.2.0 termcolor 1.1.0 typing_extensions 4.1.1 urllib3 1.26.18 Werkzeug 2.0.3 wheel 0.37.1 wrapt 1.16.0 zipp 3.6.0