Closed PigLogic-Cyber closed 2 years ago
hello,I'm doing the same research.
Have you ever solved the problem?
please help me.
hello,I'm doing the same research. Have you ever solved the problem? please help me.
Try to modify the dict parameters in convert.py file, works for me, good luck, have fun : - )
Hello, what do you mean by “Try to modify the dict parameters in convert.py file”? Can you tell us more about it?Thanks!
I set up : model.nc=41 in train.py, single_cls = False in bdd.py, id_dict = {'xx':0, 'xx': 1,…… 'xx': 40} in convert.py but still I got the error said: Traceback (most recent call last): File "tools/train.py", line 395, in main() File "tools/train.py", line 323, in main epoch, num_batch, num_warmup, writer_dict, logger, device, rank) File "F:\yoloppp\YOLOP-main\lib\core\function.py", line 77, in train total_loss, head_losses = criterion(outputs, target, shapes,model) File "D:\anaconda\envs\yolop\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "F:\yoloppp\YOLOP-main\lib\core\loss.py", line 50, in forward total_loss, head_losses = self._forward_impl(head_fields, head_targets, shapes, model) File "F:\yoloppp\YOLOP-main\lib\core\loss.py", line 107, in _forward_impl t[range(n), tcls[i]] = cp IndexError: index 26 is out of bounds for dimension 1 with size 1
这个是因为YOLOP.py搭建网络里面nc默认设置成了1,需要改为我们自己的nc(例如41)
like this!
按照之前的步骤操作,可以训练,但是将要训练下一轮的时候出现如下错误:
Epoch: [1][1340/1342] Time 396.972s (200.944s) Speed 0.0 samples/s Data 396.692s (200.649s) Loss 0.69399 (0.75016)
0%| | 0/146 [00:00<?, ?it/s]F:\Anaconda\envs\yoloair\lib\site-packages\torch\nn\functional.py:3060: UserWarning: Default upsampling behavior when mode=bilinear is changed to align_corners=False since 0.4.0. Please specify align_corners=True if the old behavior is desired. See the documentation of nn.Upsample for details.
warnings.warn("Default upsampling behavior when mode={} is changed "
0%| | 0/146 [00:01<?, ?it/s]
Traceback (most recent call last):
File "tools/train.py", line 395, in
按照之前的步骤操作,可以训练,但是将要训练下一轮的时候出现如下错误: Epoch: [1][1340/1342] Time 396.972s (200.944s) Speed 0.0 samples/s Data 396.692s (200.649s) Loss 0.69399 (0.75016) 0%| | 0/146 [00:00<?, ?it/s]F:\Anaconda\envs\yoloair\lib\site-packages\torch\nn\functional.py:3060: UserWarning: Default upsampling behavior when mode=bilinear is changed to align_corners=False since 0.4.0. Please specify align_corners=True if the old behavior is desired. See the documentation of nn.Upsample for details. warnings.warn("Default upsampling behavior when mode={} is changed " 0%| | 0/146 [00:01<?, ?it/s] Traceback (most recent call last): File "tools/train.py", line 395, in main() File "tools/train.py", line 330, in main da_segment_results,ll_segment_results,detect_results, total_loss,maps, times = validate( File "D:\YOLOP\YOLOP-main\lib\core\function.py", line 301, in validate label_det_pred = f'{names[int(cls)]} {conf:.2f}' KeyError: 35
search for nc = 1
change them to your class number
could you tell me more detail about it plz?I have no idea on where I can find nc=1 except model.nc in train.py...
I created a fork and updated the code for BDD's 13 classes. Check it out here.
First of all, thx for your great jobs! The YOLOP model right now seems to have the ability to detect only the car, if I would like to detect more classes of object, what parameters should I modified? I had already tried to modify
model.nc
in train.py to be 41, change thesingle_cls
to be False in bdd.py, uncomment thebdd_labels
dict in convert.py, but still I got the error said:Traceback (most recent call last): File "tools/train.py", line 406, in
main()
File "tools/train.py", line 333, in main
train(cfg, train_loader, model, criterion, optimizer, scaler,
File "/home/roy/Github/YOLOP/lib/core/function.py", line 77, in train
total_loss, head_losses = criterion(outputs, target, shapes,model)
File "/home/roy/anaconda3/envs/pytorch/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/home/roy/Github/YOLOP/lib/core/loss.py", line 50, in forward
total_loss, head_losses = self._forward_impl(head_fields, head_targets, shapes, model)
File "/home/roy/Github/YOLOP/lib/core/loss.py", line 96, in _forward_impl
iou = bbox_iou(pbox.T, tbox[i], x1y1x2y2=False, CIoU=True) # iou(prediction, target)
File "/home/roy/Github/YOLOP/lib/core/general.py", line 38, in bbox_iou
print(box1[0] - box1[2] / 2)
File "/home/roy/anaconda3/envs/pytorch/lib/python3.8/site-packages/torch/_tensor.py", line 249, in repr
return torch._tensor_str._str(self)
File "/home/roy/anaconda3/envs/pytorch/lib/python3.8/site-packages/torch/_tensor_str.py", line 415, in _str
return _str_intern(self)
File "/home/roy/anaconda3/envs/pytorch/lib/python3.8/site-packages/torch/_tensor_str.py", line 390, in _str_intern
tensor_str = _tensor_str(self, indent)
File "/home/roy/anaconda3/envs/pytorch/lib/python3.8/site-packages/torch/_tensor_str.py", line 251, in _tensor_str
formatter = _Formatter(get_summarized_data(self) if summarize else self)
File "/home/roy/anaconda3/envs/pytorch/lib/python3.8/site-packages/torch/_tensor_str.py", line 90, in init
nonzero_finite_vals = torch.masked_select(tensor_view, torch.isfinite(tensor_view) & tensor_view.ne(0))
RuntimeError: CUDA error: device-side assert triggered
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.
Please help me out!