deep-learning

using output from one LSTM as input into another lstm in tensorflow

时间秒杀一切 提交于 2020-05-28 07:25:04
问题 I want to build an LSTM based neural network which takes two kinds of inputs and predicts two kinds of outputs. A rough structure can be seen in following figure.. The output 2 is dependent upon output 1 and as described in answer to a similar question here, I have tried to implement this by setting the initial state of LSTM 2 from hidden states of LSTM 1. I have implemented this using tensorflow using following code. import tensorflow as tf from tensorflow.keras.layers import Input from

using output from one LSTM as input into another lstm in tensorflow

瘦欲@ 提交于 2020-05-28 07:25:00
问题 I want to build an LSTM based neural network which takes two kinds of inputs and predicts two kinds of outputs. A rough structure can be seen in following figure.. The output 2 is dependent upon output 1 and as described in answer to a similar question here, I have tried to implement this by setting the initial state of LSTM 2 from hidden states of LSTM 1. I have implemented this using tensorflow using following code. import tensorflow as tf from tensorflow.keras.layers import Input from

Finding mean and standard deviation across image channels PyTorch

对着背影说爱祢 提交于 2020-05-27 04:41:06
问题 Say I have a batch of images in the form of tensors with dimensions (B x C x W x H) where B is the batch size, C is the number of channels in the image, and W and H are the width and height of the image respectively. I'm looking to use the transforms.Normalize() function to normalize my images with respect to the mean and standard deviation of the dataset across the C image channels , meaning that I want a resulting tensor in the form 1 x C. Is there a straightforward way to do this? I tried

Augmenting only the training set in K-folds cross validation

♀尐吖头ヾ 提交于 2020-05-26 09:46:37
问题 I am trying to create a binary CNN classifier for an unbalanced dataset (class 0 = 4000 images, class 1 = around 250 images), which I want to perform 5-fold cross validation on. Currently I am loading my training set into an ImageLoader that applies my transformations/augmentations(?) and loads it into a DataLoader. However, this results in both my training splits and validation splits containing the augmented data. I originally applied transformations offline (offline augmentation?) to

Keras custom loss as a function of multiple outputs

风流意气都作罢 提交于 2020-05-26 04:28:41
问题 I built a custom architecture with keras (a convnet). The network has 4 heads, each outputting a tensor of different size. I am trying to write a custom loss function as a function of this 4 outputs. I have been implementing cusutom losses before, but it was either a different loss for each head or the same loss for each head. In this case, I need to combine the 4 outputs to calculate the loss. I am used to the following: def custom_loss(y_true, y_pred): return something model.compile

Keras custom loss as a function of multiple outputs

我的梦境 提交于 2020-05-26 04:27:40
问题 I built a custom architecture with keras (a convnet). The network has 4 heads, each outputting a tensor of different size. I am trying to write a custom loss function as a function of this 4 outputs. I have been implementing cusutom losses before, but it was either a different loss for each head or the same loss for each head. In this case, I need to combine the 4 outputs to calculate the loss. I am used to the following: def custom_loss(y_true, y_pred): return something model.compile

MemoryError in TensorFlow; and “successful NUMA node read from SysFS had negative value (-1)” with xen

妖精的绣舞 提交于 2020-05-25 06:30:12
问题 I am using tensor flow version : 0.12.1 Cuda tool set version is 8. lrwxrwxrwx 1 root root 19 May 28 17:27 cuda -> /usr/local/cuda-8.0 As documented here I have downloaded and installed cuDNN. But while execeting following line from my python script I am getting error messages mentioned in header: model.fit_generator(train_generator, steps_per_epoch= len(train_samples), validation_data=validation_generator, validation_steps=len(validation_samples), epochs=9) Detailed error message is as

How to increase validation accuracy with deep neural net?

耗尽温柔 提交于 2020-05-24 08:23:41
问题 I am trying to build a 11 class image classifier with 13000 training images and 3000 validation images. I am using deep neural network which is being trained using mxnet. Training accuracy is increasing and reached above 80% but validation accuracy is coming in range of 54-57% and its not increasing. What can be the issue here? Should I increase the no of images? 回答1: The issue here is that your network stop learning useful general features at some point and start adapting to peculiarities of

How to get reproducible result when running Keras with Tensorflow backend

一曲冷凌霜 提交于 2020-05-23 02:55:19
问题 Every time I run LSTM network with Keras in jupyter notebook, I got a different result, and I have googled a lot, and I have tried some different solutions, but none of they are work, here are some solutions I tried: set numpy random seed random_seed=2017 from numpy.random import seed seed(random_seed) set tensorflow random seed from tensorflow import set_random_seed set_random_seed(random_seed) set build-in random seed import random random.seed(random_seed) set PYTHONHASHSEED import os os

what should be the target in this deep learning image classification problem

十年热恋 提交于 2020-05-17 07:07:19
问题 I am doing a image classification project using CNN in keras. I have a dataset of about 900 photos of about 70 people .Each person has multiple photos of his different age. My goal is to predict the correct ID of the person if any one of his photo is in the input. Here is the glimpse of the data. My questions are: What should be my target column ?Is Target 'AGE' or 'ID'? 2-Do I need to do hot-encoding of the target column? For example if I used ID as my target,then do I have to do one-hot