New answers tagged

0

If you are using TensorFlow to write your architecture, You can create 3 training datasets( one for one class) using tf.data and then you can use tf.data.experimental.sample_from_datasets with the same weightage to generate the batch data. Check weights parameter in the documentation. You can initialize well in the final layer. Please check this blog from ...


0

You have to use 1-D CNN. Before that you must prepare your dataset in a sequential format. e.g. Below is a depiction of how the Convolution will work [Source - D2L], Study these references for Conv1D: Machine learning mastery Dive into Deep Learning


0

Convolutional 1D layers require their input in 3 dimensions: [batch], [features], [channels]. This makes good sense for 2D Convolutional layers, which are often called upon to process color images, but it can be a little confusing for 1D convolutions. The simplest solution may be to reshape your data so that it's, ([samples], 6, 1). Edit: how to reshape your ...


1

The Euclidean between two images $p$ and $q$ can be calculated as follows: $d(p, q) = \sqrt{(q_1 - p_1)^2 + (q_2 - p_2)^2 + ... + (q_{49} - p_{49})^2}$ which is the distance between the 49 (7x7) features of the two images. This should then give you a vector of shape (1024, 1) where each value is the Euclidean distance of the feature maps of the previous ...


1

Sliding window in this context is regarding what is given as input to the CNN. It is a sliding window of the input image. I have seen it being used in medical domain where the images are too large to fit into a network and reshaping them into smaller sizes doesn't help. So, a sliding window is done on the bigger image and the sliding window is fed into CNN ...


1

A rule of thumb, as you go deeper, number of filters increase and the size of filter remains same or increases. You don't follow both of them. This will help your network learn. Then, consider increasing the number of filters in proper fashion if still your network is not learning.


0

Given your mask is very small, you should look at reducing your convolutions to 2x2 since that will help aggregate more information from these smaller masks. EfficientNet has 3x3 and 5x5 convolutions which may not be suited for your purpose. It is a better idea for you to train from scratch using smaller convolutions (2x2). Also, since you will lose the edge ...


0

First, let me give you an intuitive explanation. When you drop a pebble in water, you see the ripples being formed. Imagine that in reverse. All those ripples comes together at the point from which they started. Node embeddings are like that. You take the information of neighbourhood nodes and combine it with the information in the original node. The art ...


0

Each sample of your dataframe is a 1D vector, you need to Conv1D (1D convolutions) with filter sizes of 3 or 5. If you want to convert each sample of yours into an image, you need to do some pre-processing. Here's a paper which does that: paper. Also, since this a tabular data, if you want to stick to neural networks then consider TabNet. It has ...


2

For your first question, yes, it is optimized for that size since the original paper for Xception used 299x299 size. But, you can use other sizes. You should resize your images to 299x299 that would be the best. For your second question, the reason height = width because in the network, the convolutional filters which are used are square (3x3 filters). The ...


0

You can do structured pruning for MLPs. You would remove things like whole neurons or layers (not specific weights).


0

As per the above answer, the below code just gives 1 batch of data. X_train, y_train = next(train_generator) X_test, y_test = next(validation_generator) To extract full data from the train_generator use below code - # Store the data in X_train, y_train variables by iterating over the batches train_generator.reset() X_train, y_train = next(train_generator) ...


0

Keras included in their library to predict the class label. You can get the class label directly by using model.predict_classes(img). Ref: https://datascience.stackexchange.com/a/40415/109134


1

In attention mechanisms, you take an expectation of a representation of data V with respect to some probability mass function, thus computing the context vector, which is essentially a summary statistic (weighted mean) of your data: \begin{align} c&=\mathbb{E}_p[V] \end{align} The big question is how you determine the elements of $p$, the probability ...


0

There is no equation or theory to decide the number of layers at each depth in a neural network. The most common technique is trail and error. There can be systematic search through cross validation. Generally more layers are added until performance stops improving.


0

Model prediction output is a bunch of probabilities. In order to get category name you need use following snippet. It calculates the argmax of predicions and give it to CLASSES list: print(CLASSES[np.argmax(predictions)])


0

The solution for my problem was implementing Batch Renormalization: BatchNormalization(renorm=True). In addition normalizing the inputs helped a lot improving the overall performance of the neural network.


0

As you stated in your question, those numbers go into a softmax function. Another name for softmax is normalized exponential function. Softmax normalizes numbers where the sum is constrained to be 1 and each value becomes the probability of categorical membership. In the specific case of [23.4, -21254.3, 32123.4], applying the softmax transforms them to [0, ...


1

1 - Activation functions are non-linear functions. These are added in between layers which are simply Linear transformations. Example without activation function: ConvLayer1(Input) -> ConvMaps1 ConvLayer2(ConvMaps2) -> ConvMaps2 Mathematically, this would be $I_{nput} \circledast K_{ernel_1} \circledast K_{ernel_2} $, which is equivalent to $I_{nput} ...


0

Why activation functions: For this , its straight forward to add some non-linearity into the model, and this helps in defining which neuron to fire which should not. For second one , the compute will increase slightly but not so rapidly , why because the convolution operation you are performing on the first layer will reduce the image size in the second ...


1

The choice for the number of neurons in the last two dense layers and the number of filter is somewhat arbitrary and most of the time determined by trying different configurations (using something like a hyperparameter grid search). See also this answer on stats stackexchange. If you want to change the size of the 5x5 kernels you will only have to change the ...


0

I would suggest you refer to the paper by Hu et al, Show, Attend and Tell: Neural Image Caption Generation with Visual Attention. The brief idea is that the network learns the 'areas' to focus on that are on the feature maps (the last layer of the feature detectors) which can be in return mapped back to a certain location on the image. It is not a complex ...


0

Why don't you use a lower number of filters in the last convolution? Instead of 128 you can just choose whatever number you want, e.g. 10. Also, normally after the convolutional (and pooling layers), you flatten the output (therefore losing the spatial information) and then project with a dense layer onto the final representation space. You can control the ...


0

Doesn't ConvNets allow parameters to be shared, detecting the similar features of different images? Your final statement holds true for convolutional layers which are in early layers, but final layers detect more abstract features, e.g. a full object. Consequently, the last layers of a CNN that is trained with images of flowers will not be helpful for a ...


Top 50 recent answers are included