Closed yang-0201 closed 2 years ago
This problem is fixed now. Please git pull the latest code, or just convert the datatype of target_labels in ./yolov6\models\loss.py #line 100 by:
one_hot_label = F.one_hot(target_labels.long(), self.num_classes + 1)[..., :-1]
when I trained my datasets in YOLOV6-M,the first 4 epochs is normal,but in 5 epoch,an error is reported when you are about to verify.
ERROR in training steps. ERROR in training loop or eval/save model.
Training completed in 0.097 hours. Traceback (most recent call last): File "tools/train.py", line 126, in
main(args)
File "tools/train.py", line 116, in main
trainer.train()
File "I:\yolov6_new\yolov6\core\engine.py", line 99, in train
self.train_in_loop(self.epoch)
File "I:\yolov6_new\yolov6\core\engine.py", line 112, in train_in_loop
self.train_in_steps(epoch_num)
File "I:\yolov6_new\yolov6\core\engine.py", line 141, in train_in_steps
total_loss, loss_items = self.compute_loss(preds, targets, epoch_num)
File "I:\yolov6_new\yolov6\models\loss.py", line 100, in call
one_hot_label = F.one_hot(target_labels, self.num_classes + 1)[..., :-1]
RuntimeError: one_hot is only applicable to index tensor.