Giter VIP home page Giter VIP logo

paddlepaddle / paddleyolo Goto Github PK

View Code? Open in Web Editor NEW
508.0 13.0 126.0 307 MB

🚀🚀🚀 YOLO series of PaddlePaddle implementation, PP-YOLOE+, RT-DETR, YOLOv5, YOLOv6, YOLOv7, YOLOv8, YOLOX, YOLOv5u, YOLOv7u, YOLOv6Lite, RTMDet and so on. 🚀🚀🚀

Home Page: https://github.com/PaddlePaddle/PaddleYOLO

License: GNU General Public License v3.0

Shell 3.39% Python 76.90% CMake 0.62% C++ 17.03% Makefile 0.32% C 0.15% Cuda 1.58%
ppyolo ppyoloe yolov5 yolov6 yolov7 yolox object-detection ppyolov2 yolo yolov3

paddleyolo's Introduction

简体中文 | English

简介

PaddleYOLO是基于PaddleDetection的YOLO系列模型库,只包含YOLO系列模型的相关代码,支持YOLOv3PP-YOLOPP-YOLOv2PP-YOLOEPP-YOLOE+RT-DETRYOLOXYOLOv5YOLOv6YOLOv7YOLOv8YOLOv5uYOLOv7uYOLOv6LiteRTMDet等模型,COCO数据集模型库请参照 ModelZooconfigs

注意:

  • PaddleYOLO 代码库协议为 GPL 3.0YOLOv5YOLOv6YOLOv7YOLOv8这几类模型代码不合入PaddleDetection,其余YOLO模型推荐在PaddleDetection中使用,会最先发布PP-YOLO系列特色检测模型的最新进展
  • PaddleYOLO代码库推荐使用paddlepaddle-2.4.2以上的版本,请参考官网下载对应适合版本,Windows平台请安装paddle develop版本
  • PaddleYOLO 的Roadmap issue用于收集用户的需求,欢迎提出您的建议和需求;

教程

安装

Clone 代码库和安装 requirements.txt,环境需要在一个 Python>=3.7.0 下的环境,且需要安装 PaddlePaddle>=2.4.2

git clone https://github.com/PaddlePaddle/PaddleYOLO  # clone
cd PaddleYOLO
pip install -r requirements.txt  # install
训练/验证/预测/ 将以下命令写在一个脚本文件里如```run.sh```,一键运行命令为:```sh run.sh```,也可命令行一句句去运行。
model_name=ppyoloe # 可修改,如 yolov7
job_name=ppyoloe_plus_crn_s_80e_coco # 可修改,如 yolov7_tiny_300e_coco

config=configs/${model_name}/${job_name}.yml
log_dir=log_dir/${job_name}
# weights=https://bj.bcebos.com/v1/paddledet/models/${job_name}.pdparams
weights=output/${job_name}/model_final.pdparams

# 1.训练(单卡/多卡),加 --eval 表示边训边评估,加 --amp 表示混合精度训练
# CUDA_VISIBLE_DEVICES=0 python tools/train.py -c ${config} --eval --amp
python -m paddle.distributed.launch --log_dir=${log_dir} --gpus 0,1,2,3,4,5,6,7 tools/train.py -c ${config} --eval --amp

# 2.评估,加 --classwise 表示输出每一类mAP
CUDA_VISIBLE_DEVICES=0 python tools/eval.py -c ${config} -o weights=${weights} --classwise

# 3.预测 (单张图/图片文件夹)
CUDA_VISIBLE_DEVICES=0 python tools/infer.py -c ${config} -o weights=${weights} --infer_img=demo/000000014439_640x640.jpg --draw_threshold=0.5
# CUDA_VISIBLE_DEVICES=0 python tools/infer.py -c ${config} -o weights=${weights} --infer_dir=demo/ --draw_threshold=0.5
部署/测速

将以下命令写在一个脚本文件里如run.sh,一键运行命令为:sh run.sh,也可命令行一句句去运行。

model_name=ppyoloe # 可修改,如 yolov7
job_name=ppyoloe_plus_crn_s_80e_coco # 可修改,如 yolov7_tiny_300e_coco

config=configs/${model_name}/${job_name}.yml
log_dir=log_dir/${job_name}
# weights=https://bj.bcebos.com/v1/paddledet/models/${job_name}.pdparams
weights=output/${job_name}/model_final.pdparams

# 4.导出模型,以下3种模式选一种
## 普通导出,加trt表示用于trt加速,对NMS和silu激活函数提速明显
CUDA_VISIBLE_DEVICES=0 python tools/export_model.py -c ${config} -o weights=${weights} # trt=True

## exclude_post_process去除后处理导出,返回和YOLOv5导出ONNX时相同格式的concat后的1个Tensor,是未缩放回原图的坐标+分类置信度
# CUDA_VISIBLE_DEVICES=0 python tools/export_model.py -c ${config} -o weights=${weights} exclude_post_process=True # trt=True

## exclude_nms去除NMS导出,返回2个Tensor,是缩放回原图后的坐标和分类置信度
# CUDA_VISIBLE_DEVICES=0 python tools/export_model.py -c ${config} -o weights=${weights} exclude_nms=True # trt=True

# 5.部署预测,注意不能使用 去除后处理 或 去除NMS 导出后的模型去预测
CUDA_VISIBLE_DEVICES=0 python deploy/python/infer.py --model_dir=output_inference/${job_name} --image_file=demo/000000014439_640x640.jpg --device=GPU

# 6.部署测速,加 “--run_mode=trt_fp16” 表示在TensorRT FP16模式下测速,注意如需用到 trt_fp16 则必须为加 trt=True 导出的模型
CUDA_VISIBLE_DEVICES=0 python deploy/python/infer.py --model_dir=output_inference/${job_name} --image_file=demo/000000014439_640x640.jpg --device=GPU --run_benchmark=True # --run_mode=trt_fp16

# 7.onnx导出,一般结合 exclude_post_process去除后处理导出的模型
paddle2onnx --model_dir output_inference/${job_name} --model_filename model.pdmodel --params_filename model.pdiparams --opset_version 12 --save_file ${job_name}.onnx

# 8.onnx trt测速
/usr/local/TensorRT-8.0.3.4/bin/trtexec --onnx=${job_name}.onnx --workspace=4096 --avgRuns=10 --shapes=input:1x3x640x640 --fp16
/usr/local/TensorRT-8.0.3.4/bin/trtexec --onnx=${job_name}.onnx --workspace=4096 --avgRuns=10 --shapes=input:1x3x640x640 --fp32
  • 如果想切换模型,只要修改开头两行即可,如:
    model_name=yolov7
    job_name=yolov7_tiny_300e_coco
    
  • 导出onnx,首先安装Paddle2ONNXpip install paddle2onnx
  • 统计FLOPs(G)和Params(M),首先安装PaddleSlimpip install paddleslim,然后设置runtime.ymlprint_flops: Trueprint_params: True,并且注意确保是单尺度下如640x640,打印的是MACs,FLOPs=2*MACs
