Skip to content
Snippets Groups Projects
Commit ac1d99bd authored by Schneider Leo's avatar Schneider Leo
Browse files

fix : weight Xent loss

parent 4ad03260
No related branches found
No related tags found
No related merge requests found
......@@ -53,7 +53,7 @@ def train_model(config,args):
elif config['optimizer']=='SGD' :
optimizer = optim.SGD(model.parameters(), lr=config["lr"], momentum=0.9)
# init training
n_class = data_train.dataset.classes
n_class = len(data_train.dataset.classes)
loss_function = nn.CrossEntropyLoss(weight=torch.Tensor([1/n_class,1-1/n_class]))
# Load existing checkpoint through `get_checkpoint()` API.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment