I am new to AI/ML stuff. I’m learning TensorFlow. In some tutorial, I noticed that the input_shape argument of a Conv2D layer was specified only for the first. Code looked kinda like this: In many examples, not only in the above, the instructor didn’t include that argument in there. Is there any reason for that? Answer The next layers derive
Tag: tensorflow
Python Tensorflow Shape Mismatch (WaveNet)
I was trying to run a WaveNet, which is specified in https://github.com/mjpyeon/wavenet-classifier/blob/master/WaveNetClassifier.py. Part of my code is as follows: Here, self.input_shape=X_train.shape and self.output_shape=(11,) It successfully printed out the model’s summary, but was outputting the following error: However, my X_train has a shape of (19296, 110250). I was trying to figure out on why the X_train has been reshaped from (19296,
Python Keras ValueError: Data cardinality is ambiguous
I am attempting to make a model that can predict whether a credit card transaction was fraudulent or not. My dataset is available on Kaggle. Everything works up to when I fit my model, when I get this error: Could someone help me figure out what’s wrong? Answer The main issue with your code is that the model’s input shape
TypeError: expected str, bytes or os.PathLike object, not JpegImageFile (or PngImageFile) in Django
When I am uploading a picture to check a picture according to tensorflow h5 model, I am loading the image using load_model of tensorflow.keras.models but it is not accepting. For JPG, it is showing TypeError: expected str, bytes or os.PathLike object, not JpegImageFile and for PNG, it is showing as TypeError: expected str, bytes or os.PathLike object, not PngImageFile. What
Loading YOLO: invalid index to scalar variable
Getting an error for IndexError: invalid index to scalar variable on the yolo_layers line. This code won’t work on my Jupyter notebook but will run fine on google collab. No idea why. Could be my python version? Answer It’s may caused by the different versions of cv2. The version of cv2 module with CUDA support will give you a 2-D
How to correctly pass a split function to TextVectorization layer
I’m defining a custom split callable for TextVectorization like this: resulting in: as seen above the split function is working correctly outside of the TextVectorization layer but failes when passed as a callable Answer Your split_slash function does not seem to properly tokenize the phrases. It is probably because your TextVectorization layer strips your phrases of all punctuation including /
Compute gradients across two models
Let’s assume that we are building a basic CNN that recognizes pictures of cats and dogs (binary classifier). An example of such CNN can be as follows: Let’s also assume that we want to have the model split into two parts, or two models, called model_0 and model_1. model_0 will handle the input, and model_1 will take model_0 output and
ImportError: cannot import name ‘BatchNormalization’ from ‘keras.layers.normalization’
i have an import problem when executing my code: Keras version: 2.6.0 Tensorflow: 2.6.0 Python version: 3.9.7 The library it is installed also with Do you have any ideas? library path Answer You’re using outdated imports for tf.keras. Layers can now be imported directly from tensorflow.keras.layers:
How to continue training with checkpoints using object_detector.EfficientDetLite4Spec tensorflow lite
Preciously I have set my EfficientDetLite4 model “grad_checkpoint=true” in config.yaml. And it had successfully generated some checkpoints. However, I can’t figure out how to use these checkpoints when I want to continue training based on them. Every time I train the model it just start from the beginning, not from my checkpoints. The following picture shows my colab file system
Gradient exploding problem in a graph neural network
I have a gradient exploding problem which I couldn’t solve after trying for several days. I implemented a custom message passing graph neural network in TensorFlow which is used to predict a continuous value from graph data. Each graph is associated with one target value. Each node of a graph is represented by a node attribute vector, and the edges