Why does my training loss have regular spikes?

后端 未结 3 1581
北荒
北荒 2021-02-01 06:54

I\'m training the Keras object detection model linked at the bottom of this question, although I believe my problem has to do neither with Keras nor with the specific model I\'m

3条回答
  •  死守一世寂寞
    2021-02-01 07:31

    For anyone working in PyTorch, an easy solution which solves this specific problem is to specify in the DataLoader to drop the last batch:

    train_loader = torch.utils.data.DataLoader(train_set, batch_size=batch_size, shuffle=False, 
                                              pin_memory=(torch.cuda.is_available()), 
                                              num_workers=num_workers, drop_last=True)
    

提交回复
热议问题