you can try without optimizations but i do not thing is the issues
do you have try to show refult of get_spectrogram and chek if is the same value?
you can also try to trunk you model and check after eache layer if the result are equal
and found the layer that do a error
modeltruncate = Model(inputs=model.input, outputs=model.layers[x].output) #x is the number of the layer where you trunk
modeltruncate.summary()
predict=modeltruncate.predict(matrixTest); # your data set
print(predict)