The error i got: TypeError: plotImages() got an unexpected keyword argument ‘n_images’ Please do let me know if you have an idea. This is the code: Answer You defined the argument as nx_images in function definition, but doesn’t seem to use it anywhere in the code. Try changing it.
Tag: keras
Word2Vec + LSTM Good Training and Validation but Poor on Test
currently I’am training my Word2Vec + LSTM for Twitter sentiment analysis. I use the pre-trained GoogleNewsVectorNegative300 word embedding. The reason I used the pre-trained GoogleNewsVectorNegative300 because the performance much worse when I trained my own Word2Vec using own dataset. The problem is why my training process had validation acc and loss stuck at 0.88 and 0.34 respectively. Then, my confussion
Keras CNN Model Typevalue errors when using predict method
I am have a keras model that is supposed to take a (150, 150, 1) grayscale image as it’s input and output an array of length 8. Here is my model code: When I try to use the .predict() method, I get this error: I had an ANN (non-CNN) model running earlier that was working fine. When I did some
Keras Confusion Matrix does not look right
I am running a Keras model on the Breast Cancer dataset. I got around 96% accuracy with it, but the confusion matrix is completely off. Here are the graphs: And here is my confusion matrix: The matrix is saying that I have no true negatives and they’re actually false negatives, when I believe that it’s the reverse. Another thing that
How do I read two folders in a directory and combine them under one label using flow_from_directory?
Tensorflow/Keras I want to classify images into either “Circle”, “Square” or “Triangle”. I have a directory containing 6 folders with each shape having a separate “shaded” or “unshaded” folder. How can I combine them into one category? For example: shaded and unshaded circles will be given a label “0” using flow_from_directory. I will then feed this into my CNN model
How to import utils from keras_unet
I’m trying to add utils from keras_unet in google colab, but I have a problem. keras-unet init: TF version is >= 2.0.0 – using tf.keras instead of Keras ModuleNotFoundError Answer You must install keras-unet before importing as follows Let us know if the issue still persists. Thanks!
How does Tokenizer in tensorflow deal with out of vocabulary tokens if I don’t provide oov_token?
I didn’t get any error with that code even though I didn’t provide oov_token argument. I expected to get an error in test_tweets = tokenizer.texts_to_sequences(X_test) How does tensorflow deal with out of vocabulary words during the test time when you don’t provide the oov_token? Answer OOV words will be ignored / discarded by default, if oov_token is None:
Compile model which has different dimensions of output and labels (in Tensorflow)
Simplest examples which replicates the error: I understand, that in this case, output of model is (batch_size, 10) while my labels have (batch_size,) dimensions. This is why I use tf.nn.sparse_softmax_cross_entropy_with_logits. Before I can provide any kind of labels to this model, compilation fails with the following error: After some investigation, I see that compilation fails because tensorflow somehow thinks that
Extracting Transfer learning output from CNN Keras
How to take the intermediate Transfer learning output. ? Eg: Tried: Answer There’s an unresolved issue in Tensorflow on this problem. According to the issue, you need to pass inputs of both outer model and inner model to get the output of inner model.
Behavior of steps_per_epoch and validation_steps in Keras Model
I’m a little bit confused on the behavior of steps_per_epoch and validation_steps in the fit function. More particularly, if I set steps_per_epoch to be smaller than total_records/batch_size, would it be that a) the model only trains on the same subset of training data for every epoch or b) the model will use different training data for each epoch and will