Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

独热编码出错 #25

Open
PlutoNov opened this issue Jun 11, 2023 · 2 comments
Open

独热编码出错 #25

PlutoNov opened this issue Jun 11, 2023 · 2 comments

Comments

@PlutoNov
Copy link

我用的dota数据做了一下训练,但是每次到独热编码那一块就会报错为RuntimeError: Class values must be smaller than num_classes.

@PlutoNov
Copy link
Author

Traceback (most recent call last):
File "train.py", line 552, in
fit_one_epoch(model_train, model, ema, yolo_loss, loss_history, eval_callback, optimizer, epoch, epoch_step, epoch_step_val, gen, gen_val, UnFreeze_Epoch, Cuda, fp16, scaler, save_period, save_dir, local_rank)
File "/root/yolov7obb/utils/utils_fit.py", line 34, in fit_one_epoch
loss_value = yolo_loss(outputs, targets, images)
File "/root/yolov7obb/nets/yolo_training.py", line 104, in call
bs, as_, gjs, gis, targets, anchors = self.build_targets(predictions, targets, imgs)
File "/root/yolov7obb/nets/yolo_training.py", line 346, in build_targets
gt_cls_per_image = F.one_hot(this_target[:, 1].to(torch.int64), self.num_classes).float().unsqueeze(1).repeat(1, pxyxys.shape[0], 1)
RuntimeError: Class values must be smaller than num_classes.
报错是这个

@PlutoNov
Copy link
Author

已经解决了是我自己没有安排好数据集

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant