自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

CVPR2025 | 即插即用!清華國科大等推出視覺微調(diào)框架,僅需調(diào)整5%骨干網(wǎng)絡(luò)參數(shù)

人工智能 新聞
他們提出了Mona(Multi-cognitive Visual Adapter)這種新型視覺適配器微調(diào)方法,目標是打破傳統(tǒng)全參數(shù)微調(diào)(full fine-tuning)在視覺識別任務(wù)中的性能瓶頸。

僅調(diào)整5%的骨干網(wǎng)絡(luò)參數(shù),就能超越全參數(shù)微調(diào)效果?!

還是在實例分割、目標檢測、旋轉(zhuǎn)目標檢測這樣的經(jīng)典視覺任務(wù)場景。

這是來自清華、國科大、上海交大、阿里巴巴的一項研究,相關(guān)論文已被CVPR2025接受。

圖片

他們提出了Mona(Multi-cognitive Visual Adapter)這種新型視覺適配器微調(diào)方法,目標是打破傳統(tǒng)全參數(shù)微調(diào)(full fine-tuning)在視覺識別任務(wù)中的性能瓶頸。

Mona方法通過引入多認知視覺濾波器和優(yōu)化輸入分布,僅調(diào)整5%的骨干網(wǎng)絡(luò)參數(shù),就能在實例分割、目標檢測、旋轉(zhuǎn)目標檢測等多個經(jīng)典視覺任務(wù)中超越全參數(shù)微調(diào)的效果。

這一方法顯著降低了適配和存儲成本,為視覺模型的高效微調(diào)提供了新的思路。

Mona首次突破了全量微調(diào)性能枷鎖

隨著現(xiàn)代深度學(xué)習(xí)的發(fā)展,訓(xùn)練數(shù)據(jù)和模型規(guī)模的增加成為模型性能的重要增長點,但隨之而來的是模型的垂直應(yīng)用和微調(diào)成本和難度的提升。

傳統(tǒng)全量微調(diào)需要更新模型所有參數(shù)(如GPT-3的1750億參數(shù) ),計算成本極高。即使以早期的BERT為例,單卡訓(xùn)練100萬數(shù)據(jù)也需5-7小時,對硬件資源和時間的要求限制了研究復(fù)現(xiàn)和實際應(yīng)用。

同時,隨著模型參數(shù)從億級邁向萬億級,直接微調(diào)不僅成本高昂,還可能因過擬合導(dǎo)致性能下降。此外,多任務(wù)場景下需為每個任務(wù)保存完整模型副本,存儲成本劇增加。

參數(shù)高效微調(diào)(Parameter Efficient Fine-Tuning,PEFT)通過保持預(yù)訓(xùn)練模型參數(shù)凍結(jié),僅調(diào)整少量參數(shù)就可實現(xiàn)大模型在垂直應(yīng)用領(lǐng)域的高效適配。

但目前大多數(shù)PEFT方法,尤其是視覺領(lǐng)域的PEFT方法的性能相較于全量微調(diào)而言還存在劣勢。

Mona通過更適合視覺信號處理的設(shè)計以及對預(yù)訓(xùn)練特征分布的動態(tài)優(yōu)化,在小于5%的參數(shù)成本下首次突破了全量微調(diào)的性能枷鎖,為視覺微調(diào)提供了新的解決方案。

團隊核心想通過研究強調(diào):

(1)PEFT對于視覺模型性能上限的提升(尤其是參數(shù)量較大的模型);(2)視覺模型在全微調(diào)(尤其是少樣本情況)會存在嚴重的過擬合問題;(3)1LVM+nAdapter模式在實際業(yè)務(wù)中潛在的性能和效率優(yōu)勢。

對于具體業(yè)務(wù)來說,有些用到LVM或者多模態(tài)大模型(如OCR等任務(wù))的任務(wù)會對視覺編碼器部分進行固定或僅微調(diào)linear層來適應(yīng)下游數(shù)據(jù)。

Mona的存在理論上可以進一步提升LVM、多模態(tài)大模型對視覺特征的理解和重構(gòu),尤其是對于一些少樣本post-training問題。

核心引入多認知視覺濾波器

Mona包含降維、多認知視覺濾波器、激活函數(shù)和升維等模塊,并在適配器內(nèi)部加入了跳躍連接(Skip-Connections),以增強模型的適應(yīng)能力。

這種結(jié)構(gòu)設(shè)計使得Mona能夠在保持高效的同時,顯著提升視覺任務(wù)的性能。

圖片

Mona方法的核心在于引入了多認知視覺濾波器,這些濾波器通過深度可分離卷積(Depth-Wise Convolution)和多尺度卷積核(3×3、5×5、7×7)來增強適配器對視覺信號的處理能力。

與傳統(tǒng)的線性適配器不同,Mona專門針對視覺任務(wù)設(shè)計,能夠更好地處理二維視覺特征,通過多尺度特征融合提升模型對視覺信息的理解能力。

