mihaidusmanu / d2-net

D2-Net: A Trainable CNN for Joint Description and Detection of Local Features
Other
761 stars 163 forks source link

why the loss is always 1 #67

Closed OldAAAA closed 4 years ago

OldAAAA commented 4 years ago

I don't want to train the net with your original model file.so i change the parametres like this: model = D2Net( model_file=None, use_cuda=use_cuda ) but the result seems very bad,and the loss is always 1. I want to know if it is possible to train without your model file. 100%|█████████████| 77/77 [01:30<00:00, 1.18s/it] 100%|█████████████| 1875/1875 [11:24<00:00, 2.74it/s, loss=1.0914] Building a new training dataset... 100%|█████████████| 118/118 [14:15<00:00, 7.25s/it] 100%|█████████████| 11500/11500 [1:27:24<00:00, 2.19it/s, loss=1.0000] 100%|█████████████| 1875/1875 [12:02<00:00, 2.60it/s, loss=1.0000] Building a new training dataset... 100%|█████████████| 118/118 [14:15<00:00, 7.25s/it] 100%|█████████████| 11500/11500 [1:23:51<00:00, 2.29it/s, loss=1.0000] 100%|█████████████| 1875/1875 [11:18<00:00, 2.76it/s, loss=1.0000] Building a new training dataset... 100%|█████████████| 118/118 [14:16<00:00, 7.26s/it] 100%|█████████████| 11500/11500 [1:23:22<00:00, 2.30it/s, loss=1.0000] 100%|█████████████| 1875/1875 [11:19<00:00, 2.76it/s, loss=1.0000] Building a new training dataset... 100%|█████████████| 118/118 [13:15<00:00, 6.74s/it] 100%|█████████████| 11500/11500 [1:24:21<00:00, 2.27it/s, loss=1.0000] 100%|█████████████| 1875/1875 [11:20<00:00, 2.75it/s, loss=1.0000] Building a new training dataset... 100%|█████████████| 118/118 [13:53<00:00, 7.07s/it] 100%|█████████████| 11500/11500 [1:23:48<00:00, 2.29it/s, loss=1.0000] 100%|█████████████| 1875/1875 [11:20<00:00, 2.76it/s, loss=1.0000] Building a new training dataset... 100%|█████████████| 118/118 [13:50<00:00, 7.03s/it] 100%|█████████████| 11500/11500 [1:24:10<00:00, 2.28it/s, loss=1.0000] 100%|█████████████| 1875/1875 [11:20<00:00, 2.76it/s, loss=1.0000] Building a new training dataset... 100%|█████████████| 118/118 [13:17<00:00, 6.76s/it] 100%|█████████████| 11500/11500 [1:23:40<00:00, 2.29it/s, loss=1.0000] 100%|█████████████| 1875/1875 [11:21<00:00, 2.75it/s, loss=1.0000] Building a new training dataset... 100%|█████████████| 118/118 [13:31<00:00, 6.88s/it] 100%|█████████████| 11500/11500 [1:24:03<00:00, 2.28it/s, loss=1.0000] 100%||█████████████| 1875/1875 [11:20<00:00, 2.76it/s, loss=1.0000] Building a new training dataset... 100%|█████████████| 118/118 [12:56<00:00, 6.58s/it] 100%|█████████████| 11500/11500 [1:24:39<00:00, 2.26it/s, loss=1.0000] 100%|█████████████| 1875/1875 [11:21<00:00, 2.75it/s, loss=1.0000] Building a new training dataset... 100%|█████████████| 118/118 [13:43<00:00, 6.98s/it] 100%|████████████| 11500/11500 [1:23:12<00:00, 2.30it/s, loss=1.0000] 100%|█████████████| 1875/1875 [11:21<00:00, 2.75it/s, loss=1.0000]

mihaidusmanu commented 4 years ago

As mentioned in the paper, we fine-tuned the ImageNet pre-trained weights which is why we load the state dict from models/d2_ots.pth. The current training protocol and code is not suitable for training from scratch.

In your case the loss is 1 probably due to triplet collapse (the network predicts a constant output no matter on the image contents).