GantMan/nsfw_model

Cannot load the saved_model.h5 in mobilenet_v2_140_224.1 and nsfw_mobilenet_v2_140_224

dongyang2333 opened this issue · 4 comments

I tried load model use this code.
from tensorflow.keras.models import load_model
savedModel = load_model(
'mobilenet_v2_140_224 /saved_model.h5', custom_objects={"kerasLayer": tensorflow_hub.KerasLayer}
) #model 2
I got this error OSError: SavedModel file does not exist at: /mobilenet_v2_140_224/saved_model.h5/{saved_model.pbtxt|saved_model.pb}.

me too

i got request url error

If you look at the error message, you'll see it's interpreting mobilenet_v2_140_224/saved_model.h5 as a directory entry, and looking for either a file named saved_model.pbtxt or a file named saved_model.pb within that directory. You need to change the string to just the directory name, which should just be mobilenet_v2_140_224 like this:

from tensorflow.keras.models import load_model
savedModel = load_model(
    'mobilenet_v2_140_224', custom_objects={"kerasLayer": tensorflow_hub.KerasLayer}
)

If this is still a problem, please provide the version of nsfw_detector that you're using, your Python version, your Python platform, and a code example of how you're invoking nsfw_detector, and reopen the issue.

rovide the version of n

Have you solved this problem yet?