PaddleDetection icon indicating copy to clipboard operation
PaddleDetection copied to clipboard

关于新增训练类别的疑问

Open AntyRia opened this issue 2 years ago • 2 comments

问题确认 Search before asking

  • [X] 我已经搜索过问题,但是没有找到解答。I have searched the question and found no related answer.

请提出你的问题 Please ask your question

场景描述:使用pp-yolove+,现在有一个新的已标注的数据集(共两个类:people类、handheld类),其中handheld类不在原来coco的80类中。因此想要新增这个类别。想咨询一下针对这种情况,我应该如何配置预训练模型,最终我想实现的目标是只识别people类和handheld类,其他类识别不了无所谓。

目前尝试:python tools/train.py -c configs/ppyoloe/ppyoloe_plus_crn_l_80e_coco.yml --eval --amp,报错 loading annotations into memory... Done (t=0.02s) creating index... index created! [06/20 06:28:01] ppdet.data.source.coco INFO: Load [737 samples valid, 0 samples invalid] in file dataset/coco/annotations/train.json. [06/20 06:28:01] reader WARNING: Shared memory size is less than 1G, disable shared_memory in DataLoader W0620 06:28:01.655288 12777 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 8.6, Driver API Version: 11.6, Runtime API Version: 11.2 W0620 06:28:01.659766 12777 gpu_resources.cc:91] device: 0, cuDNN Version: 8.2. [06/20 06:28:06] ppdet.utils.checkpoint INFO: The shape [365] in pretrained weight yolo_head.pred_cls.0.bias is unmatched with the shape [81] in model yolo_head.pred_cls.0.bias. And the weight yolo_head.pred_cls.0.bias will not be loaded [06/20 06:28:06] ppdet.utils.checkpoint INFO: The shape [365, 768, 3, 3] in pretrained weight yolo_head.pred_cls.0.weight is unmatched with the shape [81, 768, 3, 3] in model yolo_head.pred_cls.0.weight. And the weight yolo_head.pred_cls.0.weight will not be loaded [06/20 06:28:06] ppdet.utils.checkpoint INFO: The shape [365] in pretrained weight yolo_head.pred_cls.1.bias is unmatched with the shape [81] in model yolo_head.pred_cls.1.bias. And the weight yolo_head.pred_cls.1.bias will not be loaded [06/20 06:28:06] ppdet.utils.checkpoint INFO: The shape [365, 384, 3, 3] in pretrained weight yolo_head.pred_cls.1.weight is unmatched with the shape [81, 384, 3, 3] in model yolo_head.pred_cls.1.weight. And the weight yolo_head.pred_cls.1.weight will not be loaded [06/20 06:28:06] ppdet.utils.checkpoint INFO: The shape [365] in pretrained weight yolo_head.pred_cls.2.bias is unmatched with the shape [81] in model yolo_head.pred_cls.2.bias. And the weight yolo_head.pred_cls.2.bias will not be loaded [06/20 06:28:06] ppdet.utils.checkpoint INFO: The shape [365, 192, 3, 3] in pretrained weight yolo_head.pred_cls.2.weight is unmatched with the shape [81, 192, 3, 3] in model yolo_head.pred_cls.2.weight. And the weight yolo_head.pred_cls.2.weight will not be loaded [06/20 06:28:06] ppdet.utils.checkpoint INFO: Finish loading model weights: /root/.cache/paddle/weights/ppyoloe_crn_l_obj365_pretrained.pdparams Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertion p_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depthfailed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Error: /paddle/paddle/phi/kernels/gpu/one_hot_kernel.cu:38 Assertionp_in_data[idx] >= 0 && p_in_data[idx] < depth failed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [82], but received [0]. Traceback (most recent call last): File "tools/train.py", line 202, in <module> main() File "tools/train.py", line 198, in main run(FLAGS, cfg) File "tools/train.py", line 151, in run trainer.train(FLAGS.eval) File "/data/train/PaddleDetection/ppdet/engine/trainer.py", line 518, in train outputs = model(data) File "/usr/local/lib/python3.7/dist-packages/paddle/fluid/dygraph/layers.py", line 1012, in __call__ return self.forward(*inputs, **kwargs) File "/data/train/PaddleDetection/ppdet/modeling/architectures/meta_arch.py", line 60, in forward out = self.get_loss() File "/data/train/PaddleDetection/ppdet/modeling/architectures/yolo.py", line 147, in get_loss return self._forward() File "/data/train/PaddleDetection/ppdet/modeling/architectures/yolo.py", line 93, in _forward yolo_losses = self.yolo_head(neck_feats, self.inputs) File "/usr/local/lib/python3.7/dist-packages/paddle/fluid/dygraph/layers.py", line 1012, in __call__ return self.forward(*inputs, **kwargs) File "/data/train/PaddleDetection/ppdet/modeling/heads/ppyoloe_head.py", line 264, in forward return self.forward_train(feats, targets, aux_pred) File "/data/train/PaddleDetection/ppdet/modeling/heads/ppyoloe_head.py", line 201, in forward_train ], targets, aux_pred) File "/data/train/PaddleDetection/ppdet/modeling/heads/ppyoloe_head.py", line 398, in get_loss pred_bboxes=pred_bboxes.detach() * stride_tensor) File "/usr/local/lib/python3.7/dist-packages/paddle/fluid/dygraph/layers.py", line 1012, in __call__ return self.forward(*inputs, **kwargs) File "/usr/local/lib/python3.7/dist-packages/decorator.py", line 232, in fun return caller(func, *(extras + args), **kw) File "/usr/local/lib/python3.7/dist-packages/paddle/fluid/dygraph/base.py", line 375, in _decorate_function return func(*args, **kwargs) File "/data/train/PaddleDetection/ppdet/modeling/assigners/atss_assigner.py", line 211, in forward assigned_scores, paddle.to_tensor(ind), axis=-1) File "/usr/local/lib/python3.7/dist-packages/paddle/tensor/creation.py", line 546, in to_tensor return _to_tensor_non_static(data, dtype, place, stop_gradient) File "/usr/local/lib/python3.7/dist-packages/paddle/tensor/creation.py", line 411, in _to_tensor_non_static stop_gradient=stop_gradient, OSError: (External) CUDA error(719), unspecified launch failure. [Hint: Please search for the error code(719) on website (https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TYPES.html#group__CUDART__TYPES_1g3f51e3575c2178246db0a94a430e0038) to get Nvidia's official solution and advice about CUDA Error.] (at /paddle/paddle/phi/backends/gpu/cuda/cuda_info.cc:259)

AntyRia avatar Jun 20 '23 07:06 AntyRia

@zhangjun @ZeyuChen @llxxxll @QingshuChen

AntyRia avatar Jun 20 '23 07:06 AntyRia

模型config里全部的num_classes改成你想要的

lyuwenyu avatar Feb 28 '24 06:02 lyuwenyu