[训练自定义数据集](#43)
  • 请参照文档issue
  • PaddleDetection团队提供了基于PP-YOLOE的各种垂类检测模型的配置文件和权重,用户也可以作为参考去使用自定义数据集。请参考 PP-YOLOE applicationpphumanppvehiclevisdronesmalldet
  • PaddleDetection团队也提供了VOC数据集的各种YOLO模型的配置文件和权重,用户也可以作为参考去使用自定义数据集。请参考 voc
  • 训练自定义数据集之前请先确保加载了对应COCO权重作为预训练,将配置文件中的pretrain_weights: 设置为对应COCO模型训好的权重,一般会提示head分类层卷积的通道数没对应上,属于正常现象,是由于自定义数据集一般和COCO数据集种类数不一致;
  • YOLO检测模型建议batch_size至少大于64去训练,如果资源不够请换小模型减小模型的输入尺度,为了保障较高检测精度,尽量不要尝试单卡训和总batch_size小于64

更新日志

  • 【2023/05/21】支持RT-DETRYOLOv8YOLOv5uYOLOv7u训练全流程,支持YOLOv6Lite预测和部署;
  • 【2023/03/13】支持YOLOv5uYOLOv7u预测和部署;
  • 【2023/01/10】支持YOLOv8预测和部署;
  • 【2022/09/29】支持RTMDet预测和部署;
  • 【2022/09/26】发布PaddleYOLO模型套件,请参照ModelZoo
  • 【2022/09/19】支持YOLOv6新版,包括n/t/s/m/l模型;
  • 【2022/08/23】发布YOLOSeries代码库: 支持YOLOv3,PP-YOLOE,PP-YOLOE+,YOLOX,YOLOv5,YOLOv6,YOLOv7等YOLO模型,支持ConvNeXt骨干网络高精度版PP-YOLOE,YOLOXYOLOv5等模型,支持PaddleSlim无损加速量化训练PP-YOLOE,YOLOv5,YOLOv6YOLOv7等模型,详情可阅读此文章

产品动态

  • 🔥 2023.3.14:PaddleYOLO发布release/2.6版本

    • 💡 模型套件:
      • 支持YOLOv8,YOLOv5u,YOLOv7u等YOLO模型预测和部署;
      • 支持Swin-TransformerViTFocalNet骨干网络高精度版PP-YOLOE+等模型;
      • 支持YOLOv8FastDeploy中多硬件快速部署;
  • 🔥 2022.9.26:PaddleYOLO发布release/2.5版本

    • 💡 模型套件:
      • 发布PaddleYOLO模型套件: 支持YOLOv3,PP-YOLOE,PP-YOLOE+,YOLOX,YOLOv5,YOLOv6,YOLOv7等YOLO模型,支持ConvNeXt骨干网络高精度版PP-YOLOE,YOLOXYOLOv5等模型,支持PaddleSlim无损加速量化训练PP-YOLOE,YOLOv5,YOLOv6YOLOv7等模型;
  • 🔥 2022.8.26:PaddleDetection发布release/2.5版本

    • 🗳 特色模型:
      • 发布PP-YOLOE+,最高精度提升2.4% mAP,达到54.9% mAP,模型训练收敛速度提升3.75倍,端到端预测速度最高提升2.3倍;多个下游任务泛化性提升
      • 发布PicoDet-NPU模型,支持模型全量化部署;新增PicoDet版面分析模型
      • 发布PP-TinyPose升级版增强版,在健身、舞蹈等场景精度提升9.1% AP,支持侧身、卧躺、跳跃、高抬腿等非常规动作
    • 🔮 场景能力:
      • 发布行人分析工具PP-Human v2,新增打架、打电话、抽烟、闯入四大行为识别,底层算法性能升级,覆盖行人检测、跟踪、属性三类核心算法能力,提供保姆级全流程开发及模型优化策略,支持在线视频流输入
      • 首次发布PP-Vehicle,提供车牌识别、车辆属性分析(颜色、车型)、车流量统计以及违章检测四大功能,兼容图片、在线视频流、视频输入,提供完善的二次开发文档教程
    • 💡 前沿算法:
      • 全面覆盖的YOLO家族经典与最新模型: 包括YOLOv3,百度飞桨自研的实时高精度目标检测检测模型PP-YOLOE,以及前沿检测算法YOLOv4、YOLOv5、YOLOX,YOLOv6及YOLOv7
      • 新增基于ViT骨干网络高精度检测模型,COCO数据集精度达到55.7% mAP;新增OC-SORT多目标跟踪模型;新增ConvNeXt骨干网络
    • 📋 产业范例:新增智能健身打架识别来客分析、车辆结构化范例
  • 2022.3.24:PaddleDetection发布release/2.4版本

    • 发布高精度云边一体SOTA目标检测模型PP-YOLOE,提供s/m/l/x版本,l版本COCO test2017数据集精度51.6%,V100预测速度78.1 FPS,支持混合精度训练,训练较PP-YOLOv2加速33%,全系列多尺度模型,满足不同硬件算力需求,可适配服务器、边缘端GPU及其他服务器端AI加速卡。
    • 发布边缘端和CPU端超轻量SOTA目标检测模型PP-PicoDet增强版,精度提升2%左右,CPU预测速度提升63%,新增参数量0.7M的PicoDet-XS模型,提供模型稀疏化和量化功能,便于模型加速,各类硬件无需单独开发后处理模块,降低部署门槛。
    • 发布实时行人分析工具PP-Human,支持行人跟踪、人流量统计、人体属性识别与摔倒检测四大能力,基于真实场景数据特殊优化,精准识别各类摔倒姿势,适应不同环境背景、光线及摄像角度。
    • 新增YOLOX目标检测模型,支持nano/tiny/s/m/l/x版本,x版本COCO val2017数据集精度51.8%。
  • 更多版本发布

简介

PaddleDetection为基于飞桨PaddlePaddle的端到端目标检测套件,内置30+模型算法250+预训练模型,覆盖目标检测、实例分割、跟踪、关键点检测等方向,其中包括服务器端和移动端高精度、轻量级产业级SOTA模型、冠军方案和学术前沿算法,并提供配置化的网络模块组件、十余种数据增强策略和损失函数等高阶优化支持和多种部署方案,在打通数据处理、模型开发、训练、压缩、部署全流程的基础上,提供丰富的案例及教程,加速算法产业落地应用。

特性

  • 模型丰富: 包含目标检测实例分割人脸检测关键点检测多目标跟踪250+个预训练模型,涵盖多种全球竞赛冠军方案。
  • 使用简洁:模块化设计,解耦各个网络组件,开发者轻松搭建、试用各种检测模型及优化策略,快速得到高性能、定制化的算法。
  • 端到端打通: 从数据增强、组网、训练、压缩、部署端到端打通,并完备支持云端/边缘端多架构、多设备部署。
  • 高性能: 基于飞桨的高性能内核,模型训练速度及显存占用优势明显。支持FP16训练, 支持多机训练。

技术交流

  • 如果你发现任何PaddleDetection存在的问题或者是建议, 欢迎通过GitHub Issues给我们提issues。

  • 欢迎加入PaddleDetection 微信用户群(扫码填写问卷即可入群)

    • 入群福利 💎:获取PaddleDetection团队整理的重磅学习大礼包🎁
      • 📊 福利一:获取飞桨联合业界企业整理的开源数据集
      • 👨‍🏫 福利二:获取PaddleDetection历次发版直播视频与最新直播咨询
      • 🗳 福利三:获取垂类场景预训练模型集合,包括工业、安防、交通等5+行业场景
      • 🗂 福利四:获取10+全流程产业实操范例,覆盖火灾烟雾检测、人流量计数等产业高频场景

套件结构概览

Architectures Backbones Components Data Augmentation
    Object Detection
    • YOLOv3
    • YOLOv5
    • YOLOv6
    • YOLOv7
    • YOLOv8
    • PP-YOLOv1/v2
    • PP-YOLO-Tiny
    • PP-YOLOE
    • PP-YOLOE+
    • YOLOX
    • RTMDet
Details
  • ResNet(&vd)
  • CSPResNet
  • DarkNet
  • CSPDarkNet
  • ConvNeXt
  • EfficientRep
  • CSPBepBackbone
  • ELANNet
  • CSPNeXt
Common
  • Sync-BN
  • Group Norm
  • DCNv2
  • EMA
FPN
  • YOLOv3FPN
  • PPYOLOFPN
  • PPYOLOTinyFPN
  • PPYOLOPAN
  • YOLOCSPPAN
  • Custom-PAN
  • RepPAN
  • CSPRepPAN
  • ELANFPN
  • ELANFPNP6
  • CSPNeXtPAFPN
Loss
  • Smooth-L1
  • GIoU/DIoU/CIoU
  • IoUAware
  • Focal Loss
  • VariFocal Loss
Post-processing
  • SoftNMS
  • MatrixNMS
Speed
  • FP16 training
  • Multi-machine training
Details
  • Resize
  • Lighting
  • Flipping
  • Expand
  • Crop
  • Color Distort
  • Random Erasing
  • Mixup
  • AugmentHSV
  • Mosaic
  • Cutmix
  • Grid Mask
  • Auto Augment
  • Random Perspective

模型性能概览

云端模型性能对比

各模型结构和骨干网络的代表模型在COCO数据集上精度mAP和单卡Tesla V100上预测速度(FPS)对比图。

说明:

  • PP-YOLOE是对PP-YOLO v2模型的进一步优化,在COCO数据集精度51.6%,Tesla V100预测速度78.1FPS
  • PP-YOLOE+是对PPOLOE模型的进一步优化,在COCO数据集精度53.3%,Tesla V100预测速度78.1FPS
  • 图中模型均可在模型库中获取
移动端模型性能对比

各移动端模型在COCO数据集上精度mAP和高通骁龙865处理器上预测速度(FPS)对比图。

说明:

  • 测试数据均使用高通骁龙865(4*A77 + 4*A55)处理器batch size为1, 开启4线程测试,测试使用NCNN预测库,测试脚本见MobileDetBenchmark
  • PP-PicoDetPP-YOLO-Tiny为PaddleDetection自研模型,其余模型PaddleDetection暂未提供

模型库

1. 通用检测

PP-YOLOE+系列 推荐场景:Nvidia V100, T4等云端GPU和Jetson系列等边缘端设备

模型名称 COCO精度(mAP) V100 TensorRT FP16速度(FPS) 配置文件 模型下载
PP-YOLOE+_s 43.9 333.3 链接 下载地址
PP-YOLOE+_m 50.0 208.3 链接 下载地址
PP-YOLOE+_l 53.3 149.2 链接 下载地址
PP-YOLOE+_x 54.9 95.2 链接 下载地址

前沿检测算法

模型名称 COCO精度(mAP) V100 TensorRT FP16速度(FPS) 配置文件 模型下载
YOLOX-l 50.1 107.5 链接 下载地址
YOLOv5-l 48.6 136.0 链接 下载地址
YOLOv7-l 51.0 135.0 链接 下载地址

文档教程

入门教程

进阶教程

版本更新

版本更新内容请参考版本更新文档

许可证书

本项目的发布受GPL-3.0 license许可认证。

引用

@misc{ppdet2019,
title={PaddleDetection, Object detection and instance segmentation toolkit based on PaddlePaddle.},
author={PaddlePaddle Authors},
howpublished = {\url{https://github.com/PaddlePaddle/PaddleDetection}},
year={2019}
}

paddleyolo's People

Contributors

baiyfbupt avatar channingss avatar fdinsky avatar flyingqianmm avatar ghostxsl avatar heavengate avatar jerrywgz avatar jiweimaster avatar ldoublev avatar littletomatodonkey avatar lokezhou avatar lyuwenyu avatar mmglove avatar nemonameless avatar noplz avatar pkhk-1 avatar qingqing01 avatar rachelxu7 avatar slf12 avatar sunahong1993 avatar walloollaw avatar wanghaoshuang avatar wangxinxin08 avatar willthefrog avatar xyz-916 avatar yghstill avatar yixinkristy avatar yzl19940819 avatar zhiboniu avatar zoooo0820 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

paddleyolo's Issues

PaddleYOLO yolov5 训练出错

问题确认 Search before asking

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

请提出你的问题 Please ask your question

环境:ubuntu 22.04
paddle版本:2.4.0

W1130 14:21:26.796521 3913171 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 8.9, Driver API Version: 11.8, Runtime API Version: 11.7
W1130 14:21:26.804353 3913171 gpu_resources.cc:91] device: 0, cuDNN Version: 8.4.
Params: Tensor(shape=[1], dtype=float32, place=Place(gpu:0), stop_gradient=True,
[46.13829422])
loading annotations into memory...
Done (t=0.00s)
creating index...
index created!
[11-30 14:21:31 MainThread @logger.py:242] Argv: tools/train.py -c configs/yolov5/yolov5_l_300e_coco.yml --eval --amp
[11-30 14:21:31 MainThread @utils.py:73] paddlepaddle version: 2.4.0.
WARNING:root:cannot import name 'layers' from 'parl' (/home/ubuntu/miniconda3/envs/lwh-paddle/lib/python3.8/site-packages/parl/init.py)
<class 'ppdet.modeling.architectures.yolov5.YOLOv5'>
Traceback (most recent call last):
File "tools/train.py", line 172, in
main()
File "tools/train.py", line 168, in main
run(FLAGS, cfg)
File "tools/train.py", line 132, in run
trainer.train(FLAGS.eval)
File "/data/lwh/PaddleYOLO/ppdet/engine/trainer.py", line 361, in train
self._flops(flops_loader)
File "/data/lwh/PaddleYOLO/ppdet/engine/trainer.py", line 1018, in _flops
flops = flops(self.model, input_spec) / (1000**3)
File "/home/ubuntu/miniconda3/envs/lwh-paddle/lib/python3.8/site-packages/paddleslim/analysis/flops.py", line 133, in dygraph_flops
program = dygraph2program(model, inputs)
File "/home/ubuntu/miniconda3/envs/lwh-paddle/lib/python3.8/site-packages/decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
File "/home/ubuntu/miniconda3/envs/lwh-paddle/lib/python3.8/site-packages/paddle/fluid/wrapped_decorator.py", line 26, in impl
return wrapped_func(*args, **kwargs)
File "/home/ubuntu/miniconda3/envs/lwh-paddle/lib/python3.8/site-packages/paddle/fluid/framework.py", line 534, in impl
return func(*args, **kwargs)
File "/home/ubuntu/miniconda3/envs/lwh-paddle/lib/python3.8/site-packages/paddleslim/core/dygraph.py", line 145, in dygraph2program
return _dy2prog(layer, inputs, feed_prefix, fetch_prefix, tmp_prefix,
File "/home/ubuntu/miniconda3/envs/lwh-paddle/lib/python3.8/site-packages/paddleslim/core/dygraph.py", line 202, in _dy2prog
outputs = layer(*inputs)
File "/home/ubuntu/miniconda3/envs/lwh-paddle/lib/python3.8/site-packages/paddle/fluid/dygraph/layers.py", line 950, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "/home/ubuntu/miniconda3/envs/lwh-paddle/lib/python3.8/site-packages/paddle/fluid/dygraph/layers.py", line 935, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "/data/lwh/PaddleYOLO/ppdet/modeling/architectures/meta_arch.py", line 75, in forward
outs.append(self.get_pred())
File "/data/lwh/PaddleYOLO/ppdet/modeling/architectures/yolov5.py", line 95, in get_pred
return self._forward()
File "/data/lwh/PaddleYOLO/ppdet/modeling/architectures/yolov5.py", line 80, in _forward
yolo_head_outs = self.yolo_head(neck_feats)
File "/home/ubuntu/miniconda3/envs/lwh-paddle/lib/python3.8/site-packages/paddle/fluid/dygraph/layers.py", line 950, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "/home/ubuntu/miniconda3/envs/lwh-paddle/lib/python3.8/site-packages/paddle/fluid/dygraph/layers.py", line 935, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "/data/lwh/PaddleYOLO/ppdet/modeling/heads/yolov5_head.py", line 124, in forward
assert len(feats) == len(self.anchors)
TypeError: object of type 'Variable' has no len()

输出onnx模型问题

问题确认 Search before asking

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

请提出你的问题 Please ask your question

训练YOLOX再导出模型时候按照教程关闭NMS,
image
但输出的onnx任然包含NMS
image
请问如何解决?

ResourceExhaustedError

问题确认 Search before asking

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

请提出你的问题 Please ask your question

INFO 2022-09-05 16:54:20,902 launch_utils.py:566] details about PADDLE_TRAINER_ENDPOINTS can be found in ./yolo7_dygraph//endpoints.log, and detail running logs maybe found in ./yolo7_dygraph//workerlog.0
INFO 2022-09-05 16:54:20,902 launch_utils.py:566] details about PADDLE_TRAINER_ENDPOINTS can be found in ./yolo7_dygraph//endpoints.log, and detail running logs maybe found in ./yolo7_dygraph//workerlog.0
launch proc_id:20498 idx:0
launch proc_id:20503 idx:1
launch proc_id:20508 idx:2
launch proc_id:20513 idx:3
server not ready, wait 3 sec to retry...
not ready endpoints:['127.0.0.1:42005', '127.0.0.1:55637', '127.0.0.1:54941']
I0905 16:54:27.121857 20498 nccl_context.cc:83] init nccl context nranks: 4 local rank: 0 gpu id: 4 ring id: 0
W0905 16:54:28.339090 20498 gpu_resources.cc:61] Please NOTE: device: 4, GPU Compute Capability: 6.1, Driver API Version: 11.2, Runtime API Version: 11.2
W0905 16:54:28.343943 20498 gpu_resources.cc:91] device: 4, cuDNN Version: 8.1.
Params: Tensor(shape=[1], dtype=float32, place=Place(gpu:4), stop_gradient=False,
[164.94364929])
Traceback (most recent call last):
File "tools/train.py", line 172, in
main()
File "tools/train.py", line 168, in main
run(FLAGS, cfg)
File "tools/train.py", line 132, in run
trainer.train(FLAGS.eval)
File "/home/hik/zhangle16/PaddleDetection_YOLOSeries/ppdet/engine/trainer.py", line 520, in train
outputs = model(data)
File "/home/hik/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dygraph/layers.py", line 930, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "/home/hik/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dygraph/layers.py", line 915, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "/home/hik/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dygraph/parallel.py", line 752, in forward
outputs = self._layers(*inputs, **kwargs)
File "/home/hik/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dygraph/layers.py", line 930, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "/home/hik/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dygraph/layers.py", line 915, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "/home/hik/zhangle16/PaddleDetection_YOLOSeries/ppdet/modeling/architectures/meta_arch.py", line 59, in forward
out = self.get_loss()
File "/home/hik/zhangle16/PaddleDetection_YOLOSeries/ppdet/modeling/architectures/yolov5.py", line 98, in get_loss
return self._forward()
File "/home/hik/zhangle16/PaddleDetection_YOLOSeries/ppdet/modeling/architectures/yolov5.py", line 85, in _forward
neck_feats = self.neck(body_feats, self.for_mot)
File "/home/hik/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dygraph/layers.py", line 930, in call
return self._dygraph_call_func(inputs, **kwargs)
File "/home/hik/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dygraph/layers.py", line 915, in _dygraph_call_func
outputs = self.forward(inputs, **kwargs)
File "/home/hik/zhangle16/PaddleDetection_YOLOSeries/ppdet/modeling/necks/yolo_fpn.py", line 1448, in forward
fpn_out2 = self.elan_fpn2(f_out2) # 512 -> 128
4 + 256
2 -> 1024 -> 256
File "/home/hik/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dygraph/layers.py", line 930, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "/home/hik/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dygraph/layers.py", line 915, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "/home/hik/zhangle16/PaddleDetection_YOLOSeries/ppdet/modeling/backbones/csp_darknet.py", line 519, in forward
return self.elan_layer1(x) + self.elan_layer2(x)
File "/home/hik/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dygraph/layers.py", line 930, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "/home/hik/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dygraph/layers.py", line 915, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "/home/hik/zhangle16/PaddleDetection_YOLOSeries/ppdet/modeling/backbones/csp_darknet.py", line 493, in forward
y = self.conv3(x_all)
File "/home/hik/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dygraph/layers.py", line 930, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "/home/hik/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dygraph/layers.py", line 915, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "/home/hik/zhangle16/PaddleDetection_YOLOSeries/ppdet/modeling/backbones/csp_darknet.py", line 83, in forward
x = self.bn(self.conv(x))
File "/home/hik/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dygraph/layers.py", line 930, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "/home/hik/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dygraph/layers.py", line 915, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "/home/hik/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/nn/layer/conv.py", line 678, in forward
use_cudnn=self._use_cudnn)
File "/home/hik/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/nn/functional/conv.py", line 144, in _conv_nd
pre_bias = getattr(_C_ops, op_type)(x, weight, *attrs)
SystemError: (Fatal) Operator conv2d raises an paddle::memory::allocation::BadAlloc exception.
The exception content is
:ResourceExhaustedError:

Out of memory error on GPU 4. Cannot allocate 31.250000MB memory on GPU 4, 22.364380GB memory has been allocated and available memory is only 17.937500MB.

Please check whether there is any other process using GPU 4.

  1. If yes, please stop them, or start PaddlePaddle on another GPU.
  2. If no, please decrease the batch size of your model.
    If the above ways do not solve the out of memory problem, you can try to use CUDA managed memory. The command is export FLAGS_use_cuda_managed_memory=false.
    (at /paddle/paddle/fluid/memory/allocation/cuda_allocator.cc:87)
    . (at /paddle/paddle/fluid/imperative/tracer.cc:307)

The four cards used are not occupied. By looking at the GPU situation, we can find that the video memory occupation will always show an upward trend and then overflow and report an error. My batchsize is set to 4. Do developers encounter this situation?

🚀 Roadmap of PaddleYOLO 🚀

Roadmap of PaddleYOLO

This issue is used to collect user's functional requirements and show the future development plan.

Welcome to provide functional requirements and any suggestions through the message, thank you.

此issue用于收集广大用户的功能需求,以及展示之后的研发计划。

欢迎通过留言提供您的功能需求和任何建议,谢谢。

Roadmap

  • VOC dataset Model Zoo and Tutorial
  • Speed up YOLOv5/YOLOv7 training
  • support DAMO-YOLO

Collected features

  • -

剪枝提上日程了吗

问题确认 Search before asking

  • 我已经查询历史issue,没有类似需求。I have searched the issues and found no similar feature requests.

