Commit 62c6c201 authored by Félix Michaud's avatar Félix Michaud
Browse files

kernel 5

parent 3bab0f9d
......@@ -38,7 +38,8 @@ def create_optimizer(nets, args):
def unwrap_mask(infos):
gt_masks = torch.empty(args.batch_size, args.nb_classes, 256, 44, dtype=torch.float)
# gt_masks = torch.empty(args.batch_size, args.nb_classes, 256, 44, dtype=torch.float)
gt_masks = torch.empty(args.batch_size, args.nb_classes, 264, 52, dtype=torch.float)
for ii in range(args.batch_size):
for jj in range(args.nb_classes):
gt_masks[ii, jj] = infos[jj][2][ii]
......@@ -63,14 +64,14 @@ def train(net, loader_train, optimizer, args):
# #writing of the Loss values and elapsed time for every batch
batchtime = (time.time() - args.starting_training_time)/60 #minutes
# #Writing of the elapsed time and loss for every batch
with open("./losses/loss_train/loss_times5.csv", "a") as f:
with open("./losses/loss_train/loss_times5kernel5.csv", "a") as f:
writer = csv.writer(f)
writer.writerow([str(loss.cpu().detach().numpy()), batchtime, num_batch])
if ii%args.save_per_batchs == 0:
torch.save({
'model_state_dict': net.state_dict(),
'optimizer_state_dict': optimizer.state_dict()},
'Saved_models3/model5_batchs{}.pth.tar'.format(num_batch))
'Saved_models3/model5kernel5_batchs{}.pth.tar'.format(num_batch))
#***************************************************
#****************** MAIN ***************************
......@@ -97,7 +98,7 @@ if __name__ == '__main__':
###########################################################
if args.mode == 'train':
#OverWrite the Files for loss saving and time saving
fichierLoss = open("./losses/loss_train/loss_times5.csv", "w")
fichierLoss = open("./losses/loss_train/loss_times5kernel5.csv", "w")
fichierLoss.close()
#Dataset loading
root = './data_sound/trainset/'
......@@ -116,7 +117,7 @@ if __name__ == '__main__':
torch.save({
'model_state_dict': net.state_dict(),
'optimizer_state_dict': optimizer.state_dict()},
'Saved_models3/model5epoch{}.pth.tar'.format(epoch))
'Saved_models3/model5kernel5epoch{}.pth.tar'.format(epoch))
###########################################################
################### EVALUATION ############################
###########################################################
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment