def predict_by_one(cube):
# load json and create model
json_file = open('model.json', 'r')
loaded_model_json = json_file.read()
json_file.close()
loaded_model = model_from_json(loaded_model_json)
# load weights into new model
loaded_model.load_weights("model.hdf5")
print("Loaded model from disk")
sgd = SGD(lr=0.01, decay=1e-6, momentum=0.9, nesterov=True)
loaded_model.compile(loss='categorical_crossentropy', optimizer=sgd,metrics=['accuracy'])
x = cube.reshape(-1,1,6,20,20)
print(x.shape)
result = loaded_model.predict(x,batch_size=10, verbose=0)
# print(result.shape)
# show result
for i in result:
print(i[0],i[1])
return result
评论列表
文章目录