需求描述 Feature Description

  1. 任务目标(请描述你正在做的项目是什么,如模型、论文、项目是什么?); 2. 需求场景(请描述你的项目中为什么需要用此功能); 3. 功能描述(请简单描述或设计这个功能)

是否愿意提交PR Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!

关于anchors

问题确认 Search before asking

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

请提出你的问题 Please ask your question

我的检测目标非常小,使用默认的anchors可能会有些不太合适,我想知道我们的PaddleYOLO里面有集成好的K-means方法吗?我搜索了教程里面,好像没有提到相关的配置

C++部署的问题

问题确认 Search before asking

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

请提出你的问题 Please ask your question

我把训练出来的模型转成inference 在paddleDetection release2.3里的depoly CPP里部署 没有用
训练出来的inference模型是不是得在这个版本的CPP里部署才行

yolov5训练出错

问题描述 Please describe your issue

在aistudio平台上面,选择是V100_32G的显卡,按照教程安装好环境之后,训练自己的制作的coco数据集,使用的是configs/yolov5/yolov5_m_300e_coco.yml,使用的训练batch_size是16,加载预训练权重,然后开始训练,打印了如下日志:

[12/07 12:01:13] ppdet.utils.checkpoint INFO: Finish loading model weights: /home/aistudio/.cache/paddle/weights/ppyoloe_crn_l_300e_coco.pdparams
[12/07 12:02:20] ppdet.engine INFO: Epoch: [0] [ 0/767] eta: 180 days, 2:09:08 lr: 0.000000 loss_box: 0.053673 loss_obj: 2.675744 loss_cls: 0.209312 loss: 47.019657 batch_cost: 67.6217 data_cost: 65.2064 ips: 0.2366 images/s
^C[12/07 12:05:13] reader WARNING: fail to map sample transform [Decode_190192] with error: 'bytes' object has no attribute 'shape' and stack:
Traceback (most recent call last):
File "/home/aistudio/work/PaddleYOLO/ppdet/data/reader.py", line 54, in call
data = f(data)
File "/home/aistudio/work/PaddleYOLO/ppdet/data/transform/operators.py", line 101, in call
sample[i] = self.apply(sample[i], context)
File "/home/aistudio/work/PaddleYOLO/ppdet/data/transform/operators.py", line 458, in apply
elif sample['h'] != im.shape[0]:
AttributeError: 'bytes' object has no attribute 'shape'

Traceback (most recent call last):
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dataloader/dataloader_iter.py", line 745, in next
self.reader.read_next_list()[0])
SystemError: (Fatal) Blocking queue is killed because the data reader raises an exception.
[Hint: Expected killed
!= true, but received killed_:1 == true:1.] (at /paddle/paddle/fluid/operators/reader/blocking_queue.h:175)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "tools/train.py", line 172, in
Exception in thread Thread-1:
Traceback (most recent call last):
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/threading.py", line 926, in _bootstrap_inner
self.run()
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dataloader/dataloader_iter.py", line 536, in _thread_loop
batch = self._get_data()
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dataloader/dataloader_iter.py", line 674, in _get_data
batch.reraise()
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dataloader/worker.py", line 172, in reraise
raise self.exc_type(msg)
AttributeError: DataLoader worker(1) caught AttributeError with message:
Traceback (most recent call last):
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dataloader/worker.py", line 339, in _worker_loop
batch = fetcher.fetch(indices)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dataloader/fetcher.py", line 125, in fetch
data.append(self.dataset[idx])
File "/home/aistudio/work/PaddleYOLO/ppdet/data/source/dataset.py", line 94, in getitem
return self.transform(roidb)
File "/home/aistudio/work/PaddleYOLO/ppdet/data/reader.py", line 60, in call
raise e
File "/home/aistudio/work/PaddleYOLO/ppdet/data/reader.py", line 54, in call
data = f(data)
File "/home/aistudio/work/PaddleYOLO/ppdet/data/transform/operators.py", line 101, in call
sample[i] = self.apply(sample[i], context)
File "/home/aistudio/work/PaddleYOLO/ppdet/data/transform/operators.py", line 458, in apply
elif sample['h'] != im.shape[0]:
AttributeError: 'bytes' object has no attribute 'shape'
我不知道是为什么,感谢解答

infer.py: error: unrecognized arguments: --video_file=XXXXX

问题确认 Search before asking

  • 我已经查询历史issue,没有发现相似的bug。I have searched the issues and found no similar bug report.

Bug组件 Bug Component

No response

Bug描述 Describe the Bug

infer.py直接检测视频提示参数不支持,infer_img不支持视频,直接检测视频参数是否变化

复现环境 Environment

docker
2.3.2
gpu
cuda11.2
cudnn8 �

Bug描述确认 Bug description confirmation

  • 我确认已经提供了Bug复现步骤、代码改动说明、以及环境信息,确认问题是可以复现的。I confirm that the bug replication steps, code change instructions, and environment information have been provided, and the problem can be reproduced.

是否愿意提交PR? Are you willing to submit a PR?

  • 我愿意提交PR!I'd like to help by submitting a PR!

关于 v6 300 epoch

问题确认 Search before asking

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

请提出你的问题 Please ask your question

请问关于 v6 s 等小模型的 300 epoch 后面会训吗

YOLOV7训练报错

问题确认 Search before asking

  • 我已经查询历史issue,没有报过同样bug。I have searched the issues and found no similar bug report.

bug描述 Describe the Bug

Traceback (most recent call last):
File "/home/zhaohaibin/paddle/PaddleDetection_YOLOSeries-develop/tools/train.py", line 172, in
main()
File "/home/zhaohaibin/paddle/PaddleDetection_YOLOSeries-develop/tools/train.py", line 168, in main
run(FLAGS, cfg)
File "/home/zhaohaibin/paddle/PaddleDetection_YOLOSeries-develop/tools/train.py", line 132, in run
trainer.train(FLAGS.eval)
File "/home/zhaohaibin/paddle/PaddleDetection_YOLOSeries-develop/ppdet/engine/trainer.py", line 509, in train
outputs = model(data)
File "/home/zhaohaibin/miniconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 917, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "/home/zhaohaibin/miniconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 907, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "/home/zhaohaibin/paddle/PaddleDetection_YOLOSeries-develop/ppdet/modeling/architectures/meta_arch.py", line 59, in forward
out = self.get_loss()
File "/home/zhaohaibin/paddle/PaddleDetection_YOLOSeries-develop/ppdet/modeling/architectures/yolov5.py", line 98, in get_loss
return self._forward()
File "/home/zhaohaibin/paddle/PaddleDetection_YOLOSeries-develop/ppdet/modeling/architectures/yolov5.py", line 88, in _forward
yolo_losses = self.yolo_head(neck_feats, self.inputs)
File "/home/zhaohaibin/miniconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 917, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "/home/zhaohaibin/miniconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 907, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "/home/zhaohaibin/paddle/PaddleDetection_YOLOSeries-develop/ppdet/modeling/heads/yolo_head.py", line 727, in forward
self.anchors)
File "/home/zhaohaibin/miniconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 917, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "/home/zhaohaibin/miniconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 907, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "/home/zhaohaibin/paddle/PaddleDetection_YOLOSeries-develop/ppdet/modeling/losses/yolo_loss.py", line 513, in forward
inputs, targets, gt_targets['image'], anchors)
File "/home/zhaohaibin/paddle/PaddleDetection_YOLOSeries-develop/ppdet/modeling/losses/yolo_loss.py", line 593, in build_targets
indices, anch = self.find_3_positive(p, targets, anchors)
File "/home/zhaohaibin/paddle/PaddleDetection_YOLOSeries-develop/ppdet/modeling/losses/yolo_loss.py", line 784, in find_3_positive
gxi = gain[[2, 3]] - gxy # inverse
File "/home/zhaohaibin/miniconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/math_op_patch.py", line 264, in impl
return math_op(self, other_var, 'axis', axis)
RuntimeError: (PreconditionNotMet) The Tensor's element number must be equal or greater than zero. The Tensor's shape is [-1, 2] now
[Hint: Expected numel() >= 0, but received numel():-2 < 0:0.] (at /paddle/paddle/fluid/framework/tensor.cc:59)
[operator < elementwise_sub > error]

复现环境 Environment

--paddlepaddle:2.2.2
--python: 3.7
--CUDA: 10.2
--cudnn: 8.3

是否愿意提交PR Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!

非原来PaddleDetection的模型训练loss_box loss_cls map均为零

问题确认 Search before asking

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

请提出你的问题 Please ask your question

训练ppyolo ppyolov2 ppyoloe yolov3 yolox均正常,训练yolov5 yolov6mt yolov7时均存在以下问题:
无论训练多久,map以及几个Loss均为零

[08/21 23:02:22] reader WARNING: Shared memory size is less than 1G, disable shared_memory in DataLoader
W0821 23:02:22.648579 52836 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 11.2, Runtime API Version: 10.1
W0821 23:02:22.654331 52836 gpu_resources.cc:91] device: 0, cuDNN Version: 7.6.
[08/21 23:02:34] ppdet.engine INFO: Epoch: [0] [ 0/25] learning_rate: 0.000000 loss_box: 0.000000 loss_obj: 3.835117 loss_cls: 0.000000 loss: 122.723740 eta: 21:29:05 batch_cost: 10.3127 data_cost: 7.5710 ips: 3.1030 images/s
[08/21 23:03:21] ppdet.engine INFO: Epoch: [1] [ 0/25] learning_rate: 0.000033 loss_box: 0.000000 loss_obj: 3.812787 loss_cls: 0.000000 loss: 122.009171 eta: 4:25:58 batch_cost: 2.1349 data_cost: 1.6881 ips: 14.9888 images/s
[08/21 23:04:02] ppdet.engine INFO: Epoch: [2] [ 0/25] learning_rate: 0.000133 loss_box: 0.000000 loss_obj: 3.618636 loss_cls: 0.000000 loss: 115.796364 eta: 3:50:44 batch_cost: 1.8583 data_cost: 1.4974 ips: 17.2201 images/s
[08/21 23:04:58] ppdet.engine INFO: Epoch: [3] [ 0/25] learning_rate: 0.000300 loss_box: 0.000000 loss_obj: 3.113248 loss_cls: 0.000000 loss: 99.623932 eta: 4:02:38 batch_cost: 1.9607 data_cost: 1.6221 ips: 16.3207 images/s
[08/21 23:05:44] ppdet.engine INFO: Epoch: [4] [ 0/25] learning_rate: 0.000297 loss_box: 0.000000 loss_obj: 2.070968 loss_cls: 0.000000 loss: 66.270981 eta: 3:55:00 batch_cost: 1.8214 data_cost: 1.5075 ips: 17.5694 images/s
[08/21 23:06:30] ppdet.engine INFO: Epoch: [5] [ 0/25] learning_rate: 0.000296 loss_box: 0.000000 loss_obj: 0.311432 loss_cls: 0.000000 loss: 9.965838 eta: 3:49:56 batch_cost: 1.8020 data_cost: 1.5098 ips: 17.7583 images/s
[08/21 23:07:19] ppdet.engine INFO: Epoch: [6] [ 0/25] learning_rate: 0.000295 loss_box: 0.000000 loss_obj: 0.061897 loss_cls: 0.000000 loss: 1.980716 eta: 3:50:17 batch_cost: 1.8910 data_cost: 1.5825 ips: 16.9226 images/s
[08/21 23:08:04] ppdet.engine INFO: Epoch: [7] [ 0/25] learning_rate: 0.000294 loss_box: 0.000000 loss_obj: 0.032299 loss_cls: 0.000000 loss: 1.033568 eta: 3:45:54 batch_cost: 1.7666 data_cost: 1.4625 ips: 18.1143 images/s
[08/21 23:08:59] ppdet.engine INFO: Epoch: [8] [ 0/25] learning_rate: 0.000293 loss_box: 0.000000 loss_obj: 0.023415 loss_cls: 0.000000 loss: 0.749269 eta: 3:48:07 batch_cost: 1.8442 data_cost: 1.5283 ips: 17.3521 images/s
[08/21 23:09:50] ppdet.engine INFO: Epoch: [9] [ 0/25] learning_rate: 0.000292 loss_box: 0.000000 loss_obj: 0.019228 loss_cls: 0.000000 loss: 0.615304 eta: 3:48:10 batch_cost: 1.8959 data_cost: 1.5644 ips: 16.8784 images/s
[08/21 23:10:27] ppdet.utils.checkpoint INFO: Save checkpoint: output/yolov5_s_300e_coco
[08/21 23:10:38] ppdet.engine INFO: Eval iter: 0
[08/21 23:12:30] ppdet.metrics.metrics INFO: Accumulating evaluatation results...
[08/21 23:12:30] ppdet.metrics.metrics INFO: mAP(0.50, 11point) = 0.00%
[08/21 23:12:30] ppdet.engine INFO: Total sample number: 201, averge FPS: 1.6465216304954717
[08/21 23:12:30] ppdet.engine INFO: Best test bbox ap is 0.000.
[08/21 23:12:30] ppdet.utils.checkpoint INFO: Save checkpoint: output/yolov5_s_300e_coco
[08/21 23:12:31] ppdet.engine INFO: Epoch: [10] [ 0/25] learning_rate: 0.000291 loss_box: 0.000000 loss_obj: 0.016256 loss_cls: 0.000000 loss: 0.520206 eta: 3:42:01 batch_cost: 1.7734 data_cost: 1.4456 ips: 18.0449 images/s

训练命令:

# YOLOv5
!python PaddleDetection/tools/train.py -c PaddleDetection/configs/yolov5/yolov5_s_300e_coco.yml  --use_vdl=true --eval

改动为把coco.yml的读取更改为voc.yml的读取

训练环境:
AI Studio 100G V100版本 Paddle 2.3.1

训练yolov5出错

问题描述 Please describe your issue

在aistudio平台上面,选择是V100_32G的显卡,按照教程安装好环境之后,训练自己的制作的coco数据集,使用的是configs/yolov5/yolov5_m_300e_coco.yml,使用的训练batch_size是16,加载预训练权重,然后开始训练,打印了如下日志:

[12/07 12:01:13] ppdet.utils.checkpoint INFO: Finish loading model weights: /home/aistudio/.cache/paddle/weights/ppyoloe_crn_l_300e_coco.pdparams
[12/07 12:02:20] ppdet.engine INFO: Epoch: [0] [ 0/767] eta: 180 days, 2:09:08 lr: 0.000000 loss_box: 0.053673 loss_obj: 2.675744 loss_cls: 0.209312 loss: 47.019657 batch_cost: 67.6217 data_cost: 65.2064 ips: 0.2366 images/s
^C[12/07 12:05:13] reader WARNING: fail to map sample transform [Decode_190192] with error: 'bytes' object has no attribute 'shape' and stack:
Traceback (most recent call last):
File "/home/aistudio/work/PaddleYOLO/ppdet/data/reader.py", line 54, in call
data = f(data)
File "/home/aistudio/work/PaddleYOLO/ppdet/data/transform/operators.py", line 101, in call
sample[i] = self.apply(sample[i], context)
File "/home/aistudio/work/PaddleYOLO/ppdet/data/transform/operators.py", line 458, in apply
elif sample['h'] != im.shape[0]:
AttributeError: 'bytes' object has no attribute 'shape'

