Skip to content
Advertisement

Tag: keras

AttributeError: module ‘keras.preprocessing.image’ has no attribute ‘img_to_array’

I have added following libraries and half part of the code is executing. In second half I get this error. Libraries added: Error: AttributeError: module ‘keras.preprocessing.image’ has no attribute ‘img_to_array’ I was following this code and changes the libraries too still can’t resolve the issue. https://www.analyticsvidhya.com/blog/2021/06/k-means-clustering-and-transfer-learning-for-image-classification/ Answer It has now moved to tf.keras.utils.img_to_array. See the docs

Save keras preprocessing layer

I have a model where I’m doing different preprocessing, outside the model itself. One part of the preprocessing is using a category encoder based on keras with: I apply this than with to my pandas dataframe. Now I want to store my model and in order to store the model I also have to store the 2 preprocessing layers cat_index

Obtaining the parameters of layers after concatenation in Keras

I’m trying to get the output and input parameters after concatenation in keras, more specifically in “concat_” and “hidden 6” layers. Is there way to obtain the parameters by layer name? Also, is there any way to run the model (after training) until the concatenation point? Answer You could give each layer that you want to later retrieve, a specific

Reshaping problem (Input to reshape is a tensor with 10 values, but the requested shape has 1)

I’m trying to recreate this work using my own dataset: https://www.kaggle.com/code/amyjang/tensorflow-pneumonia-classification-on-x-rays/notebook I’ve made some slight tweaks to the code to accommodate my data but I don’t think that is what is causing an issue here; it could be though of course. My code: And the error: I can gather from the error that I have a mismatch in resizing, I

Model was constructed with shape (None, 65536) but it was called on an input with incompatible shape (None, 65536, None)

For reference the full error is here: I am using kymatio to classify audio signals. Before constructing the model I use tensorflow’s tf.keras.utils.audio_dataset_from_directory to create the training and testing sets. The audio samples are of shape (65536,) before the sets are created. To create the sets I use the following code: The element_spec of the train_dataset is (TensorSpec(shape=(None, 65536, None),

Advertisement