DAS1.1 下面的 paddlepaddle-2.5.2_dtk2404_git7ad272b3-cp310-cp310-manylinux2014_x86_64.whl 使用 PaddleYOLO,出现 muticlass_nms3 的相关问题.
DAS1.1 下面的 paddlepaddle-2.5.2_dtk2404_git7ad272b3-cp310-cp310-manylinux2014_x86_64.whl 使用 PaddleYOLO,出现 muticlass_nms3 的相关问题。
复现方法:
```python
git clone https://github.com/PaddlePaddle/PaddleYOLO
cd PaddleYOLO
pip install -r requirements.txt
python tools/infer.py -c configs/yolov8/yolov8_n_500e_coco.yml -o use_gpu=true weights=https://paddledet.bj.bcebos.com/models/yolov8_n_500e_coco.pdparams --infer_img=demo/000000014439.jpg
```
解决方案如下:
更改如下 PaddleYOLO/ppdet/modeling/ops.py 文件:
1. 强制使用非legacy模式:
# try:
# import paddle._legacy_C_ops as C_ops
# except:
# import paddle._C_ops as C_ops
import paddle._C_ops as C_ops
2. 更改`def multiclass_nms` 函数内部`attrs`内容:
# attrs = ('background_label', background_label, 'score_threshold',
# score_threshold, 'nms_top_k', nms_top_k, 'nms_threshold',
# nms_threshold, 'keep_top_k', keep_top_k, 'nms_eta', nms_eta,
# 'normalized', normalized)
attrs = (
score_threshold,
nms_top_k,
keep_top_k,
nms_threshold,
normalized,
nms_eta,
background_label,
)
DAS1.1 下面的 paddlepaddle-2.5.2_dtk2404_git7ad272b3-cp310-cp310-manylinux2014_x86_64.whl 使用 PaddleYOLO,出现 muticlass_nms3 的相关问题。
复现方法:
```python
git clone https://github.com/PaddlePaddle/PaddleYOLO
cd PaddleYOLO
pip install -r requirements.txt
python tools/infer.py -c configs/yolov8/yolov8_n_500e_coco.yml -o use_gpu=true weights=https://paddledet.bj.bcebos.com/models/yolov8_n_500e_coco.pdparams --infer_img=demo/000000014439.jpg
```
解决方案如下:
更改如下 PaddleYOLO/ppdet/modeling/ops.py 文件:
1. 强制使用非legacy模式:
```python
# try:
# import paddle._legacy_C_ops as C_ops
# except:
# import paddle._C_ops as C_ops
import paddle._C_ops as C_ops
```
2. 更改`def multiclass_nms` 函数内部`attrs`内容:
```python
# attrs = ('background_label', background_label, 'score_threshold',
# score_threshold, 'nms_top_k', nms_top_k, 'nms_threshold',
# nms_threshold, 'keep_top_k', keep_top_k, 'nms_eta', nms_eta,
# 'normalized', normalized)
attrs = (
score_threshold,
nms_top_k,
keep_top_k,
nms_threshold,
normalized,
nms_eta,
background_label,
)
```