conv-neural-network

How to choose the number of filters in each Convolutional Layer? [closed]

☆樱花仙子☆ 提交于 2019-12-06 06:21:28
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . When building a convolutional neural network, how do you determine the number of filters used in each convolutional layer. I know that there is no hard rule about the number of filters, but from your experience/ papers you have read, etc. is there an intuition/observation about

ValueError: Negative dimension size caused by subtracting 2 from 1 for 'max_pooling2d_6/MaxPool' (op: 'MaxPool') with input shapes: [?,1,1,64]

淺唱寂寞╮ 提交于 2019-12-06 06:14:08
问题 I am getting an error of Negative dimension size when I am keeping height and width of the input image anything below 362X362. I am surprised because this error is generally caused because of wrong input dimensions. I did not find any reason why number or rows and columns can cause an error. Below is my code- batch_size = 32 num_classes = 7 epochs=50 height = 362 width = 362 train_datagen = ImageDataGenerator( rotation_range=40, width_shift_range=0.2, height_shift_range=0.2, rescale=1./255,

ValueError: Tensor:(…) is not an element of this graph

删除回忆录丶 提交于 2019-12-06 05:57:45
I am using keras' pre-trained model and the error came up when trying to get predictions. I have the following code in flask server: from NeuralNetwork import * @app.route("/uploadMultipleImages", methods=["POST"]) def uploadMultipleImages(): uploaded_files = request.files.getlist("file[]") getPredictionfunction = preTrainedModel["VGG16"] for file in uploaded_files: path = os.path.join(STATIC_PATH, file.filename) result = getPredictionfunction(path) This is what I have in my NeuralNetwork.py file: vgg16 = VGG16(weights='imagenet', include_top=True) def getVGG16Prediction(img_path): model =

ValueError: Error when checking target: expected dense_2 to have 4 dimensions, but got array with shape (7942, 1)

帅比萌擦擦* 提交于 2019-12-06 05:42:26
I have been using the following functional API for an image classification task using CNN: def create_model(X_train, X_test): visible = Input(shape=(X_train.shape[0], X_train.shape[1], 1)) conv1 = Conv2D(32, kernel_size=4, activation='relu')(visible) hidden1 = Dense(10, activation='relu')(pool2) output = Dense(1, activation='sigmoid')(hidden1) model = Model(inputs = visible, outputs = output) model.compile(loss='binary_crossentropy', optimizer='rmsprop', metrics=['accuracy']) return model X_tr = np.reshape(X_train, (1,X_train.shape[0], X_train.shape[1], 1)) X_te = np.reshape(X_test, (1,X_test

Python/Tensorflow - I have trained the convolutional neural network, how to test it?

北城以北 提交于 2019-12-06 02:59:23
I have trained a convolutional neural network (CNN) with the following data that I had in a binary file (label, filename, data (pixels)): [array([2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0]), array(['10_c.jpg', '10_m.jpg', '10_n.jpg', '1_c.jpg', '1_m.jpg', '1_n.jpg', '2_c.jpg', '2_m.jpg', '2_n.jpg', '3_c.jpg', '3_m.jpg', '3_n.jpg', '4_c.jpg', '4_m.jpg', '4_n.jpg', '5_c.jpg', '5_m.jpg', '5_n.jpg', '6_c.jpg', '6_m.jpg', '6_n.jpg', '7_c.jpg', '7_m.jpg', '7_n.jpg', '8_c.jpg', '8_m.jpg', '8_n.jpg', '9_c.jpg', '9_m.jpg', '9_n.jpg'], dtype='<U15'), array(

Keras ConvLSTM2D: ValueError on output layer

筅森魡賤 提交于 2019-12-06 02:55:44
问题 I am trying to train a 2D convolutional LSTM to make categorical predictions based on video data. However, my output layer seems to be running into a problem: "ValueError: Error when checking target: expected dense_1 to have 5 dimensions, but got array with shape (1, 1939, 9)" My current model is based off of the ConvLSTM2D example provided by Keras Team. I believe that the above error is the result of my misunderstanding the example and its basic principles. Data I have an arbitrary number

What is the advantage of using multiples of the same filter in convolutional networks in deep learning

南楼画角 提交于 2019-12-06 02:32:47
问题 What is the advantage of using multiples of the same filter in convolutional networks in deep learning? For example: We use 6 filter of size [5,5] at the first layer to scan the image data, which is a matrix of size [28,28]. The question is why do we not use only a single filter of size [5,5] but use 6 or more of them. In the end they will scan the exact same pixels. I can see that the random weight might be different but DL model will adjust to it anyway. So, specifically what is the main

Where to apply batch normalization on standard CNNs

蹲街弑〆低调 提交于 2019-12-06 01:27:40
I have the following architecture: Conv1 Relu1 Pooling1 Conv2 Relu2 Pooling3 FullyConnect1 FullyConnect2 My question is, where do I apply batch normalization? And what would be the best function to do this in TensorFlow? The original batch-norm paper prescribes using the batch-norm before ReLU activation. But there is evidence that it's probably better to use batchnorm after the activation. Here's a comment on Keras GitHub by Francois Chollet: ... I can guarantee that recent code written by Christian [Szegedy] applies relu before BN. It is still occasionally a topic of debate, though. To your

Caffe classification labels in HDF5

让人想犯罪 __ 提交于 2019-12-05 21:29:56
I am finetuning a network. In a specific case I want to use it for regression, which works. In another case, I want to use it for classification. For both cases I have an HDF5 file, with a label. With regression, this is just a 1-by-1 numpy array that contains a float. I thought I could use the same label for classification, after changing my EuclideanLoss layer to SoftmaxLoss. However, then I get a negative loss as so: Iteration 19200, loss = -118232 Train net output #0: loss = 39.3188 (* 1 = 39.3188 loss) Can you explain if, and so what, goes wrong? I do see that the training loss is about

keras cnn_lstm input layer not accepting 1-D input

谁说我不能喝 提交于 2019-12-05 20:22:23
I have sequences of long 1_D vectors (3000 digits) that I am trying to classify. I have previously implemented a simple CNN to classify them with relative success: def create_shallow_model(shape,repeat_length,stride): model = Sequential() model.add(Conv1D(75,repeat_length,strides=stride,padding='same', input_shape=shape, activation='relu')) model.add(MaxPooling1D(repeat_length)) model.add(Flatten()) model.add(Dense(1, activation='sigmoid')) model.compile(loss='binary_crossentropy', optimizer='rmsprop', metrics=['accuracy']) return model However I am looking to improve the performance by