Traceback (most recent call last):
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dataloader/dataloader_iter.py", line 745, in next
self.reader.read_next_list()[0])
SystemError: (Fatal) Blocking queue is killed because the data reader raises an exception.
[Hint: Expected killed
!= true, but received killed_:1 == true:1.] (at /paddle/paddle/fluid/operators/reader/blocking_queue.h:175)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "tools/train.py", line 172, in
Exception in thread Thread-1:
Traceback (most recent call last):
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/threading.py", line 926, in _bootstrap_inner
self.run()
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dataloader/dataloader_iter.py", line 536, in _thread_loop
batch = self._get_data()
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dataloader/dataloader_iter.py", line 674, in _get_data
batch.reraise()
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dataloader/worker.py", line 172, in reraise
raise self.exc_type(msg)
AttributeError: DataLoader worker(1) caught AttributeError with message:
Traceback (most recent call last):
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dataloader/worker.py", line 339, in _worker_loop
batch = fetcher.fetch(indices)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dataloader/fetcher.py", line 125, in fetch
data.append(self.dataset[idx])
File "/home/aistudio/work/PaddleYOLO/ppdet/data/source/dataset.py", line 94, in getitem
return self.transform(roidb)
File "/home/aistudio/work/PaddleYOLO/ppdet/data/reader.py", line 60, in call
raise e
File "/home/aistudio/work/PaddleYOLO/ppdet/data/reader.py", line 54, in call
data = f(data)
File "/home/aistudio/work/PaddleYOLO/ppdet/data/transform/operators.py", line 101, in call
sample[i] = self.apply(sample[i], context)
File "/home/aistudio/work/PaddleYOLO/ppdet/data/transform/operators.py", line 458, in apply
elif sample['h'] != im.shape[0]:
AttributeError: 'bytes' object has no attribute 'shape'
我不知道是为什么,感谢解答

请问怎么单独实现一个优化器呢

问题确认 Search before asking

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

请提出你的问题 Please ask your question

您好,我想在自己的代码中使用yolov5的优化器,
我这样实现好像不对(base_lr还是0.1),请问该怎么实现呢?
image

yolov6 开启了dfl后 map为0

问题确认 Search before asking

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

请提出你的问题 Please ask your question

_BASE_: [
  '../datasets/voc.yml',
  '../runtime.yml',
  '_base_/optimizer_300e.yml',
  '_base_/yolov6_cspbep.yml',
  '_base_/yolov6_reader_fintune.yml',
]
depth_mult: 1.0
width_mult: 1.0

log_iter: 20
snapshot_epoch: 10
pretrain_weights: /home/zq/segmentation/PaddleYOLO/output/iter1_L2_old_mosaic/yolov6_l_silu_300e_coco/best_model.pdparams
weights: 


act: 'silu'
training_mode: "conv_silu" # Note: L use silu


CSPBepBackbone:
  csp_e: 0.50

CSPRepPAN:
  csp_e: 0.50

EffiDeHead:
  reg_max: 16
  use_dfl: True
  iou_type: 'giou'
  loss_weight: {cls: 1.0, iou: 2.5, dfl: 0.5, cwd: 10.0}
  distill_weight: {cls: 2.0, dfl: 1.0} # 2:1 in L-relu version, will not work default (self_distill=False)


# Step 1: Training the base model, get 51.0+ mAP
TrainReader:
  batch_size: 16 # total batch_size = 32 * gpu_num

EvalReader:
  batch_size: 8


# Step 2: Self-distillation training, get 52.0+ mAP
# Please cancel the following comment and train again
#
#self_distill: False
#pretrain_weights: /home/zq/segmentation/PaddleYOLO/output/iter1_L2_old_mosaic/yolov6_l_silu_300e_coco/best_model.pdparams
#save_dir: output_distill
#weights:

#TrainReader:
#   batch_size: 16
#

以上为配置文件 开启了自蒸馏后一样是map为0

ap_per_class()函数应该如何调用?

问题确认 Search before asking

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

请提出你的问题 Please ask your question

ppdet/metrics/map_utils.py/ap_per_class()函数为啥写了但是全局都没有调用过啊
我想要统计Predicted object classes和Target object classes(在这个函数中有进行计算)
请问应该在哪里怎么调用

image

关于 v7 隐性知识

问题确认 Search before asking

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

请提出你的问题 Please ask your question

你好,我在用 paddle 实现 v7 加了隐性知识(use_implicit),特别是 ImplicitM obj loss 会炸掉,请问你们也遇到类似情况吗?

Out of memory error on GPU 0.

问题确认 Search before asking

  • 我已经查询历史issue,没有发现相似的bug。I have searched the issues and found no similar bug report.

Bug组件 Bug Component

No response

Bug描述 Describe the Bug

python tools/train.py -c configs/yolov7/yolov7_l_300e_rice.yml --eval

D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\vision\transforms\functional_pil.py:36: DeprecationWarning: NEAREST is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.NEAREST or Dither.NONE instead.
'nearest': Image.NEAREST,
D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\vision\transforms\functional_pil.py:37: DeprecationWarning: BILINEAR is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BILINEAR instead.
'bilinear': Image.BILINEAR,
D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\vision\transforms\functional_pil.py:38: DeprecationWarning: BICUBIC is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BICUBIC instead.
'bicubic': Image.BICUBIC,
D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\vision\transforms\functional_pil.py:39: DeprecationWarning: BOX is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BOX instead.
'box': Image.BOX,
D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\vision\transforms\functional_pil.py:40: DeprecationWarning: LANCZOS is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.LANCZOS instead.
'lanczos': Image.LANCZOS,
D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\vision\transforms\functional_pil.py:41: DeprecationWarning: HAMMING is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.HAMMING instead.
'hamming': Image.HAMMING
Warning: import ppdet from source directory without installing, run 'python setup.py install' to install ppdet firstly
loading annotations into memory...
Done (t=0.01s)
creating index...
index created!
W1203 23:05:08.491394 7588 device_context.cc:447] Please NOTE: device: 0, GPU Compute Capability: 8.6, Driver API Version: 11.8, Runtime API Version: 11.2
W1203 23:05:08.496448 7588 device_context.cc:465] device: 0, cuDNN Version: 8.1.
W1203 23:05:09.667534 7588 device_context.h:397] WARNING: device: 0. The installed Paddle is compiled with CUDNN 8.2, but CUDNN version in your machine is 8.1, which may cause serious incompatible bug. Please recompile or reinstall Paddle with compatible CUDNN version.
D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\tensor\creation.py:130: DeprecationWarning: np.object is a deprecated alias for the builtin object. To silence this warning, use object by itself. Doing this will not modify any behavior and is safe.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
if data.dtype == np.object:
Traceback (most recent call last):
File "tools/train.py", line 172, in
main()
File "tools/train.py", line 168, in main
run(FLAGS, cfg)
File "tools/train.py", line 132, in run
trainer.train(FLAGS.eval)
File "D:\pkg\PaddleYOLO\ppdet\engine\trainer.py", line 411, in train
outputs = model(data)
File "D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\layers.py", line 917, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\layers.py", line 907, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "D:\pkg\PaddleYOLO\ppdet\modeling\architectures\meta_arch.py", line 59, in forward
out = self.get_loss()
File "D:\pkg\PaddleYOLO\ppdet\modeling\architectures\yolov5.py", line 92, in get_loss
return self._forward()
File "D:\pkg\PaddleYOLO\ppdet\modeling\architectures\yolov5.py", line 73, in _forward
body_feats = self.backbone(self.inputs)
File "D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\layers.py", line 917, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\layers.py", line 907, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "D:\pkg\PaddleYOLO\ppdet\modeling\backbones\yolov7_elannet.py", line 594, in forward
x = layer(x)
File "D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\layers.py", line 917, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\layers.py", line 907, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\container.py", line 98, in forward
input = layer(input)
File "D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\layers.py", line 917, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\layers.py", line 907, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "D:\pkg\PaddleYOLO\ppdet\modeling\backbones\yolov7_elannet.py", line 79, in forward
x_2 = self.bottlenecksi
File "D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\layers.py", line 917, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\layers.py", line 907, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "D:\pkg\PaddleYOLO\ppdet\modeling\backbones\csp_darknet.py", line 85, in forward
x = self.bn(self.conv(x))
File "D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\layers.py", line 917, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\layers.py", line 907, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\nn\layer\conv.py", line 677, in forward
use_cudnn=self._use_cudnn)
File "D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\nn\functional\conv.py", line 123, in _conv_nd
pre_bias = getattr(_C_ops, op_type)(x, weight, *attrs)
SystemError: (Fatal) Operator conv2d raises an struct paddle::memory::allocation::BadAlloc exception.
The exception content is
:ResourceExhaustedError:

Out of memory error on GPU 0. Cannot allocate 21.001465MB memory on GPU 0, 9.999512GB memory has been allocated and available memory is only 0.000000B.

Please check whether there is any other process using GPU 0.

  1. If yes, please stop them, or start PaddlePaddle on another GPU.
  2. If no, please decrease the batch size of your model.

(at ..\paddle\fluid\memory\allocation\cuda_allocator.cc:79)
. (at ..\paddle\fluid\imperative\tracer.cc:221)

复现环境 Environment

win11
cuda 11.2
paddle2.2.2

Bug描述确认 Bug description confirmation

  • 我确认已经提供了Bug复现步骤、代码改动说明、以及环境信息,确认问题是可以复现的。I confirm that the bug replication steps, code change instructions, and environment information have been provided, and the problem can be reproduced.

是否愿意提交PR? Are you willing to submit a PR?

  • 我愿意提交PR!I'd like to help by submitting a PR!

🚀 Train Custom Data Tutorial 自定义数据集训练教程 🚀

Train Custom Data Tutorial (English version)

Note:The Chinese version of the tutorial is located in the second reply below. 中文版教程请看下面第二条回复。

0. Examples

The PaddleDetection team provides various feature detection models based on PP-YOLOE , which can also be used as a reference to modify on your custom dataset. Please refer to PP-YOLOE application, pphuman, ppvehicle, visdrone and smalldet.

Scenarios Related Datasets Links
Agriculture Embrapa WGISD application
Low light ExDark application
Industry PCB Flaw PKU-Market-PCB application
Pedestrian CrowdHuman pphuman
Vehicle BDD100K, UA-DETRAC ppvehicle
VisDrone VisDrone-DET visdrone
Small Object DOTA, xView smalldet

PaddleDetection also provides various YOLO models for VOC dataset , which can also be used as a reference to modify on your custom dataset. Please refer to voc.

1. Custom data preparation:

1.For the annotation of custom dataset, please refer to DetAnnoTools;

2.For training preparation of custom dataset,please refer to PrepareDataSet.

Note:

2. Run script

model_type=ppyoloe # modify to 'yolov7'
job_name=ppyoloe_plus_crn_s_80e_coco # modify to 'yolov7_tiny_300e_coco'

config=configs/${model_type}/${job_name}.yml
log_dir=log_dir/${job_name}
# weights=https://bj.bcebos.com/v1/paddledet/models/${job_name}.pdparams
weights=output/${job_name}/model_final.pdparams

# 1.training(single GPU / multi GPU)
# CUDA_VISIBLE_DEVICES=0 python tools/train.py -c ${config} --eval --amp
python -m paddle.distributed.launch --log_dir=${log_dir} --gpus 0,1,2,3,4,5,6,7 tools/train.py -c ${config} --eval --amp

# 2.eval
CUDA_VISIBLE_DEVICES=0 python tools/eval.py -c ${config} -o weights=${weights} --classwise

# 3.infer
CUDA_VISIBLE_DEVICES=0 python tools/infer.py -c ${config} -o weights=${weights} --infer_img=demo/000000014439_640x640.jpg --draw_threshold=0.5

# 4.export
CUDA_VISIBLE_DEVICES=0 python tools/export_model.py -c ${config} -o weights=${weights} # exclude_nms=True trt=True

# 5.deploy infer
CUDA_VISIBLE_DEVICES=0 python deploy/python/infer.py --model_dir=output_inference/${job_name} --image_file=demo/000000014439_640x640.jpg --device=GPU

# 6.deploy speed
CUDA_VISIBLE_DEVICES=0 python deploy/python/infer.py --model_dir=output_inference/${job_name} --image_file=demo/000000014439_640x640.jpg --device=GPU --run_benchmark=True # --run_mode=trt_fp16

# 7.export onnx
paddle2onnx --model_dir output_inference/${job_name} --model_filename model.pdmodel --params_filename model.pdiparams --opset_version 12 --save_file ${job_name}.onnx

# 8.onnx speed
/usr/local/TensorRT-8.0.3.4/bin/trtexec --onnx=${job_name}.onnx --workspace=4096 --avgRuns=10 --shapes=input:1x3x640x640 --fp16

Note:

  • Write the above commands in a script file, such as run.sh, and run as:sh run.sh. You can also run the command line sentence by sentence.
  • If you want to switch models, just modify the first two lines, such as:
    model_type=yolov7
    job_name=yolov7_tiny_300e_coco
    
  • For FLOPs(G) and Params(M), you should first install PaddleSlim, pip install paddleslim, then set print_flops: True and print_params: True in runtime.yml. Make sure single scale like 640x640.

3. Fintune for training:

In addition to changing the path of the dataset, it is generally recommended to load the COCO pre training weight of the corresponding model to fintune, which will converge faster and achieve higher accuracy, such as:

# fintune with single GPU:
# CUDA_VISIBLE_DEVICES=0 python tools/train.py -c ${config} --eval --amp -o pretrain_weights=https://paddledet.bj.bcebos.com/models/ppyoloe_plus_crn_s_80e_coco.pdparams

# fintune with multi GPU:
python -m paddle.distributed.launch --log_dir=./log_dir --gpus 0,1,2,3,4,5,6,7 tools/train.py -c ${config} --eval --amp -o pretrain_weights=https://paddledet.bj.bcebos.com/models/ppyoloe_plus_crn_s_80e_coco.pdparams

Note:

  • The fintune training will show that the channels of the last layer of the head classification branch is not matched, which is a normal situation, because the number of custom dataset is generally inconsistent with that of COCO dataset;
  • In general, the number of epochs for fintune training can be set less, and the lr setting is also smaller, such as 1/10. The highest accuracy may occur in one of the middle epochs;

