cwlee97 / YOLOv3_KITTI

0 stars 0 forks source link

RuntimeError: result type Float can't be cast to the desired output type __int64 #3

Closed cwlee97 closed 1 year ago

cwlee97 commented 1 year ago

(pytorch_py38) C:\Users\HP\Desktop\ws\python\YOLOV3>python main.py --mode train --cfg yolov3.cfg [{'type': 'net', 'batch': '2', 'subdivisions': '1', 'width': '640', 'height': '480', 'channels': '3', 'class': '8', 'momentum': '0.9', 'decay': '0.0005', 'angle': '0', 'saturation': '1.5', 'exposure': '1.5', 'hue': '.1', 'ignore_cls': '99', 'learning_rate': '0.01', 'burn_in': '1000', 'max_batches': '500200', 'policy': 'steps', 'steps': '400000,450000', 'scales': '.1,.1'}] {'batch': 2, 'subdivision': 1, 'momentum': 0.9, 'decay': 0.0005, 'saturation': 1.5, 'lr': 0.01, 'burn_in': 1000, 'max_batch': 500200, 'lr_policy': 'steps', 'in_width': 640, 'in_height': 480, 'in_channels': 3, 'classes': 8, 'ignore_class': 99} train device : cuda:0 C:\Users\HP\Desktop\ws\python\YOLOV3\dataloader\yolodata.py:106: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requiresgrad(True), rather than torch.tensor(sourceTensor). target_data = torch.cat((batch_idx.view(-1, 1), torch.tensor(bbox)), dim = 1) tensor([[0.0000, 3.0000, 0.2841, 0.7373, 0.0697, 0.5253]]) tensor([[1.0000, 0.0000, 0.8826, 0.6846, 0.0255, 0.4190], [1.0000, 0.0000, 0.7509, 0.5860, 0.2890, 0.4267], [1.0000, 5.0000, 0.4542, 0.4908, 0.0119, 0.1045], [1.0000, 0.0000, 0.1381, 0.6285, 0.1827, 0.2694], [1.0000, 0.0000, 0.2435, 0.5511, 0.1215, 0.1513], [1.0000, 0.0000, 0.3284, 0.5061, 0.0680, 0.0841]]) input: torch.Size([2, 3, 480, 640]) torch.Size([7, 6]) ai device: cuda:0 , targets device: cuda:0 Traceback (most recent call last): File "main.py", line 94, in train(cfg_param) File "main.py", line 73, in train trainer.run() File "C:\Users\HP\Desktop\ws\python\YOLOV3\train\trainer.py", line 48, in run self.run_iter() File "C:\Users\HP\Desktop\ws\python\YOLOV3\train\trainer.py", line 37, in run_iter self.yololoss.compute_loss(output, targets, self.model.yolo_layers) File "C:\Users\HP\Desktop\ws\python\YOLOV3\train\loss.py", line 26, in compute_loss tcls, tbox, tindices, tanchors = self.get_targets(pred, targets, yololayer) File "C:\Users\HP\Desktop\ws\python\YOLOV3\train\loss.py", line 96, in gettargets indices.append((b, a, gj.clamp(0, gain[3] - 1), gi.clamp_(0, gain[2] - 1)).long()) RuntimeError: result type Float can't be cast to the desired output type __int64

cwlee97 commented 1 year ago

https://github.com/ultralytics/yolov5/issues/8405