基于YOLOv8的知识蒸馏

文章报道了YOLOv8模型下的知识蒸馏实验,包括CWD、MGD、Logits蒸馏方法(如BCKD、CrossKD等),结果显示BCKD和LD在特定数据集上表现优秀,特别是LD在回归分支的提点达到1.69%。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

869c357f4596492d926e3d5ce6c4914b.png

09.14        在YOLOv8下的知识蒸馏,目前实验进展,已测试基于特征图的CWD和MGD,对自建数据集均有提点。其中,学生模型YOLOv8n,教师模型YOLOv8s,CWD有效提点1.01%,MGD提点0.34%。同时,支持对自己的改进模型进行知识蒸馏。

09.16        框架大改,加入Logits蒸馏。支持Logits蒸馏和特征蒸馏同时或者分别进行。

目前支持如下方法:

Logits蒸馏:最新的BCKD(Bridging Cross-task Protocol Inconsistency for Distillation in Dense Object Detection)https://arxiv.org/pdf/2308.14286.pdf,后续将加入其它Logits蒸馏方法。

特征蒸馏:CWD(Channel-wise Knowledge Distillation for Dense Prediction)https://arxiv.org/pdf/2011.13256.pdf;MGD(Masked Generative Distillation)https://arxiv.org/abs/2205.01529;FGD(Focal and Global Knowledge Distillation for Detectors)https://arxiv.org/abs/2111.11837;FSP(A Gift from Knowledge Distillation: Fast Optimization, Network Minimization and Transfer Learning)https://openaccess.thecvf.com/content_cvpr_2017/papers/Yim_A_Gift_From_CVPR_2017_paper.pdf

。后续将加入其它特征蒸馏方法。

09.17        BCKD实验结果,自制数据集上提点1.63%,优于CWD,并且两者可以同时训练。

09.18        加入调试成功的各类蒸馏方法。

 目前支持如下方法:

Logits蒸馏:最新的BCKD(Bridging Cross-task Protocol Inconsistency for Distillation in Dense Object Detection)https://arxiv.org/pdf/2308.14286.pdf;CrossKD(Cross-Head Knowledge Distillation for Dense Object Detection)https://arxiv.org/abs/2306.11369;NKD(From Knowledge Distillation to Self-Knowledge Distillation: A Unified Approach with Normalized Loss and Customized Soft Labels)https://arxiv.org/abs/2303.13005;DKD(Decoupled Knowledge Distillation) https://arxiv.org/pdf/2203.08679.pdf; LD(Localization Distillation for Dense Object Detection) https://arxiv.org/abs/2102.12252;WSLD(Rethinking the Soft Label of Knowledge Extraction: A Bias-Balance Perspective)          https://arxiv.org/pdf/2102.00650.pdf;Distilling the Knowledge in a Neural Network https://arxiv.org/pdf/1503.02531.pd3f。

特征蒸馏:CWD(Channel-wise Knowledge Distillation for Dense Prediction)https://arxiv.org/pdf/2011.13256.pdf;MGD(Masked Generative Distillation)https://arxiv.org/abs/2205.01529;FGD(Focal and Global Knowledge Distillation for Detectors)https://arxiv.org/abs/2111.11837;FSP(A Gift from Knowledge Distillation: Fast Optimization, Network Minimization and Transfer Learning)https://openaccess.thecvf.com/content_cvpr_2017/papers/Yim_A_Gift_From_CVPR_2017_paper.pdf

;PKD(General Distillation Framework for Object Detectors via Pearson Correlation Coefficient) https://arxiv.org/abs/2207.02039。

09.20        单独使用LD在回归分支的实验结果,目前表现最好,提点1.69%,比加了分类分支的BCKD要好。原因分析:可能是分类分支的KD影响了回归分支。

### 跨任务协议不一致性桥接的知识蒸馏方法 (BCKD) #### 方法概述 跨任务协议不一致性桥接(Bridging Cross-task Protocol Inconsistency, BCKD)是一种针对密集目标检测领域设计的知识蒸馏技术。该方法旨在解决不同任务之间存在的协议差异,从而提升学生模型的表现[^1]。 #### 主要挑战与解决方案 在密集目标检测中,教师和学生模型可能面临不同的输入尺寸、锚框设置以及损失函数等问题。这些问题导致了所谓的“跨任务协议不一致”。为此,BCKD引入了一种新的机制来弥合这种差距: - **多尺度特征对齐**:通过调整师生网络之间的感受野大小,使得两者能够在相同的空间分辨率上进行有效的特征交互。 - **自适应权重分配策略**:根据不同层的重要性动态调整各层间传递的信息量,确保重要区域得到充分关注的同时减少冗余计算开销。 - **增强型边界框回归指导**:除了常规的目标分类外,特别加强了对学生预测边框位置精度的要求,提高了最终定位准确性。 #### 实验验证 实验结果显示,在多个公开数据集上的测试表明采用BCKD方案后,即使是在存在显著域偏移的情况下也能取得更好的性能指标。这证明了该方法的有效性和鲁棒性。 ```python import torch.nn as nn class BCKDLoss(nn.Module): def __init__(self, alpha=0.5, beta=0.5): super(BCKDLoss, self).__init__() self.alpha = alpha # 权重参数用于平衡两项损失 self.beta = beta def forward(self, student_output, teacher_output): # 假设student_output 和teacher_output 是经过处理后的输出 # 多尺度特征对齐损失项 feature_loss = compute_feature_alignment(student_output['features'], teacher_output['features']) # 边界框回归损失项 bbox_loss = compute_bbox_regression(student_output['bbox_preds'], teacher_output['bbox_preds']) total_loss = self.alpha * feature_loss + self.beta * bbox_loss return total_loss ```
评论 20
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值