-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Same output for every image input #169
Comments
Can you please provide more information, for example, your loss function, training configuration, loss curves, etc? |
This is the model creation Below is the model configuration: Training Loop: for epoch in range(num_epochs):
n_parameters = sum(p.numel() for p in model.parameters() if p.requires_grad)
print(n_parameters)
for i, (samples, score) in enumerate(train_set):
optimizer.zero_grad()
samples = samples.cuda()
score = score.cuda()
outputs = model(samples)
loss = criterion(outputs.squeeze(), score)
loss.backward()
optimizer.step()
lr_scheduler.step_update(epoch * num_steps + i)
torch.cuda.synchronize()
lr = optimizer.param_groups[0]['lr']
#train_one_epoch(model, criterion, train_set, optimizer, epoch, lr_scheduler, num_epochs)
acc1, acc5, loss, corr, spear = validate(val_set, model)
print(f"Correlation on {len(val_set)} test images: {corr:.7f}%" + " " +str(spear))
f = open("temp.txt", "a+")
f.write("\n"+str(corr)+"\n")
f.close() Loss Function used is mean squared error. |
I am trying to use SWIN Transformers for a problem that maps every image to a score of 1 to 100
When in initialize the model, everything works fine. But after training 1 epoch. the model gives the same output for every image.
I tried changing a few parameters.
Any suggestion what could be the reason behind this?
Thanks
The text was updated successfully, but these errors were encountered: