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=)
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
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?
# 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.
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