What is the architectural diagram of attention layer code
from tensorflow.keras.layers import Layer
from tensorflow.keras import backend as K
KeyError: “Registering two gradient with name ‘RectifiedRelu’
I’m trying to implement Rectified Gradient as described by this paper:
https://arxiv.org/pdf/1902.04893
Sinusoidal Initialization (MSK+CNN model)
I am trying to replicate the MSK+CNN model in this research paper: https://ieeexplore.ieee.org/document/9760210/authors#authors
But I am not sure how to implement it correctly.
The accuracy on the test set corresponds to the class balance. What could be the problem?
I’m trying to build a neural network for classifying images into cats and dogs, I tried different architectures like Resnet50, AlexNet, MobileNetV2 and made my own architecture, as a result there were no problems with accuracy on training data and on validation data, accuracy was around 80-91% on training data data and 75-85% on the validation set, but when I check the accuracy on the test set, it is always at the level of 49-51%. And one day I decided to add another class and the accuracy turned out to be 32-34% on the test set, if I add 5 classes then the accuracy is in the region of 19-21% and the class balance starting from the binary classification of 0.5 then 0.33 and 0.2, respectively.
how to reduce the loss in 1d cnn model
`class CNN(nn.Module):
def init(self):
super(CNN, self).init()
self.conv1 = nn.Conv1d(in_channels=4, out_channels=64, kernel_size=3, padding=1)
self.bn1 = nn.BatchNorm1d(num_features=64)
self.relu1 = nn.ReLU()
self.pool1 = nn.MaxPool1d(kernel_size=2)
self.conv2 = nn.Conv1d(in_channels=64, out_channels=128, kernel_size=3, padding=1)
self.bn2 = nn.BatchNorm1d(num_features=128)
self.relu2 = nn.ReLU()
self.pool2 = nn.MaxPool1d(kernel_size=2)
self.conv3 = nn.Conv1d(in_channels=128, out_channels=256, kernel_size=3, padding=1)
self.bn3 = nn.BatchNorm1d(num_features=256)
self.relu3 = nn.ReLU()
self.pool3 = nn.MaxPool1d(kernel_size=2)
self.conv4 = nn.Conv1d(in_channels=256, out_channels=512, kernel_size=3, padding=1)
self.bn4 = nn.BatchNorm1d(num_features=512)
self.relu4 = nn.ReLU()
self.pool4 = nn.MaxPool1d(kernel_size=2)
self.fc1 = nn.Linear(6144, 512)
self.bp1 = nn.BatchNorm1d(num_features=512)
self.relu5 = nn.ReLU()
self.dropout1 = nn.Dropout(p=0.2)
self.fc2 = nn.Linear(512, 256)
self.bp2 = nn.BatchNorm1d(num_features=256)
self.relu6 = nn.ReLU()
self.dropout2 = nn.Dropout(p=0.2)
self.fc3 = nn.Linear(256, 2)
Why a CNN predicts always the same value?
I am developing a CNN model using TensorFlow/Keras to predict the curvature of a road from traffic images. My dataset contains 5500 images, and the curvature values are continuous numbers ranging between -0.3 and 0.3. However, my model consistently outputs the same prediction for any input. I’ve experimented with altering the learning rate, changing the optimizer, and modifying dropout and augmentation layers, but none of these changes have resolved the issue.