另外,Mona在適配器的前端加入了分布適配層(Scaled LayerNorm),用于調(diào)整輸入特征的分布。

這種設(shè)計能夠優(yōu)化從固定層傳遞過來的特征分布,使其更適合適配器的處理,從而提高微調(diào)效率。

實驗結(jié)果

先來看實驗設(shè)置。

論文在多個代表性視覺任務(wù)上進行了實驗,包括:

  • 實例分割(COCO)
  • 語義分割(ADE20K)
  • 目標檢測(Pascal VOC)
  • 旋轉(zhuǎn)目標檢測(DOTA/STAR)
  • 圖像分類(Flowers102、Oxford-IIIT Pet、VOC2007)

實驗使用了SwinTransformer系列作為骨干網(wǎng)絡(luò),并基于ImageNet-22k數(shù)據(jù)集進行預(yù)訓(xùn)練。

圖片

實驗結(jié)果顯示,在COCO數(shù)據(jù)集上,Mona方法相比全參數(shù)微調(diào)提升了1%的mAP,僅調(diào)整了不到5%的參數(shù)。

圖片

在ADE20K數(shù)據(jù)集上,Mona提升了0.18%的mIoU,表現(xiàn)出色。

同時,在Pascal VOC數(shù)據(jù)集上,Mona提升了3.6%的APbox,顯示出顯著的性能提升。

圖片

在旋轉(zhuǎn)目標檢測任務(wù)(DOTA/STAR)中,Mona在多個框架下均優(yōu)于其他方法。

圖片

在圖像分類任務(wù)上,Mona也有不俗的性能。

圖片

在所有方法中, Mona收斂速度更快,并且明顯超過了全微調(diào)。

圖片

以下為Mona即插即用模塊:

import torch.nn asnn
importtorch.nn.functionalasF
# ------------------------------Mona模塊------------------------------
INNER_DIM = 64
class MonaOp(nn.Module):
def __init__(self, in_features):
super().__init__()
self.conv1 = nn.Conv2d(in_features, in_features, kernel_size=3, padding=3 // 2, groups=in_features)
self.conv2 = nn.Conv2d(in_features, in_features, kernel_size=5, padding=5 // 2, groups=in_features)
self.conv3 = nn.Conv2d(in_features, in_features, kernel_size=7, padding=7 // 2, groups=in_features)
self.projector = nn.Conv2d(in_features, in_features, kernel_size=1, )
def forward(self, x):
identity = x
conv1_x = self.conv1(x)
conv2_x = self.conv2(x)
conv3_x = self.conv3(x)
x = (conv1_x + conv2_x + conv3_x) / 3.0 + identity
identity = x
x = self.projector(x)
return identity + x
class Mona(BaseModule):
def __init__(self,
in_dim,
factor=4):
super().__init__()
self.project1 = nn.Linear(in_dim, INNER_DIM)
self.nonlinear = F.gelu
self.project2 = nn.Linear(INNER_DIM, in_dim)
self.dropout = nn.Dropout(p=0.1)
self.adapter_conv = MonaOp(INNER_DIM)
self.norm = nn.LayerNorm(in_dim)
self.gamma = nn.Parameter(torch.ones(in_dim) * 1e-6)
self.gammax = nn.Parameter(torch.ones(in_dim))
def forward(self, x, hw_shapes=None):
identity = x
x = self.norm(x) * self.gamma + x * self.gammax
project1 = self.project1(x)
b, n, c = project1.shape
h, w = hw_shapes
project1 = project1.reshape(b, h, w, c).permute(0, 3, 1, 2)
project1 = self.adapter_conv(project1)
project1 = project1.permute(0, 2, 3, 1).reshape(b, n, c)
nonlinear = self.nonlinear(project1)
nonlinear = self.dropout(nonlinear)
project2 = self.project2(nonlinear)
return identity + project2
#------------------------------插入模式------------------------------
#此處省略部分 Swin組件實現(xiàn),僅提供 Mona插入模式。
class SwinBlock(BaseModule):
""""
Args:
embed_dims (int): The feature dimension.
num_heads (int): Parallel attention heads.
feedforward_channels (int): The hidden dimension for FFNs.
window_size (int, optional): The local window scale. Default: 7.
shift (bool, optional): whether to shift window or not. Default False.
qkv_bias (bool, optional): enable bias for qkv if True. Default: True.
qk_scale (float | None, optional): Override default qk scale of
head_dim ** -0.5 if set. Default: None.
drop_rate (float, optional): Dropout rate. Default: 0.
attn_drop_rate (float, optional): Attention dropout rate. Default: 0.
drop_path_rate (float, optional): Stochastic depth rate. Default: 0.
act_cfg (dict, optional): The config dict of activation function.
Default: dict(type='GELU').
norm_cfg (dict, optional): The config dict of normalization.
Default: dict(type='LN').
with_cp (bool, optional): Use checkpoint or not. Using checkpoint
will save some memory while slowing down the training speed.
Default: False.
init_cfg (dict | list | None, optional): The init config.
Default: None.
"""
def __init__(self,
embed_dims,
num_heads,
feedforward_channels,
window_size=7,
shift=False,
qkv_bias=True,
qk_scale=None,
drop_rate=0.,
attn_drop_rate=0.,
drop_path_rate=0.,
act_cfg=dict(type='GELU'),
norm_cfg=dict(type='LN'),
with_cp=False,
init_cfg=None):
super(SwinBlock, self).__init__()
self.init_cfg = init_cfg
self.with_cp = with_cp
self.norm1 = build_norm_layer(norm_cfg, embed_dims)[1]
self.attn = ShiftWindowMSA(
embed_dims=embed_dims,
num_heads=num_heads,
window_size=window_size,
shift_size=window_size // 2 if shift else 0,
qkv_bias=qkv_bias,
qk_scale=qk_scale,
attn_drop_rate=attn_drop_rate,
proj_drop_rate=drop_rate,
dropout_layer=dict(type='DropPath', drop_prob=drop_path_rate),
init_cfg=None)
self.norm2 = build_norm_layer(norm_cfg, embed_dims)[1]
self.ffn = FFN(
embed_dims=embed_dims,
feedforward_channels=feedforward_channels,
num_fcs=2,
ffn_drop=drop_rate,
dropout_layer=dict(type='DropPath', drop_prob=drop_path_rate),
act_cfg=act_cfg,
add_identity=True,
init_cfg=None)
self.mona1 = Mona(embed_dims, 8)
self.mona2 = Mona(embed_dims, 8)
def forward(self, x, hw_shape):
def _inner_forward(x):
identity = x
x = self.norm1(x)
x = self.attn(x, hw_shape)
x = x + identity
x = self.mona1(x, hw_shape)
identity = x
x = self.norm2(x)
x = self.ffn(x, identity=identity)
x = self.mona2(x, hw_shape)
return x
if self.with_cp and x.requires_grad:
x = cp.checkpoint(_inner_forward, x)
else:
x = _inner_forward(x)
return x

最后小結(jié)一下,Mona方法通過多認知視覺濾波器和輸入優(yōu)化,顯著提升了視覺任務(wù)的微調(diào)性能,同時大幅減少了參數(shù)調(diào)整量。

這一方法不僅在多個視覺任務(wù)中超越了傳統(tǒng)全參數(shù)微調(diào),還為未來視覺模型的高效微調(diào)提供了新的方向。

預(yù)印版期間,Mona已被復(fù)旦、中科大、南大、武大等多家單位的工作視為SOTA方法運用在醫(yī)學(xué)、遙感等領(lǐng)域。

Mona的開源代碼將進一步推動這一領(lǐng)域的研究和應(yīng)用。

附論文引用格式:

@misc{yin20245100breakingperformanceshackles,
      title={5%>100%: Breaking Performance Shackles of Full Fine-Tuning on Visual Recognition Tasks}, 
      author={Dongshuo Yin and Leiyi Hu and Bin Li and Youqun Zhang and Xue Yang},
      year={2024},
      eprint={2408.08345},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2408.08345}, 
}

論文地址:https://arxiv.org/pdf/2408.08345
代碼:https://github.com/Leiyi-Hu/mona

責(zé)任編輯:張燕妮 來源: 量子位
相關(guān)推薦

2025-03-10 08:47:00

模型AI訓(xùn)練

2025-03-14 10:26:58

2021-07-08 15:39:50

機器學(xué)習(xí)人工智能計算

2021-10-13 17:28:33

AI 數(shù)據(jù)人工智能

2021-07-14 07:30:51

網(wǎng)絡(luò)建設(shè)互聯(lián)網(wǎng)骨干網(wǎng)絡(luò)

2024-07-22 08:17:00

模型性能

2024-11-11 09:00:00

2025-03-05 00:15:00

2009-06-30 19:12:16

云計算SOAIT

2010-08-20 15:06:38

2012-03-24 14:04:37

2013-09-18 09:24:47

2012-03-27 16:40:54

2015-05-22 11:26:02

網(wǎng)絡(luò)全面提速中國農(nóng)業(yè)銀行華為

2012-04-05 09:49:06

電信寬帶骨干網(wǎng)

2022-05-10 17:24:54

ZeroTier系統(tǒng)運維

2010-06-02 15:09:37

IPv6網(wǎng)絡(luò)地址

2011-04-12 15:06:34

IDC浪潮移動

2022-05-12 13:39:48

AI研究模型

2024-11-21 10:58:05

模型AI
點贊
收藏

51CTO技術(shù)棧公眾號