Passing ouput from model as input pytorch dataloader - pytorch

I’m doing video prediction frame prediction using LSTM. I have trained the network using input frame at time (t) and target frame at time (t+1).
Now for testing set I want the LSTM to use the output frame from time (t) as a input frame at time (t+1), is it possible to do this using a dataloader?

Related

How to CONCATENATE the output of LSTM and One hot encoding values

I'm working on a time series prediction using LSTM for used power. I could implement it with a pure LSTM. But i have categorical values which i one hot encoded.
Now, I want to concatenate the LSTM output and the one hot encoding value then pass it through a dense layer to get my output. Attached is a pics of the architecture i'm trying to implement.

multiclass-segemenratation using pytorch and unet

I am doing landuse classification with 4 classes and as an output from softmax function of unet model i gained output of [8,4,128,128] and my mask image is [8,1,128,128] so to calculate loss I used nn.cross entropy function should i have to make any modification for good results as I find the output of testing image was 4 channels images which are not like mask image.``

how can i create labels for LSTM

i am working on video classification problem so i converted my videos into images every video converted to 7 images and then path them to vgg16 to extract features from those images and then use LSTM to learn the sequence of images for every video
when i feed the vgg16 results to my LSTM i need to give every 7 image one label because i am dealing with sequence so i need to create this lables by my self so how can i create labels in python
by the way its binary classification problem

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.

CNN Keras Multi Label Output Prediction

I'm trying to implement the CNN code from Andreas Werdich: https://github.com/awerdich/physionet
" The goal of this project was to implement a deep-learning algorithm that classifies electrocardiogram (ECG) recordings from a single-channel handheld ECG device into four distinct categories: normal sinus rhythm (N), atrial fibrillation (A), other rhythm (O), or too noisy to be classified (~). "
Executing the code works fine. But now after the model was trained I'm not sure how to predict a different ECG signal. He uses ECG signal stored in hdf5 files.
"For each group of data in the hdf5 file representing a single ECG time series, the following metadata was saved as attribute:
baseline voltage in uV
bit depth
gain
sampling frequency
measurement units"
After training I saved the model with
model.save(filepath)
I put it on filedropper: http://www.filedropper.com/ecgcnn
And I have an hdf5 file full with ECG signals that I'd like to predict: http://www.filedropper.com/physioval
I tried using the model.predict function, but it didn't work. I'm not quite sure how to pass on the ECG signal, because I need 4 different classifications.
Does anyone know how I can make the prediction work?
Thanks

Resources