Moondra
Moondra

Reputation: 4511

Speeding up loading a model in Keras?

Is there a way to speed up loading a model in Keras? I'm using a transfer-learned inception model. It seems to take 13 seconds to load a model from my experiences.

I want to load deploy some models onto smart phones. Using Tensorflow as backend.

start = time.time()
path = r'C:\Users\Moondra\Desktop\2017-12-20_10.hdf5'
labels = os.listdir(r'C:\Users\Moondra\Desktop\FISHES_MAIN')
model = load_model(path)

print(time.time() - start)

output

12.808000087738037

Upvotes: 2

Views: 1362

Answers (1)

greenkode
greenkode

Reputation: 3996

I found that calling load_model with compile=False sped it up. My times went down from 12-15 seconds to about 2-3 seconds on average.

load_model(path, compile=False)

Upvotes: 2

Related Questions