Categories
Mastering Development

Boolean Labels Training with Keras causes the error “Please provide data which shares the same first dimension”

So, here is what I am trying to do. My model has to receive a number of training samples, each a conjunction of Boolean literals (i.e. a vector of 0 or 1s) assigned with a truth value. Learning from the samples, it must be able to receive some test vector and determine its truth value. […]

Categories
Mastering Development

how to change layer shape in keras?

I have a decoder that has output (28,28,1) I am trying that the output of a decoder has (32,32,3) how can i achieve that? i am using colab with gpu t4 latent_dim = 20 encoder_inputs = keras.Input(shape=(28, 28, 1)) x = layers.Conv2D(32, 3, activation="relu", strides=2, padding="same")(encoder_inputs) x = layers.Conv2D(64, 3, activation="relu", strides=2, padding="same")(x) x = […]

Categories
Mastering Development

Tensorflow throwing ValueError() after making it to first epoch

I’m experiencing a “ValueError: Shapes (None, None) and (None, 8, 8, 7) are incompatible” anytime I am training my model in Tensorflow. So far: history = model.fit(train_batches, steps_per_epoch=train_steps, class_weight=class_weights, validation_data=validation_batches, validation_steps=val_steps, epochs=30, verbose=1, callbacks=callbacks_list ) gives this stacktrace: Traceback (most recent call last): File “/home/brian/Desktop/381-deep-learning/main.py”, line 410, in <module> epochs=30 File “/home/brian/Desktop/381-deep-learning/venv/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py”, line 324, in […]

Categories
Mastering Development

how to reduce learning rate on train correctly

I am training a neural network and I want to reduce the learning rate while training. I am currently using ReduceLROnPlateau function provided by keras. But then it reaches the patience factor, it simply stops and don’t continue training. I want to reduce the learning rate and keep the net training. Here is my code. […]

Categories
Mastering Development

How to understand and debug the error inside keras.model.fit?

I am trying to implement a keras LSTM. I am getting an error inside keras.model.fit. I am not understanding what this error means. I hope you guys can help me? My code is given below – print(x_train.shape) print(y_train.shape) word_input = Input(shape=(mxlen,), dtype=”int32″, name=”word_input”) x1 = Embedding(len(vocab), 100, input_length=mxlen, weights=[embeddings], trainable=False)(word_input) x1 = LSTM(100)(x1) y = […]

Categories
Mastering Development

TRANSIENT_ERROR for TPU in Google Colab

I’m trying to run a lrcn keras model on TPUs with tensorflow 2.0. The model and generator work on CPU/GPU but I included them for reference. I also initialize the TPU and it is visible and everything looks good except for when I run .fit(): def frame_generator(self, batch_size, train_test, data_type): “””Return a generator that we […]

Categories
Development

Cross Validation with coco data format json files

I am a newbie ML learner and trying semantic image segmentation on google colab with COCO data format json and lots of images on google drive. I am splitting an exported json file into 2 jsons (train/validate with 80/20 ratio) every time I receive new annotation data. But this is getting tiring since I have […]

Categories
Development

Siamese LSTM for semantic sentence similarity doesn’t improve validation accuracy

I want to find the semantic sentence similarity between a dataset of two sentences. As a said in the title, the validation accuracy doesn’t improve. I’m stuck at an accuracy of 0.25 to 0.30. First, I used English Wikipedia dump to create a word2vec matrix. Then I used the function text_to_sequence to convert my sentences […]

Categories
Development

How to do leave one out cross validation with tensor-flow (Keras)?

I have 20 subjects and I want to use the leave one out cross-validation when I train the model that has implemented with Tensorflow. I follow some instructions and finally here is my pseudo code: for train_index, test_index in loo.split(data): print(“TRAIN:”, train_index, “TEST:”, test_index) train_X=np.concatenate(np.array([data[ii][0] for ii in train_index])) train_y=np.concatenate(np.array([data[ii][1] for ii in train_index])) test_X=np.concatenate(np.array([data[ii][0] […]

Categories
Development

understanding the output of Sagemaker Object Detection prediction

I need help understanding the output of the Amazon Sagemaker object-detection algorithm. Here’s my underlying goal: identify when a ping pong ball is in play and mark it’s location in an image frame. Sample images from a video feed: Steps so far: 1. I’ve taken n-video frames from a ping pong match. I used RectLabel […]