conv-neural-network

pytorch conv2d value cannot be converted to type uint8_t without overflow

偶尔善良 提交于 2020-07-09 16:14:22
问题 I'm passing a torch.Tensor with a dtype of torch.uint8 to an nn.Conv2d module and it is giving the error RuntimeError: value cannot be converted to type uint8_t without overflow: -0.0344873 My conv2d is defined as self.conv1 = nn.Conv2d(3, 6, 5) . The error comes in my forward method when I pass the tensor to the module like self.conv1(x) . The tensor has shape (4, 3, 480, 640). I'm not sure how to fix this. Here is the stack trace Traceback (most recent call last): File "cnn.py", line 54, in

Keras iterator with augmented images and other features

微笑、不失礼 提交于 2020-07-08 05:06:34
问题 Say you have a dataset that has images and some data in a .csv for each image. Your goal is to create a NN that has a convolution branch and an other one (in my case an MLP). Now, there are plenty of guides (one here, another one) on how to create the network, that's not the problem. The issue here is how do I create an iterator in the form of [[convolution_input, other_features], target] when the convolution_input is from a Keras ImageDataGenerator flow that adds augmented images. More

Keras iterator with augmented images and other features

淺唱寂寞╮ 提交于 2020-07-08 05:06:01
问题 Say you have a dataset that has images and some data in a .csv for each image. Your goal is to create a NN that has a convolution branch and an other one (in my case an MLP). Now, there are plenty of guides (one here, another one) on how to create the network, that's not the problem. The issue here is how do I create an iterator in the form of [[convolution_input, other_features], target] when the convolution_input is from a Keras ImageDataGenerator flow that adds augmented images. More

Keras iterator with augmented images and other features

拜拜、爱过 提交于 2020-07-08 05:05:45
问题 Say you have a dataset that has images and some data in a .csv for each image. Your goal is to create a NN that has a convolution branch and an other one (in my case an MLP). Now, there are plenty of guides (one here, another one) on how to create the network, that's not the problem. The issue here is how do I create an iterator in the form of [[convolution_input, other_features], target] when the convolution_input is from a Keras ImageDataGenerator flow that adds augmented images. More

Keras iterator with augmented images and other features

寵の児 提交于 2020-07-08 05:05:11
问题 Say you have a dataset that has images and some data in a .csv for each image. Your goal is to create a NN that has a convolution branch and an other one (in my case an MLP). Now, there are plenty of guides (one here, another one) on how to create the network, that's not the problem. The issue here is how do I create an iterator in the form of [[convolution_input, other_features], target] when the convolution_input is from a Keras ImageDataGenerator flow that adds augmented images. More

Implementing im2col in TensorFlow

百般思念 提交于 2020-06-24 11:49:07
问题 I wish to implement an operation similar to 2D convolution in TensorFlow. As per my understanding, the most common approach to implementing convolution is by first applying an im2col operation to the image (see here - subsection " Implementation as Matrix Multiplication ") - an operation that transforms an image into a 2D matrix with individual "chunks" of the image to which the kernel is applied as flattened columns. In other words, this excerpt from the above linked resource explains what

Adam optimizer goes haywire after 200k batches, training loss grows

余生颓废 提交于 2020-06-23 22:24:20
问题 I've been seeing a very strange behavior when training a network, where after a couple of 100k iterations (8 to 10 hours) of learning fine, everything breaks and the training loss grows : The training data itself is randomized and spread across many .tfrecord files containing 1000 examples each, then shuffled again in the input stage and batched to 200 examples. The background I am designing a network that performs four different regression tasks at the same time, e.g. determining the

KeyError: 'class' while using ImageDataGenerator.flow_from_dataframe

我们两清 提交于 2020-06-17 14:05:21
问题 I am trying to create data generator using ImageDataGenerator.flow_from_dataframe but facing keyerror: class Before using flow_from_dataframe, i created a pivot of training dataframe where class labels are converted to columns train_df = train[['Label', 'filename', 'subtype']].drop_duplicates().pivot(index='filename', columns='subtype', values='Label').reset_index() Below is the output of dataframe train_df. subtype filename any epidural intraparenchymal intraventricular subarachnoid subdural

How do I get probability/confidence as output for a CNN using keras in python?

久未见 提交于 2020-06-16 07:41:10
问题 So, I'm new to deep learning and I've started with cats and dogs dataset for a CNN Model using Keras. In my code, I'm unable to get probabilities as output for both classifier.predict or classifier.predict_proba . I'm just getting the output as [[0,1]] or [[1,0]] . I've tried with several images. But I'm looking for something like, [[0.4,0.6]] , [[0.89,0.11]] I've tried changing loss function from binary_crossentropy to categorical_crossentropy . I've tried changing the activation function of

Using Conv2DTranspose to output the double of its input shape

匆匆过客 提交于 2020-06-11 06:33:30
问题 I'm newbie with Python 3.7.7 and Tensorflow 2.1.0 and I'm trying to understand Conv2DTranspose. I have tried this code: def vgg16_decoder(input_size = (7, 7, 512)): inputs = Input(input_size, name = 'input') conv1 = Conv2DTranspose(512, (2, 2), dilation_rate = 2, name = 'conv1')(inputs) model = Model(inputs = inputs, outputs = conv1, name = 'vgg-16_decoder') opt = Adam(lr=0.001) model.compile(optimizer=opt, loss=keras.losses.categorical_crossentropy, metrics=['accuracy']) return model And