GantMan / nsfw_model

Keras model of NSFW detector
Other
1.8k stars 279 forks source link

ValueError: saved_model_path must be the valid directory of a saved model to load. #163

Open chaserRen opened 4 months ago

chaserRen commented 4 months ago

Hi, Here is my code:

from nsfw_detector import predict model = predict.load_model("./nvme/renzhifei/nsfw/model/mobilenetv2.h5") probs = predict.classify(model, '/nvme/renzhifei/nsfw/images_ko/') print(probs)

I downloaded .h5 file from this url load1 png I unzipped the file and renamed file “saved_model_weights.h5” as "mobilenetv2.h5"

I put .h5 file in the path: "./nvme/renzhifei/nsfw/model/" nsfw png

When I run my python file, it notes as following: 2024-07-10 16:51:02.466112: I tensorflow/core/util/port.cc:110] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable TF_ENABLE_ONEDNN_OPTS=0. 2024-07-10 16:51:02.468141: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used. 2024-07-10 16:51:02.514406: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used. 2024-07-10 16:51:02.514847: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. To enable the following instructions: AVX2 AVX512F AVX512_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags. 2024-07-10 16:51:03.087415: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT Traceback (most recent call last): File "demo.py", line 3, in model = predict.load_model("./nvme/renzhifei/nsfw/model/mobilenetv2.h5") File "/home/qa-caif-cicd/renzhifei/nsfw_model/nsfw_detector/predict.py", line 54, in load_model raise ValueError("saved_model_path must be the valid directory of a saved model to load.") ValueError: saved_model_path must be the valid directory of a saved model to load.

I want to kown how to solve this problem?