conv-neural-network

how i can create 3d input / 3d output Convolution model with keras?

限于喜欢 提交于 2021-02-20 05:12:34
问题 I have a bit question i couldnt solve. I wanna implement CNN model with fully-connected MLP to my protein database which has 2589 proteins. Each protein has 1287 rows and 69 columns as input and and 1287 rows and 8 columns as output. Actually there was 1287x1 output, but i used one hot encoding for class labels to use crossentropy loss in my model. Also i want if we consider as image i have an 3d matrix ** X_train = (2589, 1287, 69) for input** and y_train =(2589, 1287, 8) output , i mean

how i can create 3d input / 3d output Convolution model with keras?

一个人想着一个人 提交于 2021-02-20 05:12:34
问题 I have a bit question i couldnt solve. I wanna implement CNN model with fully-connected MLP to my protein database which has 2589 proteins. Each protein has 1287 rows and 69 columns as input and and 1287 rows and 8 columns as output. Actually there was 1287x1 output, but i used one hot encoding for class labels to use crossentropy loss in my model. Also i want if we consider as image i have an 3d matrix ** X_train = (2589, 1287, 69) for input** and y_train =(2589, 1287, 8) output , i mean

how i can create 3d input / 3d output Convolution model with keras?

天涯浪子 提交于 2021-02-20 05:09:30
问题 I have a bit question i couldnt solve. I wanna implement CNN model with fully-connected MLP to my protein database which has 2589 proteins. Each protein has 1287 rows and 69 columns as input and and 1287 rows and 8 columns as output. Actually there was 1287x1 output, but i used one hot encoding for class labels to use crossentropy loss in my model. Also i want if we consider as image i have an 3d matrix ** X_train = (2589, 1287, 69) for input** and y_train =(2589, 1287, 8) output , i mean

Using Multiple GPUs outside of training in PyTorch

邮差的信 提交于 2021-02-19 08:46:06
问题 I'm calculating the accumulated distance between each pair of kernel inside a nn.Conv2d layer. However for large layers it runs out of memory using a Titan X with 12gb of memory. I'd like to know if it is possible to divide such calculations across two gpus. The code follows: def ac_distance(layer): total = 0 for p in layer.weight: for q in layer.weight: total += distance(p,q) return total Where layer is instance of nn.Conv2d and distance returns the sum of the differences between p and q. I

How does the Tensorflow's TripletSemiHardLoss and TripletHardLoss and how to use with Siamese Network?

半腔热情 提交于 2021-02-19 08:37:18
问题 As much as I know that Triplet Loss is a Loss Function which decrease the distance between anchor and positive but decrease between anchor and negative. Also, there is a margin added to it. So for EXAMPLE LEt us Suppose: a Siamese Network , which gives embeddings: anchor_output = [1,2,3,4,5...] # embedding given by the CNN model positive_output = [1,2,3,4,4...] negative_output= [53,43,33,23,13...] And I think I can get the triplet loss such as: (I think I have to make it as loss using Lambda

`*** RuntimeError: mat1 dim 1 must match mat2 dim 0` whenever I run model(images)

梦想的初衷 提交于 2021-02-19 05:02:47
问题 def __init__(self): super().__init__() self.conv = nn.Sequential( nn.Conv2d(1, 64, kernel_size=5, stride=2, bias=False), nn.BatchNorm2d(64), nn.ReLU(), nn.Conv2d(64, 64, kernel_size=3, stride=2, bias=False), nn.BatchNorm2d(64), nn.ReLU(), nn.Conv2d(64, 64, kernel_size=3, stride=2, bias=False), nn.BatchNorm2d(64), ) How can I deal with this error? I think the error is with self.fc, but I can't say how to fix it. 回答1: The output from self.conv(x) is of shape torch.Size([32, 64, 2, 2]) : 32*64*2

Keras: Create a custom generator for two input model using flow_from _directory() function

拈花ヽ惹草 提交于 2021-02-19 04:21:33
问题 I was trying to train my siamese network with fit_generator() ,I learned from this answer: Keras: How to use fit_generator with multiple inputs that the best way to do this was to create your own generator that yield the multiple data points, my problem was that I retrieve my data with flow_from_directory() function and I didn't know if that was possible. This is my attempt to readapt a generator for my problem: from keras.models import load_model from keras import optimizers from keras

Predict Image angel with Rotnet and Python

 ̄綄美尐妖づ 提交于 2021-02-11 15:37:35
问题 Hi i am working on classification model to predict angle of image in python for that i am using Correcting Image Orientation Using Convolutional Neural Networks tutorial with ROTNET. Tutorial is very much explained but training is stuck after 5 to 7 step with angel error 101 but tutorial says we only need to wait for 10 epochs to get an average angle error of 1-2 degrees! but i am not reaching there any one having any idea what is thing i am doing wrong. Or this is happening because i am

ValueError: Input 0 is incompatible with layer conv2d_5: expected ndim=4, found ndim=2

烂漫一生 提交于 2021-02-11 15:19:09
问题 I am trying to build a CNN network and wuld like to probe the layer dimention using output_shape. But it's giving me an error as follows: ValueError: Input 0 is incompatible with layer conv2d_5: expected ndim=4, found ndim=2 Below is the code I am trying to execute from keras.layers import Activation model = Sequential() model.add(Convolution2D(32, 3, 3, activation='relu', input_shape=(1,28,28))) print(model.output_shape) 回答1: You can check if by default the number of channels is specified at

How to implement CAM without visualize_cam in this code?

妖精的绣舞 提交于 2021-02-11 14:01:01
问题 I want to make Class activation map, so I have write the code from keras.datasets import mnist from keras.layers import Conv2D, Dense, GlobalAveragePooling2D from keras.models import Model, Input from keras.utils import to_categorical (x_train, y_train), (x_test, y_test) = mnist.load_data() x_train_resized = x_train.reshape((60000, 28, 28, 1)) x_test_resized = x_test.reshape((10000, 28, 28, 1)) y_train_hot_encoded = to_categorical(y_train) y_test_hot_encoded = to_categorical(y_test) inputs =