A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

Tag Info

1

That's a very interesting question. I started looking into it recently while trying to understand better convolutional neural networks. In short: yes! They are called convolutional while in actual practical terms using the cross-correlation operator. So this is a case of a misnomer. I think the important thing to understand is that correlation and ...

0

You can either directly use the mean absolute percentage error (MAPE) function in Keras API for TensorFlow or use that function to test your custom function. tf.keras.losses.MAPE code is avaible in the TensorFlow GitHub repo: def mean_absolute_percentage_error(y_true, y_pred): y_pred = ops.convert_to_tensor(y_pred) y_true = math_ops.cast(y_true, ...

0

In general this might be done as a sequence labeling task, but you would need a large amount of annotated data for training. Another approach would be to use specific resources for medical concepts, such as MetaMap.

0

It should even be easier than classification: you do not need the final layer. Your input layer should have 18 nodes $(x_i,y_i,t_i)|i=1..6$ Hidden layers as you see fit (experiment with it, depending on data and results). I would expect the best results from a fully connected layer and a 'relu' layer. The output layer has 3 nodes $(x_7, y_7, t_7)$ Train ...

0

Can you use zero padding? It's a pre-processing technique for CNNs, it consists in creating a frame of zeros around the image, so that all input image will have the same size. The CNN will then learn autonomously to ignore the zeros. It's a common technique, Keras layers already have padding built-in arguments.

2

Here's the list of difference that I know about attention (AT) and self-attention (SA). In neural networks you have inputs before layers, activations (outputs) of the layers and in RNN you have states of the layers. If AT is used at some layer - the attention looks to (i.e. takes input from) the activations or states of some other layer. If SA is applied - ...

1

Question 1) Is my calculation for each case above correct? No, it is not correct. The formula to calculate the spatial dimensions (height and width) of a (square shaped) convolutional layer is $$O = \frac{I - K + 2P}S + 1$$ with $I$ being the spatial input size, $K$ being the kernel size, $P$ the padding and $S$ the stride. For your two cases that is (...

0

What is your Model you want to fit? If it is a Tensorflow Model i would recomend tf.data, there you can simply build a dataset with: import tensorflow as tf IMAGEWIDTH = 100 IMAGEHEIGHT = 100 CHANNEL = 3 EPOCHS = 10 def get_label(file_path, class_names): # convert the path to a list of path components parts = tf.strings.split(file_path, os.path.sep) ...

3

If the "cost" for experimenting is not really that big I suggest you take the time to experiment and take this as a learning opportunity and just try if it could actually work. There are many approaches to address class imbalance and setting class weight is one of them and the easiest to implement. Change loss function (for example to focal loss for ...

3

I am building on the first part of @Dylan's answer: For general items like "dogs" pre-trained models are easily available. A good starting point is ImageNet. There are plenty of pre-trained models available for this dataset, e.g. see here for PyTorch. Since ImageNet includes multiple categories for a given item you can check this list to see which indexes ...

1

One potential approach would have been to use a pretrained model to tag the photos you scraped to see if they contained a picture of a dog or not. Then just to keep things simple use that as a rough filter to see if the individual photo was suitable for your model. If your task is highly specific it may be extremely difficult to find a pre trained image ...

0

If the distribution of the test and training sets are different, the metrics will be fairly different. And in cases of imbalanced classes, accuracy is not a great measure. Consider using precision, recall, or f-score. See if they improve over epochs.

0

BERT: import transformers import torch tokenizer = transformers.BertTokenizer.from_pretrained('bert-base-uncased') bert_model = transformers.BertModel.from_pretrained('bert-base-uncased') max_seq = 100 def tokenize_text(df, max_seq): return [ tokenizer.encode(text)[:max_seq] for text in df['text'] ] def pad_text(tokenized_text, max_seq): ...

1

Three ideas come to my mind (from simple to complex) Include an additional category for anything which is not a number and train your network on these $k+1$ categories. Apply another predictor in the first place which has been trained to differentiate between "number" and "no number". Iff the input is classified as a number you then run your number ...

1

I think the best way would be to augment some data and have an additional output class "unknown". However, if that is not possible or the neural net can not be retrained I would compare the distribution of the outputs of a hidden layer. For the CNN architecture below, calculate the empirical distribution for the outputs of a hidden layer after the flatten ...

1

Yes, Images can have more than 3 channels. Satellites routinely record multiple frequencies at once (for instance infrared). Normal monitors can't render that outright and you'll have to project those channels back to RGB. A simple way to do that is false colors. These three false-color images demonstrate the application of remote sensing in precision ...

0

Here it's not with respect to the number of channels in an image, it's related to the number of out_channels you get after you have applied Conv operations. in_channels is the number of channels in the input(generally for an image it's either 1 or 3 depending on the image data, for video it's 4 or more as well etc.) out_channels Number of channels produced ...

0

https://pjreddie.com/darknet/ is their website... I cite : "Darknet: Open Source Neural Networks in C Darknet is an open source neural network framework written in C and CUDA. It is fast, easy to install, and supports CPU and GPU computation." As to why they used that, well it's open source and in C, which are good points and seems to be performant (see ...

1

I know what is cython and make (but I never use YOLO!) Cython is a C-extension for python. It allows you to write code C/C++ in a python script. (use for very fast program execution) Make is command which executes your makefile. You can consider makefile is a build script to create/tune the necessary things like environment/folders/.. etc.

1

I have found out https://stanford.edu/~shervine/teaching/cs-229/ to be quite torough. I can't find their pdf version anymore but they seems to cover what you are looking for (see deep learning for NN equations).

0

For a start I would begin with simpler tests cases because they look rather complex (see an exemple of what you seems to simulate below). May be start with a 10x10 grid and generate 1 to 5 islands of different size.

1

Here is a more complete articlerelated to your question. The idea of pruning is simple and logical, however when looking at the bigger picture it is not as straight forward to implement. One of the main reason is that operations on the deeper layer depends on the previous layers and hence tampering with early layers might affect the next layers. Hence, if ...

1

Yes, the spatial dimensions (height and width) are reduced: the input is 16x16, H1 is 8x8 and H2 is 4x4. Also see the first paragraph in the architecture section: Source In modern terms you would say that they use a stride of 2. Which reduces the spatial dimensions accordingly. EDIT (based on your comment) The formula for the spatial output dimension \$...

0

Try adding dropout layers to your network, this should work very well to reduce the amount of overfitting of your network.

0

You said that "an object with label = 0 exhibits random looking motion...whereas those with label = 1 are highly ordered objects". If you can see that, why should your model not be able to? Just train it and see if it works. However, your dataset does not seem to be very large. You should think about transfer learning from some pre-trained model if your ...

1

When a loss of your model on a subset of examples is calculated you are trying to estimate the "true" loss of your model on the underlying distribution of training examples. The loss of a single training example is a bad estimate for the expected loss of your model on the whole population for the exact reason you are mentioning: it might be right or wrong by ...

1

Pure, hardcore Stochastic Gradient Descent (when you feed just one observation at a time) is not advisable at all. The descent of the Gradient is so noisy that after a certain minimal loss reduction it will stop learning anything. It will wander around the loss function in unpredictable ways. In this case, you're right: there's no way to assess final ...

1

Total RAM would be - Batch size X RAM to train one image (since backpropagation happens after the batch) RAM for one training image - A/ 4 Bytes X Number of parm B/ Size of input for each layer considering downsampling and number of features map (Suppose input are 200 × 300 pixels, the first layer’s feature maps might be 100 × 150, the second layer’s ...

1

For a CNN layer with input of dimensions h * w * d, kernel size k * k and number of kernel filters as f, we have the number of parameters as k * k * d * f, if we ignore the biases. If use biases then the number of parameters becomes (k * k * d + 1) * f For e.g., the 1st conv layer has 5 * 5 * 2 * 20 parameters if we are ignoring the biases. With bias, the ...

5

In theory yes in practice maybe. What do I mean by that. There is universal approximation theorem for smooth functions regarding ANN, there is also theory backing this up for CNN variant. Another thing that backs this claim up is that you can replicate any ANN with CNN architecture, hence effectively backtracking to the original ANN. Practice, you say this ...

-1

I used Keras ImageDataGenerator for data augmentation. Isn't that enough? train_datagen = ImageDataGenerator( rescale=1. / 255, rotation_range=20, width_shift_range=0.2, height_shift_range=0.2, shear_range=0.2, zoom_range=0.2, horizontal_flip=True, vertical_flip=True) What other methods/tools should I consider?

2

There can be multiple explenations. But here are some: Images in train test and valid that are poor for some classes are not representative in train (poperties of these objects are not to be found hence you cant predict on something that you did not atleast partially learn on)- covariate shift You say adding data is problematic and I understand but just ...

Top 50 recent answers are included