4. Predict and export:

When using custom dataset to predict and export models, if the path of the TestDataset dataset is set incorrectly, COCO 80 categories will be used by default.

In addition to the correct path setting of the TestDataset dataset, you can also modify and add the corresponding label_list. Txt file (one category is recorded in one line), and anno_path in TestDataset can also be set as an absolute path, such as:

TestDataset:
  !ImageFolder
    anno_path: label_list.txt # if not set dataset_dir, the anno_path will be relative path of PaddleDetection root directory
    # dataset_dir: dataset/my_coco # if set dataset_dir, the anno_path will be dataset_dir/anno_path

one line in label_list.txt records a corresponding category:

person
vehicle

yolov7训练

问题确认 Search before asking

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

请提出你的问题 Please ask your question

config:yolov7p6_e6e_300e_coco.yml

image

image

很奇怪怎么没有这个网络层尼,导致训练不了模型

ppyoloe 评估出现错误 ValueError: (InvalidArgument) multiclass_nms3(): argument (position 4) must be double, but got str (at /paddle/paddle/fluid/pybind/op_function_common.cc:211)

问题确认 Search before asking

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

请提出你的问题 Please ask your question

aistudio@jupyter-894455-5140321:~/PaddleYOLO$ python ./tools/eval.py -c ./configs/ppyoloe/ppyoloe_crn_s_400e_coco_tea.yml
W1129 16:28:18.003080 4451 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 11.2, Runtime API Version: 11.2
W1129 16:28:18.007580 4451 gpu_resources.cc:91] device: 0, cuDNN Version: 8.2.
loading annotations into memory...
Done (t=0.01s)
creating index...
index created!
[11/29 16:28:19] ppdet.data.source.coco WARNING: Found an invalid bbox in annotations: im_id: 112, area: 0.0 x1: 320.00064000000003, y1: 272.00016, x2: 320.00064000000003, y2: 273.00024.
[11/29 16:28:20] ppdet.utils.checkpoint INFO: Finish loading model weights: output/ppyoloe_crn_s_400e_coco_tea/model_final.pdparams
[11/29 16:28:20] ppdet.engine INFO: Eval loader length is 68, eval batch_size is 2.
[11/29 16:28:20] ppdet.engine INFO: Starting evaluation ......

Traceback (most recent call last):
File "./tools/eval.py", line 193, in
main()
File "./tools/eval.py", line 189, in main
run(FLAGS, cfg)
File "./tools/eval.py", line 154, in run
trainer.evaluate()
File "/home/aistudio/PaddleYOLO/ppdet/engine/trainer.py", line 529, in evaluate
self._eval_with_loader(self.loader)
File "/home/aistudio/PaddleYOLO/ppdet/engine/trainer.py", line 503, in _eval_with_loader
outs = self.model(data)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 948, in call
return self.forward(*inputs, **kwargs)
File "/home/aistudio/PaddleYOLO/ppdet/modeling/architectures/meta_arch.py", line 75, in forward
outs.append(self.get_pred())
File "/home/aistudio/PaddleYOLO/ppdet/modeling/architectures/yolo.py", line 102, in get_pred
return self._forward()
File "/home/aistudio/PaddleYOLO/ppdet/modeling/architectures/yolo.py", line 94, in _forward
yolo_head_outs, self.inputs['scale_factor'])
File "/home/aistudio/PaddleYOLO/ppdet/modeling/heads/ppyoloe_head.py", line 391, in post_process
bbox_pred, bbox_num, _ = self.nms(pred_bboxes, pred_scores)
File "/home/aistudio/PaddleYOLO/ppdet/modeling/layers.py", line 214, in call
return ops.multiclass_nms(bboxes, score, **kwargs)
File "/home/aistudio/PaddleYOLO/ppdet/modeling/ops.py", line 229, in multiclass_nms
rois_num, *attrs)
ValueError: (InvalidArgument) multiclass_nms3(): argument (position 4) must be double, but got str (at /paddle/paddle/fluid/pybind/op_function_common.cc:211)

训练错误

问题确认 Search before asking

  • 我已经查询历史issue,没有报过同样bug。I have searched the issues and found no similar bug report.

bug描述 Describe the Bug

使用yolov7 yolov7_l_300e_coco.yml 训练

PaddleDetection/ppdet/modeling/architectures/yolov5.py", line 88, in _forward
yolo_losses = self.yolo_head(neck_feats, self.inputs)
File "/usr/local/lib/python3.8/dist-packages/paddle/fluid/dygraph/layers.py", line 930, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/paddle/fluid/dygraph/layers.py", line 915, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "/work/ptm-online/PaddleDetection/ppdet/modeling/heads/yolo_head.py", line 726, in forward
return self.loss(yolo_outputs + yolo_outputs_aux, targets,
File "/usr/local/lib/python3.8/dist-packages/paddle/fluid/dygraph/layers.py", line 930, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/paddle/fluid/dygraph/layers.py", line 915, in dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "/work/ptm-online/PaddleDetection/ppdet/modeling/losses/yolo_loss.py", line 512, in forward
bs, as
, gjs, gis, targets, anchors = self.build_targets(
File "/work/ptm-online/PaddleDetection/ppdet/modeling/losses/yolo_loss.py", line 593, in build_targets
indices, anch = self.find_3_positive(p, targets, anchors)
File "/work/ptm-online/PaddleDetection/ppdet/modeling/losses/yolo_loss.py", line 783, in find_3_positive
gxi = gain[[2, 3]] - gxy # inverse
File "/usr/local/lib/python3.8/dist-packages/paddle/fluid/dygraph/math_op_patch.py", line 299, in impl
return math_op(self, other_var, 'axis', axis)
ValueError: (InvalidArgument) Broadcast dimension mismatch. Operands could not be broadcast together with the shape of X = [2] and the shape of Y = [0, 2, 7]. Received [2] in X is not equal to [7] in Y at i:2.
[Hint: Expected x_dims_array[i] == y_dims_array[i] || x_dims_array[i] <= 1 || y_dims_array[i] <= 1 == true, but received x_dims_array[i] == y_dims_array[i] || x_dims_array[i] <= 1 || y_dims_array[i] <= 1:0 != true:1.] (at /paddle/paddle/phi/kernels/funcs/common_shape.h:84)
[operator < elementwise_sub > error]

复现环境 Environment

No response

是否愿意提交PR Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!

AttributeError: '_DataLoaderIterMultiProcess' object has no attribute '_shutdown'

问题确认 Search before asking

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

请提出你的问题 Please ask your question

Traceback (most recent call last):
File "tools/train.py", line 172, in
main()
File "tools/train.py", line 168, in main
run(FLAGS, cfg)
File "tools/train.py", line 123, in run
trainer = Trainer(cfg, mode='train')
File "/home/hik/zhangle16/PaddleDetection_YOLOSeries/ppdet/engine/trainer.py", line 94, in init
self.dataset, cfg.worker_num)
File "/home/hik/zhangle16/PaddleDetection_YOLOSeries/ppdet/data/reader.py", line 197, in call
self.loader = iter(self.dataloader)
File "/home/hik/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/reader.py", line 566, in iter
return _DataLoaderIterMultiProcess(self)
File "/home/hik/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dataloader/dataloader_iter.py", line 381, in init
self._try_put_indices()
File "/home/hik/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dataloader/dataloader_iter.py", line 695, in _try_put_indices
indices = next(self._sampler_iter)
File "/home/hik/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dataloader/batch_sampler.py", line 262, in iter
assert len(indices) == self.total_size
AssertionError
Exception ignored in: <bound method _DataLoaderIterMultiProcess.del of <paddle.fluid.dataloader.dataloader_iter._DataLoaderIterMultiProcess object at 0x7fd205cfbbe0>>
Traceback (most recent call last):
File "/home/hik/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dataloader/dataloader_iter.py", line 712, in del
self._try_shutdown_all()
File "/home/hik/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dataloader/dataloader_iter.py", line 503, in _try_shutdown_all
if not self._shutdown:
AttributeError: '_DataLoaderIterMultiProcess' object has no attribute '_shutdown'
INFO 2022-09-05 16:27:07,857 launch_utils.py:343] terminate all the procs

As a beginner, I can't solve this problem alone. Please help me. Thank you!

训练batchsize大小问题

问题确认 Search before asking

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

请提出你的问题 Please ask your question

您好,我使用官方版本的yolov7代码可以batchsize=32大小训练,精度提升也很快。相同显存下,paddle的yolov7为什么batchsize只能调为8?

python tools/export_model.py 报错 NotImplementedError: ProgramTranslator hasn't implemented multiple decorators. Please remove staticmethod in forward

问题确认 Search before asking

  • 我已经查询历史issue,没有报过同样bug。I have searched the issues and found no similar bug report.

bug描述 Describe the Bug

python tools/export_model.py -c configs/yolov7/yolov7p6_e6e_300e_coco.yml --output_dir=inference_model -o weights=output/yolov7p6_e6_300e_coco/yolov7p6_e6e_300e_coco.pdparams

(paddle) G:\work_py\notebook\paddle\PaddleDetection_YOLOSeries-develop>python tools/export_model.py -c configs/yolov7/yolov7p6_e6e_300e_coco.yml --output_dir=inference_model -o weights=output/yolov7p6_e6_300e_coco/yolov7p6_e6e_300e_coco.pdparams
C:\Users\Administrator\AppData\Roaming\Python\Python37\site-packages\urllib3\util\selectors.py:14: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
from collections import namedtuple, Mapping
C:\Users\Administrator\AppData\Roaming\Python\Python37\site-packages\urllib3_collections.py:2: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
from collections import Mapping, MutableMapping
Warning: import ppdet from source directory without installing, run 'python setup.py install' to install ppdet firstly
Params: Tensor(shape=[1], dtype=float32, place=Place(cpu), stop_gradient=False,
[166.40467834])
[08/21 15:35:43] ppdet.utils.checkpoint INFO: Finish loading model weights: output/yolov7p6_e6_300e_coco/yolov7p6_e6e_300e_coco.pdparams
[08/21 15:35:43] ppdet.data.source.category WARNING: anno_file 'dataset/coco\annotations/instances_val2017.json' is None or not set or not exist, please recheck TrainDataset/EvalDataset/TestDataset.anno_path, otherwise the default categories will be used by metric_type.
[08/21 15:35:43] ppdet.data.source.category WARNING: metric_type: COCO, load default categories of COCO.
[08/21 15:35:43] ppdet.engine INFO: Export inference config file to inference_model\yolov7p6_e6e_300e_coco\infer_cfg.yml
Traceback (most recent call last):
File "tools/export_model.py", line 108, in
main()
File "tools/export_model.py", line 104, in main
run(FLAGS, cfg)
File "tools/export_model.py", line 73, in run
trainer.export(FLAGS.output_dir)
File "G:\work_py\notebook\paddle\PaddleDetection_YOLOSeries-develop\ppdet\engine\trainer.py", line 875, in export
save_dir)
File "G:\work_py\notebook\paddle\PaddleDetection_YOLOSeries-develop\ppdet\engine\trainer.py", line 834, in _get_infer_cfg_and_input_spec
input_spec, static_model.forward.main_program,
File "E:\pfile\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\dygraph_to_static\program_translator.py", line 580, in main_program
concrete_program = self.concrete_program
File "E:\pfile\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\dygraph_to_static\program_translator.py", line 488, in concrete_program
return self.concrete_program_specify_input_spec(input_spec=None)
File "E:\pfile\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\dygraph_to_static\program_translator.py", line 528, in concrete_program_specify_input_spec
*desired_input_spec, with_hook=with_hook)
File "E:\pfile\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\dygraph_to_static\program_translator.py", line 436, in get_concrete_program
concrete_program, partial_program_layer = self._program_cache[cache_key]
File "E:\pfile\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\dygraph_to_static\program_translator.py", line 801, in getitem
self._caches[item_id] = self._build_once(item)
File "E:\pfile\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\dygraph_to_static\program_translator.py", line 790, in build_once
**cache_key.kwargs)
File "", line 2, in from_func_spec
File "E:\pfile\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\wrapped_decorator.py", line 25, in impl
return wrapped_func(*args, **kwargs)
File "E:\pfile\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\base.py", line 51, in impl
return func(*args, **kwargs)
File "E:\pfile\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\dygraph_to_static\program_translator.py", line 740, in from_func_spec
error_data.raise_new_exception()
File "E:\pfile\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\dygraph_to_static\error.py", line 336, in raise_new_exception
six.exec
("raise new_exception from None")
File "", line 1, in
NotImplementedError: In transformed code:

File "G:\work_py\notebook\paddle\PaddleDetection_YOLOSeries-develop\ppdet\modeling\architectures\yolov5.py", line 101, in get_pred
    return self._forward()
File "G:\work_py\notebook\paddle\PaddleDetection_YOLOSeries-develop\ppdet\modeling\architectures\yolov5.py", line 84, in _forward
    body_feats = self.backbone(self.inputs)
File "G:\work_py\notebook\paddle\PaddleDetection_YOLOSeries-develop\ppdet\modeling\backbones\csp_darknet.py", line 999, in forward
    x = self.stem(x)
File "G:\work_py\notebook\paddle\PaddleDetection_YOLOSeries-develop\ppdet\modeling\backbones\csp_darknet.py", line 150, in forward
    return self.conv(outputs)
File "G:\work_py\notebook\paddle\PaddleDetection_YOLOSeries-develop\ppdet\modeling\backbones\csp_darknet.py", line 87, in forward
        if isinstance(self.act, nn.Silu):
            self.act = SiLU()
        y = self.act(x)
        ~~~~~~~~~~~~~~~ <--- HERE
    return y

File "E:\pfile\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\dygraph_to_static\convert_call_func.py", line 246, in convert_call
    forward_func = convert_to_static(forward_func)
File "E:\pfile\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\dygraph_to_static\program_translator.py", line 140, in convert_to_static
    static_func = _FUNCTION_CACHE.convert_with_cache(function)
File "E:\pfile\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\dygraph_to_static\program_translator.py", line 77, in convert_with_cache
    static_func = self._convert(func)
File "E:\pfile\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\dygraph_to_static\program_translator.py", line 115, in _convert
    root_wrapper = self._dygraph_to_static.get_static_ast(root)
File "E:\pfile\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\dygraph_to_static\ast_transformer.py", line 62, in get_static_ast
    self.transfer_from_node_type(self.static_analysis_root)
File "E:\pfile\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\dygraph_to_static\ast_transformer.py", line 74, in transfer_from_node_type
    self.visit(node_wrapper.node)
File "E:\pfile\anaconda3\envs\paddle\lib\ast.py", line 271, in visit
    return visitor(node)
File "E:\pfile\anaconda3\envs\paddle\lib\ast.py", line 326, in generic_visit
    value = self.visit(value)
