Keras tensorflow: InvalidArgumentError: Node 'IsVariableInitialized_2196' - keras

I am trying to train a segmentation model, tried fit_generator and also on a single batch as:
autoencoder.fit(x,y)
x and y has shape same as of the model input and output, but it gives following error.
InvalidArgumentError: Node 'IsVariableInitialized_2196': Unknown input
node 'batch_normalization_1/moving_mean/biased'
This error message generates in keras tensorflow during training a segmentation model. I have tried a naive model, the issue still exits.
The input of model is (128,128,3) image and output is its flattened segmentation i.e. (16384, 66) where there are 66 classes.

Related

What is the output of .pth after prediction

I am creating a multi class image classification network. My model has ben trained and saved under the notation model.pth. I have loaded it and then passed input to it which is an image tensors. However its giving me weird output.
The output is as follows. I have three classes in my dataset.
tensor([[-0.0997, -0.1605, -0.2177]], device='cuda:0',
grad_fn=)

RuntimeError: input must have 3 dimensions, got 2, in my pytorch rnn model

Getting the dimension error, I have sending the data with correct dimension
Not able to figure where the problem lies in my pytorch lighting rnn model
Model image link

ValueError: The number of samples 147865 is not divisible by batch size 512

I am trying to run GridSearchCV on a TPU on a Google Compute Engine. I can train normally with a Keras model, but once I run it through KerasClassifier and GridSearchCV I get the error:
ValueError: The number of samples 123221 is not divisible by batch size 512.
My original X_train is size 185005, then I resize it to match the batch_size - then it is 184832.
So the error message says 147865 samples - I don't understand how it ends up there.
Can anyone provide a guide to getting KerasClassifier and GridSearchCV working on TPUs?

Weight Initialization for Mask RCNN without using pretrained weights from Imagenet / COCO

# define the model
model = MaskRCNN(mode='training', model_dir='./', config=config)
# load weights (mscoco) and exclude the output layers
model.load_weights('mask_rcnn_coco.h5', by_name=True, exclude=["mrcnn_class_logits", "mrcnn_bbox_fc", "mrcnn_bbox", "mrcnn_mask"])
# train weights (output layers or 'heads')
model.train(train_set, test_set, learning_rate=config.LEARNING_RATE, epochs=2, layers='heads')
I have certain medical images containing fibroids.
I wish to apply instance segmentation or object detection.
I may have to use mask Rcnn for instance segmentation and object detection. Is it possible to design the network from scratch instead of using transfer learning?
What I mean here is random initialization of weights for my data, instead of using weights derived from imagenet data or coco data.
From the command line,instead of training a model starting from pre-trained COCO weights like this
python my_model.py train --dataset=/path/dataset --weights=coco
execute the following line.
python my_model.py train --dataset=/path/dataset
And to start training from the first layer execute the following code.
model.train(dataset_train, dataset_val,learning_rate=config.LEARNING_RATE,epochs=10, layers='all')
Can't you just run the training without doing the model.load_weights() line? It seems to be running fine for me when I do that. I assume that runs it with randomized initial weights. It didn't result in quite as good results as starting with coco does, but I'm sure that's expected behavior for some datasets.

Tensorflow error: logits and labels must be same size: logits_size=[768,64] labels_size=[48,64]

I am trying to build a simple(without the upsampling) fully-convolutional neural network. However, I have encountered the following error:
InvalidArgumentError (see above for traceback): logits and labels must be same size: logits_size=[768,64] labels_size=[48,64]
[[Node: SoftmaxCrossEntropyWithLogits_2 = SoftmaxCrossEntropyWithLogits[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"](Reshape_9, Reshape_10)]]
It's clear that the reason for this error is that the logits and labels have different sizes, but I have literally no idea which part of the code might be responsible for this. The dataset which is given to feed_dict seems to be ok.
Here is the code: https://gist.github.com/den250400/1641d20dc31fbcf1070211451eac7628

Resources