3

I want to predict values by using the model I use this code

from keras.models import load_model
import multiprocessing
model = load_model('CNN_MODEL.hdf')
def Net(x):
    print("test")
    return model.predict(x)

X_test=.....(a list )
pool=multiprocessing.Pool(processes=12)
Y=pool.map(Net,X_test)

pool.close()
pool.join()

But it's too slow . The out is

test test test ... test with 12 test and then Stuck. And my cpu is 36 core . How to solve it?

mqzhang
  • 39
  • 4
  • Does this answer your question? [Keras + Tensorflow and Multiprocessing in Python](https://stackoverflow.com/questions/42504669/keras-tensorflow-and-multiprocessing-in-python) – Zsolt Safrany Dec 23 '21 at 02:31

0 Answers0