Hi,
I am currently training a multilabel classification that takes as input RGB 268x180 images [3,268,180], with labels that are one-hot encoded for each class [7]
It would be appreciate if you have any recommendations how to modify my architecture/hyperparameters to obtain lower train/validation loss and higher F1_score for more accurate predicitons
num_epochs = 1
eval_every = 100
total_step = len(train_loader)*num_epochs
best_val_loss = None
criterion = nn.BCELoss()
optimizer = optim.Adam(model.parameters(), lr=0.001)
save_path = f'cifar_net.pt'
model = model.to(device)
TRAIN(model, train_loader, valid_loader, num_epochs, eval_every, total_step, criterion, optimizer, best_val_loss, device, save_path)
After training I obtain this output:
Epoch [1/1], Step [100/260], Train Loss: 0.7003, Train Acc: 0.1125, Valid Loss: 0.6889, Valid Acc: 4.4154 Model saved to ==> cifar_net.pt Epoch [1/1],
Step [200/260], Train Loss: 0.6902, Train Acc: 0.1528, Valid Loss: 0.6886, Valid Acc: 3.9231 Model saved to ==> cifar_net.pt Finished Training
This is my “naive” architecture as of now
class Net(Module):
def __init__(self):
super(Net, self).__init__()
self.cnn_layers = Sequential(
# Defining a 2D convolution layer
nn.Conv2d(3, 16, kernel_size=3, stride=1, padding=1),
nn.BatchNorm2d(16),
nn.ReLU(inplace=True),
nn.MaxPool2d(kernel_size=2, stride=2),
# Defining another 2D convolution layer
nn.Conv2d(16, 3, kernel_size=3, stride=1, padding=1),
nn.BatchNorm2d(3),
nn.ReLU(inplace=True),
nn.MaxPool2d(kernel_size=2, stride=2),
)
self.linear_layers = Sequential(
nn.Linear(3*67*45, 100),
nn.ReLU(),
nn.BatchNorm1d(100),
nn.Dropout(p=0.4),
nn.Linear(100,50),
nn.BatchNorm1d(50),
nn.Dropout(p=0.3),
nn.ReLU(),
nn.Linear(50,7),
nn.ReLU(),
nn.Sigmoid()
)
# Defining the forward pass
def forward(self, x):
x = self.cnn_layers(x)
x = x.view(x.size(0), -1)
x = self.linear_layers(x)
return x
Thank you in advance