File "E:\pfile\anaconda3\envs\paddle\lib\ast.py", line 271, in visit
    return visitor(node)
File "E:\pfile\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\dygraph_to_static\ast_transformer.py", line 111, in visit_FunctionDef
    + d.id + " in " + self.decorate_func_name)

NotImplementedError: ProgramTranslator hasn't implemented multiple decorators. Please remove staticmethod in forward

复现环境 Environment

paddlepaddle-gpu: 2.3.1.post101
python:3.7
cuda10.1

是否愿意提交PR Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!

yolov7的FPN必须要3个branch

问题确认 Search before asking

  • 我已经查询历史issue,没有发现相似的bug。I have searched the issues and found no similar bug report.

Bug组件 Bug Component

Training

Bug描述 Describe the Bug

yoloV7 tiny
我想使用两个header进行预测,因为我的目标都是小目标,大小都很一致,所以我希望使用两个header即可,进行加速

但是配置文件修改后,无法训练

File "/raid/zhangss/Tim.Zhang/002_PaddleKit/PaddleDetection_YOLOSeries/ppdet/modeling/necks/yolo_fpn.py", line 1150, in init
self.in_channels[2], out_ch, 1, 1, act=act) # 512->256

这里的2对fpn进行了限制,必须要有3个header

复现环境 Environment

-os ubuntu
-paddle 2.3

Bug描述确认 Bug description confirmation

  • 我确认已经提供了Bug复现步骤、代码改动说明、以及环境信息,确认问题是可以复现的。I confirm that the bug replication steps, code change instructions, and environment information have been provided, and the problem can be reproduced.

是否愿意提交PR? Are you willing to submit a PR?

  • 我愿意提交PR!I'd like to help by submitting a PR!

cannot download the onnx models?

问题确认 Search before asking

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

请提出你的问题 Please ask your question

How to download the onnx models? I tried the corresponding links, but failed.

同一张图片有较低概率(0.2%)出现不同的结果

问题确认 Search before asking

  • 我已经查询历史issue,没有发现相似的bug。I have searched the issues and found no similar bug report.

Bug组件 Bug Component

Deploy

Bug描述 Describe the Bug

用自己的数据集训练的模型,模型转换后,出现了预测同一张图片得到不同的结果:
结果1:[0, 0.95495987, 0.8209882, 980.28625, 908.0034, 1480.1486]

结果2:[0, 0.97286224, 101.02287, 0.46325487, 1358.9056, 696.56476]

复现环境 Environment

OS:linux
paddlepaddle-gpu:2.3.2
cuda:11.2

Bug描述确认 Bug description confirmation

  • 我确认已经提供了Bug复现步骤、代码改动说明、以及环境信息,确认问题是可以复现的。I confirm that the bug replication steps, code change instructions, and environment information have been provided, and the problem can be reproduced.

是否愿意提交PR? Are you willing to submit a PR?

  • 我愿意提交PR!I'd like to help by submitting a PR!

YOLO系列的剪枝提上日程了吗

问题确认 Search before asking

  • 我已经查询历史issue,没有类似需求。I have searched the issues and found no similar feature requests.

需求描述 Feature Description

您好,我看YOLO系列的量化已经做好了。YOLO系列的剪枝会有更新吗?还是我们自己利用现有paddle的剪枝模型操作即可

是否愿意提交PR Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!

yolov7训练报错

问题确认 Search before asking

  • 我已经查询历史issue,没有发现相似的bug。I have searched the issues and found no similar bug report.

Bug组件 Bug Component

No response

Bug描述 Describe the Bug

[11/23 03:43:27] ppdet.engine INFO: Epoch: [0] [ 0/82] eta: 0:51:19 lr: 0.000000 loss_box: 0.133824 loss_obj: 5.553813 loss_cls: 0.000000 loss: 34.125824 batch_cost: 1.8780 data_cost: 0.0010 ips: 3.1949 images/s
Traceback (most recent call last):
  File "I:\DeepLearningSystem\PaddleYOLO\train.py", line 513, in <module>
    main()
  File "I:\DeepLearningSystem\PaddleYOLO\train.py", line 509, in main
    run(FLAGS, cfg, logger, infer_output)
  File "I:\DeepLearningSystem\PaddleYOLO\train.py", line 279, in run
    trainer.train(FLAGS.eval)
  File "I:\DeepLearningSystem\PaddleYOLO\ppdet\engine\trainer.py", line 403, in train
    outputs = model(data)
  File "C:\Program Files\Python\Python39\lib\site-packages\paddle\fluid\dygraph\layers.py", line 917, in __call__
    return self._dygraph_call_func(*inputs, **kwargs)
  File "C:\Program Files\Python\Python39\lib\site-packages\paddle\fluid\dygraph\layers.py", line 907, in _dygraph_call_func
    outputs = self.forward(*inputs, **kwargs)
  File "I:\DeepLearningSystem\PaddleYOLO\ppdet\modeling\architectures\meta_arch.py", line 59, in forward
    out = self.get_loss()
  File "I:\DeepLearningSystem\PaddleYOLO\ppdet\modeling\architectures\yolov5.py", line 92, in get_loss
    return self._forward()
  File "I:\DeepLearningSystem\PaddleYOLO\ppdet\modeling\architectures\yolov5.py", line 77, in _forward
    yolo_losses = self.yolo_head(neck_feats, self.inputs)
  File "C:\Program Files\Python\Python39\lib\site-packages\paddle\fluid\dygraph\layers.py", line 917, in __call__
    return self._dygraph_call_func(*inputs, **kwargs)
  File "C:\Program Files\Python\Python39\lib\site-packages\paddle\fluid\dygraph\layers.py", line 907, in _dygraph_call_func
    outputs = self.forward(*inputs, **kwargs)
  File "I:\DeepLearningSystem\PaddleYOLO\ppdet\modeling\heads\yolov7_head.py", line 205, in forward
    return self.loss(yolo_outputs + yolo_outputs_aux, targets,
  File "C:\Program Files\Python\Python39\lib\site-packages\paddle\fluid\dygraph\layers.py", line 917, in __call__
    return self._dygraph_call_func(*inputs, **kwargs)
  File "C:\Program Files\Python\Python39\lib\site-packages\paddle\fluid\dygraph\layers.py", line 907, in _dygraph_call_func
    outputs = self.forward(*inputs, **kwargs)
  File "I:\DeepLearningSystem\PaddleYOLO\ppdet\modeling\losses\yolov7_loss.py", line 118, in forward
    bs, as_, gjs, gis, targets, anchors = self.build_targets(
  File "I:\DeepLearningSystem\PaddleYOLO\ppdet\modeling\losses\yolov7_loss.py", line 255, in build_targets
    pxyxys = paddle.concat(pxyxys, 0)
  File "C:\Program Files\Python\Python39\lib\site-packages\paddle\tensor\manipulation.py", line 345, in concat
    return paddle.fluid.layers.concat(input=x, axis=axis, name=name)
  File "C:\Program Files\Python\Python39\lib\site-packages\paddle\fluid\layers\tensor.py", line 327, in concat
    return _C_ops.concat(input, 'axis', axis)
ValueError: (InvalidArgument) concat(): argument 'X' (position 0) must be list of Tensors, but got empty list (at ..\paddle/fluid/pybind/op_function.h:848)

yolov7_loss.py第255行,如果pxyxys为空会报错

            pxyxys, p_cls, p_obj = [], [], []
            from_which_layer = []
            all_b, all_a, all_gj, all_gi = [], [], [], []
            all_anch = []

            empty_feats_num = 0
            for i, pi in enumerate(p):
                idx = (indices[i][0] == batch_idx)
                if idx.sum() == 0:
                    empty_feats_num += 1
                    continue
                b, a, gj, gi = indices[i][0][idx], indices[i][1][idx], indices[
                    i][2][idx], indices[i][3][idx]
                all_b.append(b)
                all_a.append(a)
                all_gj.append(gj)
                all_gi.append(gi)
                all_anch.append(anch[i][idx])
                from_which_layer.append(paddle.ones([len(b)]) * i)

                fg_pred = pi[b, a, gj, gi]
                if len(fg_pred.shape) == 1:  # paddle2.3 index
                    fg_pred = fg_pred.unsqueeze(0)

                p_obj.append(fg_pred[:, 4:5])
                p_cls.append(fg_pred[:, 5:])

                grid = paddle.stack([gi, gj], 1)
                pxy = (F.sigmoid(fg_pred[:, :2]) * 2. - 0.5 + grid
                       ) * self.downsample_ratios[i]
                pwh = (F.sigmoid(fg_pred[:, 2:4]) *
                       2)**2 * anch[i][idx] * self.downsample_ratios[i]
                pxywh = paddle.concat([pxy, pwh], -1)
                pxyxy = self.xywh2xyxy(pxywh)
                pxyxys.append(pxyxy)

            if empty_feats_num == 3:  # note
                continue
            pxyxys = paddle.concat(pxyxys, 0)           #<----------------报错
            if pxyxys.shape[0] == 0:
                continue

前面应该增加一个判断条件判断pxyxys是否为空:

if len(pxyxys) == 0: 
    continue

复现环境 Environment

-windows
-paddle 2.2.2
-release 2.5
-cuda 11.2

Bug描述确认 Bug description confirmation

  • 我确认已经提供了Bug复现步骤、代码改动说明、以及环境信息,确认问题是可以复现的。I confirm that the bug replication steps, code change instructions, and environment information have been provided, and the problem can be reproduced.

是否愿意提交PR? Are you willing to submit a PR?

  • 我愿意提交PR!I'd like to help by submitting a PR!

YOLOv5模型改动v7的neck部分后导出报错

想用yolov7进行训练,所以改了v7的neck部分,也就是改动了yolo_fpn.py里的class ELANFPN(nn.Layer)。
这个函数在yolov5里并不调用吧?
为什么把这个类改了,yolov5模型导出时就会报错(报错信息如下),而把这个类还原则导出正常。

ps(导出yolov5只是用来测试,为什么改了neck部分,v7能进行训练但是不能导出呢)

命令:
python tools/export_model.py -c configs/yolov5/yolov5_s_300e_coco.yml --output_dir=output_inference -o weights=/home/bxy/PaddleDetection_YOLOSeries/output/yolov5_s_300e_coco/best_model.pdparams
Traceback (most recent call last):
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 733, in from_func_spec
    outputs = static_func(*inputs)
  File "/tmp/tmpxtr9pgcj.py", line 101, in forward
    false_fn_5, (), (inputs, self), (out,))
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/convert_operators.py", line 211, in convert_ifelse
    out = _run_py_ifelse(pred, true_fn, false_fn, true_args, false_args)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/convert_operators.py", line 257, in _run_py_ifelse
    return true_fn(*true_args) if pred else false_fn(*false_args)
  File "/tmp/tmpxtr9pgcj.py", line 84, in false_fn_5
    for_loop_body_0, [__for_loop_var_index_0, inputs_list])
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/convert_operators.py", line 45, in convert_while_loop
    loop_vars = _run_py_while(cond, body, loop_vars)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/convert_operators.py", line 59, in _run_py_while
    loop_vars = body(*loop_vars)
  File "/tmp/tmpxtr9pgcj.py", line 79, in for_loop_body_0
    dy2static.convert_call(self.get_pred)())
  File "/tmp/tmpba5askf6.py", line 7, in get_pred
    return paddle.jit.dy2static.convert_call(self._forward)()
  File "/tmp/tmp90e4iv_c.py", line 11, in _forward
    neck_feats = paddle.jit.dy2static.convert_call(self.neck)(body_feats,
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/convert_call_func.py", line 246, in convert_call
    forward_func = convert_to_static(forward_func)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 140, in convert_to_static
    static_func = _FUNCTION_CACHE.convert_with_cache(function)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 77, in convert_with_cache
    static_func = self._convert(func)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 104, in _convert
    source_code = func_to_source_code(func)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/utils.py", line 550, in func_to_source_code
    source_code_list, _ = inspect.getsourcelines(function)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/inspect.py", line 955, in getsourcelines
    lines, lnum = findsource(object)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/inspect.py", line 782, in findsource
    lines = linecache.getlines(file, module.__dict__)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/linecache.py", line 47, in getlines
    return updatecache(filename, module_globals)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/linecache.py", line 137, in updatecache
    lines = fp.readlines()
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb8 in position 1268: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "tools/export_model.py", line 108, in <module>
    main()
  File "tools/export_model.py", line 104, in main
    run(FLAGS, cfg)
  File "tools/export_model.py", line 73, in run
    trainer.export(FLAGS.output_dir)
  File "/home/yaozhuohan/bxy/PaddleDetection_YOLOSeries/ppdet/engine/trainer.py", line 875, in export
    save_dir)
  File "/home/yaozhuohan/bxy/PaddleDetection_YOLOSeries/ppdet/engine/trainer.py", line 834, in _get_infer_cfg_and_input_spec
    input_spec, static_model.forward.main_program,
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 580, in main_program
    concrete_program = self.concrete_program
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 488, in concrete_program
    return self.concrete_program_specify_input_spec(input_spec=None)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 528, in concrete_program_specify_input_spec
    *desired_input_spec, with_hook=with_hook)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 436, in get_concrete_program
    concrete_program, partial_program_layer = self._program_cache[cache_key]
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 801, in __getitem__
    self._caches[item_id] = self._build_once(item)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 790, in _build_once
    **cache_key.kwargs)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/wrapped_decorator.py", line 25, in __impl__
    return wrapped_func(*args, **kwargs)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/base.py", line 51, in __impl__
    return func(*args, **kwargs)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 740, in from_func_spec
    error_data.raise_new_exception()
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/error.py", line 327, in raise_new_exception
    new_exception = self.create_exception()
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/error.py", line 161, in create_exception
    new_exception = self.error_type(message)
TypeError: function takes exactly 5 arguments (1 given)

复现环境 Environment

-PaddlePaddle:2.3.1
-Python:3.7.13
-CUDA:10.1

OSError: (External) CUDA error(719)

问题确认 Search before asking

  • 我已经查询历史issue,没有发现相似的bug。I have searched the issues and found no similar bug report.

Bug组件 Bug Component

Training

Bug描述 Describe the Bug

代码改动
image
image
image

