GantMan / nsfw_model

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

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

Closed dongyang2333 closed 1 year ago

dongyang2333 commented 3 years ago

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}.

Tyrone1523 commented 2 years ago

me too

i got request url error

Fincap commented 2 years ago

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}
)
colindean commented 1 year ago

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.

Note-Liu commented 1 year ago

rovide the version of n

Have you solved this problem yet?