PaddlePaddle / PaddleDetection

Object Detection toolkit based on PaddlePaddle. It supports object detection, instance segmentation, multiple object tracking and real-time multi-person keypoint detection.
Apache License 2.0
12.83k stars 2.89k forks source link

yoloe的nms修改为MatrixNMS,训练时候正常,但是导出模型时候报错,请教一下怎么处理 #9218

Open yywangfei opened 1 week ago

yywangfei commented 1 week ago

问题确认 Search before asking

请提出你的问题 Please ask your question

config文件修改为: image ba报错如下: TypeError: In transformed code:

File "/data/wangfei/PaddleX/paddlex/repo_manager/repos/PaddleDetection/ppdet/modeling/architectures/meta_arch.py", line 59, in forward
    if self.training:
File "/data/wangfei/PaddleX/paddlex/repo_manager/repos/PaddleDetection/ppdet/modeling/architectures/meta_arch.py", line 69, in forward
    for inp in inputs_list:
File "/data/wangfei/PaddleX/paddlex/repo_manager/repos/PaddleDetection/ppdet/modeling/architectures/meta_arch.py", line 76, in forward
    outs.append(self.get_pred())
File "/data/wangfei/PaddleX/paddlex/repo_manager/repos/PaddleDetection/ppdet/modeling/architectures/yolo.py", line 150, in get_pred
    return self._forward()
File "/data/wangfei/PaddleX/paddlex/repo_manager/repos/PaddleDetection/ppdet/modeling/architectures/yolo.py", line 92, in _forward
    if self.training:
File "/data/wangfei/PaddleX/paddlex/repo_manager/repos/PaddleDetection/ppdet/modeling/architectures/yolo.py", line 103, in _forward
    if self.for_mot:
File "/data/wangfei/PaddleX/paddlex/repo_manager/repos/PaddleDetection/ppdet/modeling/architectures/yolo.py", line 115, in _forward
    if self.return_idx:
File "/data/wangfei/PaddleX/paddlex/repo_manager/repos/PaddleDetection/ppdet/modeling/architectures/yolo.py", line 119, in _forward
    elif self.post_process is not None:
File "/data/wangfei/PaddleX/paddlex/repo_manager/repos/PaddleDetection/ppdet/modeling/architectures/yolo.py", line 126, in _forward
    bbox, bbox_num, nms_keep_idx = self.yolo_head.post_process(
File "/data/wangfei/PaddleX/paddlex/repo_manager/repos/PaddleDetection/ppdet/modeling/heads/ppyoloe_head.py", line 531, in post_process
    if self.exclude_post_process:
File "/data/wangfei/PaddleX/paddlex/repo_manager/repos/PaddleDetection/ppdet/modeling/heads/ppyoloe_head.py", line 542, in post_process
    if self.exclude_nms:
File "/data/wangfei/PaddleX/paddlex/repo_manager/repos/PaddleDetection/ppdet/modeling/heads/ppyoloe_head.py", line 546, in post_process
    bbox_pred, bbox_num, nms_keep_idx = self.nms(pred_bboxes,
File "/data/wangfei/PaddleX/paddlex/repo_manager/repos/PaddleDetection/ppdet/modeling/layers.py", line 605, in __call__
    def __call__(self, bbox, score, *args):
        return ops.matrix_nms(
        ~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
            bboxes=bbox,
            scores=score,

File "/data/wangfei/PaddleX/paddlex/repo_manager/repos/PaddleDetection/ppdet/modeling/ops.py", line 714, in matrix_nms
    helper.append_op(
File "/usr/local/lib/python3.10/dist-packages/paddle/base/layer_helper.py", line 57, in append_op
    return self.main_program.current_block().append_op(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/paddle/base/framework.py", line 4702, in append_op
    op = Operator(
File "/usr/local/lib/python3.10/dist-packages/paddle/base/framework.py", line 3326, in __init__
    raise TypeError(

TypeError: The type of '%BBoxes' in operator matrix_nms should be one of [str, bytes, Variable]. but received : Value(define_op_name=pd_op.divide, index=0, dtype=builtin.tensor<-1x8400x4xf32>, stop_gradient=False)
zhangyubo0722 commented 4 days ago

使用的什么版本的paddlepaddle和PaddleDetection的哪个分支呢,建议在最新版本的分支下运行

yywangfei commented 1 day ago

使用的什么版本的paddlepaddle和PaddleDetection的哪个分支呢,建议在最新版本的分支下运行

用的是最新的分支,paddle版本也是3.0. 换nms算子的原因是在海光显卡不支持multilabel_nms

yywangfei commented 1 day ago

image 升级paddle到3.0版本,推理报错