shell
(ppyolo) D:\Code_Paddle\PaddleYOLO>python tools/train.py -c configs/yolov7/yolov7_l_300e_coco.yml --eval
W0927 08:44:37.201936 15152 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 7.5, Driver API Version: 11.7, Runtime API Version: 11.6
W0927 08:44:37.207935 15152 gpu_resources.cc:91] device: 0, cuDNN Version: 8.4.
Params: Tensor(shape=[1], dtype=float32, place=Place(gpu:0), stop_gradient=False,
[37.20547867])
Error: ../paddle/phi/kernels/funcs/gather.cu.h:67 Assertion index_value >= 0 && index_value < input_dims[j] failed. The index is out of bounds, please check whether the dimensions of index and input meet the requirements. It should be less than [7] and greater than or equal to 0, but received [0]
Error: ../paddle/phi/kernels/funcs/gather.cu.h:67 Assertion index_value >= 0 && index_value < input_dims[j] failed. The index is out of bounds, please check whether the dimensions of index and input meet the requirements. It should be less than [7] and greater than or equal to 0, but received [0]
Error: ../paddle/phi/kernels/funcs/gather.cu.h:67 Assertion index_value >= 0 && index_value < input_dims[j] failed. The index is out of bounds, please check whether the dimensions of index and input meet the requirements. It should be less than [7] and greater than or equal to 0, but received [0]
...............................................................................................................................................................................................................................................................
Error: ../paddle/phi/kernels/funcs/gather.cu.h:67 Assertion index_value >= 0 && index_value < input_dims[j] failed. The index is out of bounds, please check whether the dimensions of index and input meet the requirements. It should be less than [7] and greater than or equal to 0, but received [0]
Error: ../paddle/phi/kernels/funcs/gather.cu.h:67 Assertion index_value >= 0 && index_value < input_dims[j] failed. The index is out of bounds, please check whether the dimensions of index and input meet the requirements. It should be less than [7] and greater than or equal to 0, but received [0]
Traceback (most recent call last):
File "D:\Code_Paddle\PaddleYOLO\tools\train.py", line 172, in
main()
File "D:\Code_Paddle\PaddleYOLO\tools\train.py", line 168, in main
run(FLAGS, cfg)
File "D:\Code_Paddle\PaddleYOLO\tools\train.py", line 132, in run
trainer.train(FLAGS.eval)
File "D:\Code_Paddle\PaddleYOLO\ppdet\engine\trainer.py", line 535, in train
outputs = model(data)
File "C:\ProgramData\Anaconda3\envs\ppyolo\lib\site-packages\paddle\fluid\dygraph\layers.py", line 930, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "C:\ProgramData\Anaconda3\envs\ppyolo\lib\site-packages\paddle\fluid\dygraph\layers.py", line 915, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "D:\Code_Paddle\PaddleYOLO\ppdet\modeling\architectures\meta_arch.py", line 59, in forward
out = self.get_loss()
File "D:\Code_Paddle\PaddleYOLO\ppdet\modeling\architectures\yolov5.py", line 91, in get_loss
return self._forward()
File "D:\Code_Paddle\PaddleYOLO\ppdet\modeling\architectures\yolov5.py", line 81, in _forward
yolo_losses = self.yolo_head(neck_feats, self.inputs)
File "C:\ProgramData\Anaconda3\envs\ppyolo\lib\site-packages\paddle\fluid\dygraph\layers.py", line 930, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "C:\ProgramData\Anaconda3\envs\ppyolo\lib\site-packages\paddle\fluid\dygraph\layers.py", line 915, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "D:\Code_Paddle\PaddleYOLO\ppdet\modeling\heads\yolo_head.py", line 755, in forward
return self.loss(yolo_outputs, targets, self.anchors)
File "C:\ProgramData\Anaconda3\envs\ppyolo\lib\site-packages\paddle\fluid\dygraph\layers.py", line 930, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "C:\ProgramData\Anaconda3\envs\ppyolo\lib\site-packages\paddle\fluid\dygraph\layers.py", line 915, in dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "D:\Code_Paddle\PaddleYOLO\ppdet\modeling\losses\yolo_loss.py", line 512, in forward
bs, as
, gjs, gis, targets, anchors = self.build_targets(
File "D:\Code_Paddle\PaddleYOLO\ppdet\modeling\losses\yolo_loss.py", line 593, in build_targets
indices, anch = self.find_3_positive(p, targets, anchors)
File "D:\Code_Paddle\PaddleYOLO\ppdet\modeling\losses\yolo_loss.py", line 784, in find_3_positive
j = np.stack([np.ones_like(j), j, k, l, m])
File "<array_function internals>", line 180, in ones_like
File "C:\ProgramData\Anaconda3\envs\ppyolo\lib\site-packages\numpy\core\numeric.py", line 280, in ones_like
res = empty_like(a, dtype=dtype, order=order, subok=subok, shape=shape)
File "<array_function internals>", line 180, in empty_like
File "C:\ProgramData\Anaconda3\envs\ppyolo\lib\site-packages\paddle\fluid\dygraph\varbase_patch_methods.py", line 692, in array
array = self.numpy()
OSError: (External) CUDA error(719), unspecified launch failure.
[Hint: 'cudaErrorLaunchFailure'. An exception occurred on the device while executing a kernel. Common causes include dereferencing an invalid device pointerand accessing out of bounds shared memory. Less common cases can be system specific - more information about these cases canbe found in the system specific user guide. This leaves the process in an inconsistent state and any further CUDA work willreturn the same error. To continue using CUDA, the process must be terminated and relaunched.] (at ..\paddle\phi\backends\gpu\cuda\cuda_info.cc:258)

复现环境 Environment

Windows 10

python 3.9
paddlepaddle-gpu 2.3.2.post116
paddledet 2.4.0

Bug描述确认 Bug description confirmation

  • 我确认已经提供了Bug复现步骤、代码改动说明、以及环境信息,确认问题是可以复现的。I confirm that the bug replication steps, code change instructions, and environment information have been provided, and the problem can be reproduced.

是否愿意提交PR? Are you willing to submit a PR?

  • 我愿意提交PR!I'd like to help by submitting a PR!

YOLOV7更换inception结构后导出onnx报错

bug描述 Describe the Bug

修改了csp-darknet.py,将v7最后一层C5的bottlenecks换成了inception结构,训练正常,但导出onnx时报错
导出命令:

python tools/export_model.py -c configs/yolov7/yolov7_tiny_300e_coco.yml --output_dir=output_inference -o weights=/home/yaozhuohan/PaddleDetection_YOLOSeries/output/yolov7_tiny_300e_coco/best_model.pdparams

报错信息:

[09/01 12:17:23] ppdet.engine INFO: Export inference config file to output_inference/yolov7_tiny_300e_coco/infer_cfg.yml
Traceback (most recent call last):
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 733, in from_func_spec
    outputs = static_func(*inputs)
  File "/tmp/tmp1ngpwsbj.py", line 101, in forward
    false_fn_5, (), (inputs, self), (out,))
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/convert_operators.py", line 211, in convert_ifelse
    out = _run_py_ifelse(pred, true_fn, false_fn, true_args, false_args)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/convert_operators.py", line 257, in _run_py_ifelse
    return true_fn(*true_args) if pred else false_fn(*false_args)
  File "/tmp/tmp1ngpwsbj.py", line 84, in false_fn_5
    for_loop_body_0, [__for_loop_var_index_0, inputs_list])
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/convert_operators.py", line 45, in convert_while_loop
    loop_vars = _run_py_while(cond, body, loop_vars)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/convert_operators.py", line 59, in _run_py_while
    loop_vars = body(*loop_vars)
  File "/tmp/tmp1ngpwsbj.py", line 79, in for_loop_body_0
    dy2static.convert_call(self.get_pred)())
  File "/tmp/tmpw0tsf946.py", line 7, in get_pred
    return paddle.jit.dy2static.convert_call(self._forward)()
  File "/tmp/tmpls7f98pk.py", line 10, in _forward
    body_feats = paddle.jit.dy2static.convert_call(self.backbone)(self.inputs)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/convert_call_func.py", line 246, in convert_call
    forward_func = convert_to_static(forward_func)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 140, in convert_to_static
    static_func = _FUNCTION_CACHE.convert_with_cache(function)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 77, in convert_with_cache
    static_func = self._convert(func)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 104, in _convert
    source_code = func_to_source_code(func)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/utils.py", line 550, in func_to_source_code
    source_code_list, _ = inspect.getsourcelines(function)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/inspect.py", line 955, in getsourcelines
    lines, lnum = findsource(object)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/inspect.py", line 782, in findsource
    lines = linecache.getlines(file, module.__dict__)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/linecache.py", line 47, in getlines
    return updatecache(filename, module_globals)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/linecache.py", line 137, in updatecache
    lines = fp.readlines()
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb0 in position 5455: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "tools/export_model.py", line 108, in <module>
    main()
  File "tools/export_model.py", line 104, in main
    run(FLAGS, cfg)
  File "tools/export_model.py", line 73, in run
    trainer.export(FLAGS.output_dir)
  File "/home/yaozhuohan/PaddleDetection_YOLOSeries/ppdet/engine/trainer.py", line 875, in export
    save_dir)
  File "/home/yaozhuohan/PaddleDetection_YOLOSeries/ppdet/engine/trainer.py", line 834, in _get_infer_cfg_and_input_spec
    input_spec, static_model.forward.main_program,
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 580, in main_program
    concrete_program = self.concrete_program
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 488, in concrete_program
    return self.concrete_program_specify_input_spec(input_spec=None)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 528, in concrete_program_specify_input_spec
    *desired_input_spec, with_hook=with_hook)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 436, in get_concrete_program
    concrete_program, partial_program_layer = self._program_cache[cache_key]
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 801, in __getitem__
    self._caches[item_id] = self._build_once(item)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 790, in _build_once
    **cache_key.kwargs)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/wrapped_decorator.py", line 25, in __impl__
    return wrapped_func(*args, **kwargs)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/base.py", line 51, in __impl__
    return func(*args, **kwargs)
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 740, in from_func_spec
    error_data.raise_new_exception()
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/error.py", line 327, in raise_new_exception
    new_exception = self.create_exception()
  File "/home/yaozhuohan/anaconda3/envs/paddle/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/error.py", line 161, in create_exception
    new_exception = self.error_type(message)
TypeError: function takes exactly 5 arguments (1 given)

复现环境 Environment

-Paddle:2.3.1
-Python:3.7.13

yolov5版本提问

问题确认 Search before asking

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

请提出你的问题 Please ask your question

配置文件在PaddleYOLO/configs/yolov5/yolov5_s_300e_coco.yml
请问,yolov5_s_300e_coco对应yolov5的pytorch中的6.2版本吗?因为在自己数据集上做实验需要与pytorch做一个对比;需要版本一致。非常感谢。

yolov7训练自定义数据集到一定数量的epoch会报错shape concat不匹配和IndexError

问题确认 Search before asking

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

请提出你的问题 Please ask your question

python tools/train.py -c configs/yolov7/yolov7_l_300e_coco.yml --eval
修改了数据集和batch_size=16,在单卡上训练的

Traceback (most recent call last):
File "tools/train.py", line 172, in
main()
File "tools/train.py", line 168, in main
run(FLAGS, cfg)
File "tools/train.py", line 132, in run
trainer.train(FLAGS.eval)
File "/paddle/tmp/PaddleDetection_YOLOSeries/ppdet/engine/trainer.py", line 535, in train
outputs = model(data)
File "/root/anaconda3/envs/paddleseg/lib/python3.8/site-packages/paddle/fluid/dygraph/layers.py", line 930, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "/root/anaconda3/envs/paddleseg/lib/python3.8/site-packages/paddle/fluid/dygraph/layers.py", line 915, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "/paddle/tmp/PaddleDetection_YOLOSeries/ppdet/modeling/architectures/meta_arch.py", line 59, in forward
out = self.get_loss()
File "/paddle/tmp/PaddleDetection_YOLOSeries/ppdet/modeling/architectures/yolov5.py", line 98, in get_loss
return self._forward()
File "/paddle/tmp/PaddleDetection_YOLOSeries/ppdet/modeling/architectures/yolov5.py", line 84, in _forward
body_feats = self.backbone(self.inputs)
File "/root/anaconda3/envs/paddleseg/lib/python3.8/site-packages/paddle/fluid/dygraph/layers.py", line 930, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "/root/anaconda3/envs/paddleseg/lib/python3.8/site-packages/paddle/fluid/dygraph/layers.py", line 915, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "/paddle/tmp/PaddleDetection_YOLOSeries/ppdet/modeling/backbones/csp_darknet.py", line 1003, in forward
x = layer(x)
File "/root/anaconda3/envs/paddleseg/lib/python3.8/site-packages/paddle/fluid/dygraph/layers.py", line 930, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "/root/anaconda3/envs/paddleseg/lib/python3.8/site-packages/paddle/fluid/dygraph/layers.py", line 915, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "/root/anaconda3/envs/paddleseg/lib/python3.8/site-packages/paddle/fluid/dygraph/container.py", line 98, in forward
input = layer(input)
File "/root/anaconda3/envs/paddleseg/lib/python3.8/site-packages/paddle/fluid/dygraph/layers.py", line 930, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "/root/anaconda3/envs/paddleseg/lib/python3.8/site-packages/paddle/fluid/dygraph/layers.py", line 915, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "/paddle/tmp/PaddleDetection_YOLOSeries/ppdet/modeling/backbones/csp_darknet.py", line 546, in forward
x = paddle.concat([x_2, x_1], axis=1)
File "/root/anaconda3/envs/paddleseg/lib/python3.8/site-packages/paddle/tensor/manipulation.py", line 331, in concat
return paddle.fluid.layers.concat(input=x, axis=axis, name=name)
File "/root/anaconda3/envs/paddleseg/lib/python3.8/site-packages/paddle/fluid/layers/tensor.py", line 343, in concat
_C_ops.concat(input, out, 'axis', axis)
ValueError: (InvalidArgument) The 2-th dimension of input[0] and input[1] is expected to be equal.But received input[0]'s shape = [16, 256, 45, 45], input[1]'s shape = [16, 256, 44, 44].
[Hint: Expected inputs_dims[0][j] == inputs_dims[i][j], but received inputs_dims[0][j]:45 != inputs_dims[i][j]:44.] (at /paddle/paddle/phi/kernels/funcs/concat_funcs.h:83)
[operator < concat > error]

训练错误

问题确认 Search before asking

  • 我已经查询历史issue,没有报过同样bug。I have searched the issues and found no similar bug report.

bug描述 Describe the Bug

Traceback (most recent call last):
File "tools/train.py", line 172, in
main()
File "tools/train.py", line 168, in main
run(FLAGS, cfg)
File "tools/train.py", line 132, in run
trainer.train(FLAGS.eval)
File "/home/aistudio/PaddleDetection_YOLOSeries/ppdet/engine/trainer.py", line 487, in train
outputs = model(data)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 930, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 915, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "/home/aistudio/PaddleDetection_YOLOSeries/ppdet/modeling/architectures/meta_arch.py", line 59, in forward
out = self.get_loss()
File "/home/aistudio/PaddleDetection_YOLOSeries/ppdet/modeling/architectures/yolov5.py", line 98, in get_loss
return self._forward()
File "/home/aistudio/PaddleDetection_YOLOSeries/ppdet/modeling/architectures/yolov5.py", line 88, in _forward
yolo_losses = self.yolo_head(neck_feats, self.inputs)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 930, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 915, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "/home/aistudio/PaddleDetection_YOLOSeries/ppdet/modeling/heads/yolo_head.py", line 727, in forward
self.anchors)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 930, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 915, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "/home/aistudio/PaddleDetection_YOLOSeries/ppdet/modeling/losses/yolo_loss.py", line 513, in forward
inputs, targets, gt_targets['image'], anchors)
File "/home/aistudio/PaddleDetection_YOLOSeries/ppdet/modeling/losses/yolo_loss.py", line 593, in build_targets
indices, anch = self.find_3_positive(p, targets, anchors)
File "/home/aistudio/PaddleDetection_YOLOSeries/ppdet/modeling/losses/yolo_loss.py", line 779, in find_3_positive
gxi = gain[[2, 3]] - gxy # inverse
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/math_op_patch.py", line 299, in impl
return math_op(self, other_var, 'axis', axis)
ValueError: (InvalidArgument) Broadcast dimension mismatch. Operands could not be broadcast together with the shape of X = [2] and the shape of Y = [0, 2, 7]. Received [2] in X is not equal to [7] in Y at i:2.
[Hint: Expected x_dims_array[i] == y_dims_array[i] || x_dims_array[i] <= 1 || y_dims_array[i] <= 1 == true, but received x_dims_array[i] == y_dims_array[i] || x_dims_array[i] <= 1 || y_dims_array[i] <= 1:0 != true:1.] (at /paddle/paddle/phi/kernels/funcs/common_shape.h:84)
[operator < elementwise_sub > error]

复现环境 Environment

paddle-bfloat 0.1.7
paddledet 2.4.0
paddlefsl 1.0.0
paddlehub 2.0.4
paddlenlp 2.1.1
paddlepaddle-gpu 2.3.1.post101
tb-paddle 0.3.6

pythonn 3.7.4

是否愿意提交PR Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!

项目能开一个develop分支么?

问题确认 Search before asking

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

请提出你的问题 Please ask your question

对于单个版本分支作为main没啥毛病,后续每个分支都是一个release,对于本地git clone后某个版本,更新代码其实很麻烦。希望能改进

yolov5p6在coco上的预训练权重

问题确认 Search before asking

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

请提出你的问题 Please ask your question

请问有yolov5p6在coco上的pretrain_weights吗?

关于小目标评估

问题确认 Search before asking

  • 我已经查询历史issue,没有发现相似的bug。I have searched the issues and found no similar bug report.

Bug组件 Bug Component

No response

Bug描述 Describe the Bug

训练完成以后,使用评估命令:
python tools/eval.py -c configs/yolov5/yolov5_m_300e_coco.yml -o weights=output/yolov5_m_300e_coco/best_model.pdparams

是能够正常出来评估结果,但是当我加上参数--slice_infer之后,会出现以下问题:
[12/10 11:01:26] ppdet.utils.checkpoint INFO: Finish loading model weights: ..//output/yolov5_m_300e_coco/best_model.pdparams
Traceback (most recent call last):
File "/home/shtf/projects/PaddleYOLO-release-2.5/ppdet/engine/trainer.py", line 620, in evaluate_slice
match_metric)
File "/home/shtf/projects/PaddleYOLO-release-2.5/ppdet/engine/trainer.py", line 563, in _eval_with_loader_slice
shift_amount = data['st_pix']
KeyError: 'st_pix'

出现错误的代码在trainer.py :563
shift_amount = data['st_pix'],我调试看过这个data里面有五个参数:
im_id,curr_iter,image,im_shape,scale_factor,确实似乎没有st_pix

这是我的配置文件内容:
1.configs/yolov5/yolov5_m_300e_coco.yml:
BASE: [
'../datasets/coco_detection.yml',
'../runtime.yml',
'base/optimizer_300e_high.yml',
'base/yolov5_cspdarknet.yml',
'base/yolov5_reader_high_aug.yml',
]
depth_mult: 0.67
width_mult: 0.75

log_iter: 100
snapshot_epoch: 10
weights: output/yolov5_m_300e_coco/model_final
#pretrain_weights: https://paddledet.bj.bcebos.com/models/ppyoloe_crn_l_300e_coco.pdparams

TrainReader:
batch_size: 8 # default 8 gpus, total bs = 128

YOLOv5Loss:
obj_weight: 0.7
cls_weght: 0.3

2.coco_detection.yml
metric: COCO
num_classes: 9

TrainDataset:
!COCODataSet
image_dir: train_640
anno_path: annotations/640_train_annos_own.json
dataset_dir: ../own_dataset
data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd']

EvalDataset:
!COCODataSet
image_dir: train
anno_path: annotations/train_annos_own.json
dataset_dir: ../own_dataset

TestDataset:
!ImageFolder
anno_path: annotations/eval_annos_own.json # also support txt (like VOC's label_list.txt)
dataset_dir: ../own_dataset # if set, anno_path will be 'dataset_dir/anno_path'

复现环境 Environment

环境就是按照安装文档进行安装的默认配置
Ubuntu18.04
cuda 10.2

Bug描述确认 Bug description confirmation

  • 我确认已经提供了Bug复现步骤、代码改动说明、以及环境信息,确认问题是可以复现的。I confirm that the bug replication steps, code change instructions, and environment information have been provided, and the problem can be reproduced.

是否愿意提交PR? Are you willing to submit a PR?

  • 我愿意提交PR!I'd like to help by submitting a PR!

yolov7-x,yolov7-l训练到第9个epoch error

问题确认 Search before asking

  • 我已经查询历史issue,没有发现相似的bug。I have searched the issues and found no similar bug report.

Bug组件 Bug Component

Training

Bug描述 Describe the Bug

linux paddle2.3.2容器环境下,运行
自己voc 标准格式的数据,开启amp,开启预训练,config只是改了数据,其他还没有动过

命令:CUDA_VISIBLE_DEVICES=0 python3.7 tools/train.py -c configs/yolov7/yolov7_l_300e_zykj.yml --amp -o pretrain_weights=https://paddledet.bj.bcebos.com/models/yolov7_l_300e_coco.pdparams
##################################################################
config.yml:

BASE: [
'../datasets/zykj_detection.yml',
'../runtime.yml',
'base/optimizer_300e.yml',
'base/yolov7_elannet.yml',
'base/yolov7_reader.yml',
]
log_iter: 100
snapshot_epoch: 10
weights: output/yolov7_l_300e_coco/model_final

arch: L

TrainReader:
batch_size: 32 # 一块3090显卡能几乎跑满,再大的模型或者batch显卡性能不够

##########################################################

[10/18 05:15:43] ppdet.engine INFO: Epoch: [6] [100/107] eta: 3 days, 5:00:56 lr: 0.009850 loss_box: 0.072392 loss_obj: 0.006819 loss_cls: 0.234330 loss: 10.098155 batch_cost: 7.9959 data_cost: 6.6045 ips: 4.0020 images/s
[10/18 05:17:18] ppdet.engine INFO: Epoch: [7] [ 0/107] eta: 3 days, 5:21:48 lr: 0.009820 loss_box: 0.072360 loss_obj: 0.006701 loss_cls: 0.235074 loss: 10.109240 batch_cost: 8.8357 data_cost: 7.4409 ips: 3.6217 images/s
[10/18 05:31:33] ppdet.engine INFO: Epoch: [7] [100/107] eta: 3 days, 4:44:26 lr: 0.009820 loss_box: 0.071314 loss_obj: 0.007220 loss_cls: 0.217982 loss: 9.457106 batch_cost: 8.5153 data_cost: 7.0825 ips: 3.7580 images/s
[10/18 05:33:09] ppdet.engine INFO: Epoch: [8] [ 0/107] eta: 3 days, 5:03:17 lr: 0.009790 loss_box: 0.070992 loss_obj: 0.007268 loss_cls: 0.219685 loss: 9.510744 batch_cost: 9.3629 data_cost: 7.9285 ips: 3.4178 images/s
[10/18 05:47:04] ppdet.engine INFO: Epoch: [8] [100/107] eta: 3 days, 4:17:59 lr: 0.009790 loss_box: 0.070877 loss_obj: 0.006961 loss_cls: 0.206957 loss: 9.059731 batch_cost: 8.3161 data_cost: 6.9136 ips: 3.8480 images/s
[10/18 05:48:40] ppdet.engine INFO: Epoch: [9] [ 0/107] eta: 3 days, 4:34:15 lr: 0.009760 loss_box: 0.070877 loss_obj: 0.006922 loss_cls: 0.203878 loss: 9.042969 batch_cost: 9.1522 data_cost: 7.7467 ips: 3.4964 images/s
Traceback (most recent call last):
File "tools/train.py", line 172, in
main()
File "tools/train.py", line 168, in main
run(FLAGS, cfg)
File "tools/train.py", line 132, in run
trainer.train(FLAGS.eval)
File "/shiyy/PaddleYOLO/ppdet/engine/trainer.py", line 403, in train
outputs = model(data)
File "/usr/local/lib/python3.7/dist-packages/paddle/fluid/dygraph/layers.py", line 930, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/paddle/fluid/dygraph/layers.py", line 915, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "/shiyy/PaddleYOLO/ppdet/modeling/architectures/meta_arch.py", line 59, in forward
out = self.get_loss()
File "/shiyy/PaddleYOLO/ppdet/modeling/architectures/yolov5.py", line 92, in get_loss
return self._forward()
File "/shiyy/PaddleYOLO/ppdet/modeling/architectures/yolov5.py", line 77, 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 930, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/paddle/fluid/dygraph/layers.py", line 915, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "/shiyy/PaddleYOLO/ppdet/modeling/heads/yolov7_head.py", line 206, in forward
return self.loss(yolo_outputs, targets, self.anchors)
File "/usr/local/lib/python3.7/dist-packages/paddle/fluid/dygraph/layers.py", line 930, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/paddle/fluid/dygraph/layers.py", line 915, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "/shiyy/PaddleYOLO/ppdet/modeling/losses/yolov7_loss.py", line 119, in forward
inputs, targets, gt_targets['image'], anchors)
File "/shiyy/PaddleYOLO/ppdet/modeling/losses/yolov7_loss.py", line 300, in build_targets
matching_matrix[gt_idx, pos_idx] = 1.0
IndexError: index 140613145985136 is out of bounds for axis 1 with size 9

复现环境 Environment

linux
paddle2.3.2,容器环境
cuda11.2

Bug描述确认 Bug description confirmation

  • 我确认已经提供了Bug复现步骤、代码改动说明、以及环境信息,确认问题是可以复现的。I confirm that the bug replication steps, code change instructions, and environment information have been provided, and the problem can be reproduced.

是否愿意提交PR? Are you willing to submit a PR?

  • 我愿意提交PR!I'd like to help by submitting a PR!

单卡训练

问题确认 Search before asking

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

请提出你的问题 Please ask your question

单卡怎么训练呢?
已经在官网查询过[教程文档],但是没有找到解答,都是默认8卡训练;
image
3090单卡默认配置训练,训不动

yolov5模型导出

问题确认 Search before asking

  • 我已经查询历史issue,没有发现相似的bug。I have searched the issues and found no similar bug report.

Bug组件 Bug Component

Export

Bug描述 Describe the Bug

模型训练完后使用导出命令行代码:
python tools/export_model.py -c configs/yolov5/yolov5_x_300e_coco.yml -o weights=output/yolov5_x_300e_coco/best_model.pdparams TestReader.inputs_def.image_shape=[3,640,640] --output_dir=./inference_model
image
image
image
image
image

复现环境 Environment

-OS: Windows10
-PaddlePaddle: develop
-PaddleYOLO: PaddleYOLO-release-2.5
-Python: 3.8.0
-CUDA: 11.1
CUDNN: 8.0.5

Bug描述确认 Bug description confirmation

  • 我确认已经提供了Bug复现步骤、代码改动说明、以及环境信息,确认问题是可以复现的。I confirm that the bug replication steps, code change instructions, and environment information have been provided, and the problem can be reproduced.

是否愿意提交PR? Are you willing to submit a PR?

  • 我愿意提交PR!I'd like to help by submitting a PR!

导出的yolov5模型stem前有额外的mul算子

问题确认 Search before asking

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

请提出你的问题 Please ask your question

在yolov5页面下载了你们提供的yolov5_n_300e_coco预训练权重后,未修改任何配置,直接执行export脚本导出模型。用Netron打开模型结构后发现,模型并不是以stem的卷积开始的,而是在一开始的img输入后,先进行了elementwise_mul与elementwise_add。其中elementwise_mul的other输入为
type: float32[1,3,1,1]
[
[
[
[
0.003921568859368563
]
],
[
[
0.003921568859368563
]
],
[
[
0.003921568859368563
]
]
]
]
elementwise_add的输入为:
type: float32[1,3,1,1]
[
[
[
[
0
]
],
[
[
0
]
],
[
[
0
]
]
]
]
想请教下导出的模型为什么会包含这两个算子,
image_4

混淆矩阵,F1-score,P-R过程图等

问题确认 Search before asking

  • 我已经查询历史issue,没有类似需求。I have searched the issues and found no similar feature requests.

需求描述 Feature Description

像官方yolov5、yolov7一样,训练结束时,能够生成混淆矩阵、P-R图、F1-score过程图等
方便训练自己数据集时,后续进行优化与调整

是否愿意提交PR Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!

🚀 PP-YOLOE+高精度云边一体模型已经发布,欢迎大家试用讨论 🚀

PP-YOLOE+

PP-YOLOE+是基于飞桨云边一体高精度模型PP-YOLOE迭代优化升级版本,具备以下特点

1. 超强性能

使用Objects365预训练模型,升级版骨干网络等改动大幅提升模型精度,最高精度提升2.4% mAP,达到54.9% mAP

2. 训练收敛加速

基于Objects365预训练模型,减少训练轮数,训练收敛速度提升3.75倍

3. 下游任务泛化性显著提升

在农业、夜间安防、工业等不同场景数据集上验证,精度最高提升8.1%

4. 高性能部署能力

本次升级PP-YOLOE+支持多种部署方式,包括Python/C++、Serving、ONNX Runtime、ONNX-TRT、INT8量化等部署能力。

PP-YOLOE+教程文档:https://github.com/PaddlePaddle/PaddleDetection/blob/release/2.5/configs/ppyoloe/README_cn.md

为了方便大家相互交流沟通,欢迎大家扫码加入微信群,相关意见、建议和使用中的疑问可以在微信群中交流或者在github中提issue

ppyoloe_map_fps

可以转成TinyYolo2_model吗

问题确认 Search before asking

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

请提出你的问题 Please ask your question

可以转成TinyYolo2_model吗

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.