国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

YOLO-World技術小結

這篇具有很好參考價值的文章主要介紹了YOLO-World技術小結。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

info
paper https://arxiv.org/abs/2401.17270
code https://github.com/AILab-CVC/YOLO-World
org 騰訊
demo https://huggingface.co/spaces/stevengrove/YOLO-World
個人博客位置 http://www.myhz0606.com/article/yolo_world

1 Motivation

這篇文章從計算效率的角度解決開集目標檢測問題(open-vocabulary object detection,OVD)。

YOLO-World技術小結,目標檢測,YOLO,YOLO-World,開集目標檢測

YOLO-World技術小結,目標檢測,YOLO,YOLO-World,開集目標檢測

2 Method

經典的目標檢測的instance annotation是bounding box和類別對 Ω = { B i , c i } i = 1 N \Omega = \{ B_i, c_i\}^{N}_{i=1} Ω={Bi?,ci?}i=1N?。對于OVD來說,此時的注釋變?yōu)?span id="n5n3t3z" class="katex--inline"> Ω = { B i , t i } i = 1 N \Omega = \{ B_i, t_i\}^{N}_{i=1} Ω={Bi?,ti?}i=1N?,此處的 t t t可以是類別名、名詞短語、目標描述等。此外YOLO-Word還可以根據傳入的圖片和text,輸出預測的box及相關的object embedding。

2.1 模型架構

YOLO-World技術小結,目標檢測,YOLO,YOLO-World,開集目標檢測

模型架構由3個部分組成

  • YOLO backbone,用于提取多尺度的圖片特征
  • text encoder,用于提取名詞短語的特征。流程如下:給定一段text,首先會提取里面的名詞,隨后將提取的每個名詞短語輸入CLIP中得到向量??梢灾?code>text encoder的輸出 W W W ∈ R C × D \in \mathbb{R} ^{C \times D} RC×D, C C C是名詞短語的數量, D D D是embedding的維度
  • Vision-Language PAN。用于預測bounding box和object embedding。其架構如下圖所示,核心組件有兩個,分別為Text-guided CSPLayerImage-Pooling Attention。下面對其進行簡單介紹

Text-guided CSPLayer

該層的目的是為了用文本向量來強化圖片特征。具體計算公式如下

X l ′ = X l ? δ ( max ? j ∈ { 1.. C } ( X l W j ? ) ) ? (1) X _ { l } ^ { \prime } = X _ { l } \cdot \delta ( \max _ { j \in \{ 1 . . C \} } ( X _ { l } W _ { j } ^ { \top } ) ) ^ { \top } \tag{1} Xl?=Xl??δ(j{1..C}max?(Xl?Wj??))?(1)

式中: X l ? ∈ ? R ? H × W × D ? ( l ? ∈ ? { 3 , 4 , 5 } ) X _ { l } \, \in \, \mathbb { R } ^ { \, H \times W \times D } \, ( l \, \in \, \{ 3 , 4 , 5 \} ) Xl?RH×W×D(l{3,4,5}) 為多尺度的圖片特征。 W j W_j Wj?為名詞 j j j的text embedding。 δ \delta δsigmoid函數。

YOLO-World技術小結,目標檢測,YOLO,YOLO-World,開集目標檢測

**Image-Pooling Attention**

該層的目的是為了用圖片特征來強化文本向量。具體做法為:將多尺度圖片特征通過max pooling,每個尺度經過max-pooling后的size ∈ R 3 × 3 × D \in \mathbb{R} ^ {3 \times 3 \times D} R3×3×D即9個patch token,因為有3個尺度,總計27個patch token,記作 X ~ ∈ R 27 × D \tilde { X } \in \mathbb{R}^{27 \times D} X~R27×D 。隨后將這27個patch token作為 cross-attention的key,value,將text embedding作為query進行特征交互,從而得到image-aware的文本特征向量。

W ′ = W + M u l t i H e a d A t t e n t i o n ( W , X ~ , X ~ ) ?? (2) W ^ { \prime } = W + \mathrm { M u l t i H e a d } \mathrm { A t t e n t i o n } ( W , \tilde { X } , \tilde { X } ) \; \tag{2} W=W+MultiHeadAttention(W,X~,X~)(2)

2.2 優(yōu)化目標

優(yōu)化目標分為兩部分:其一是針對語義的region-text 對比損失 L c o n \mathcal{L} _ {\mathrm{con}} Lcon?,其二是針對檢測框的IOU loss L i o u \mathcal{L}_{\mathrm{iou}} Liou?和distributed focal loss L f l d \mathcal{L}_{\mathrm{fld}} Lfld?,總體優(yōu)化目標如下:

L ( I ) ?? = ?? L c o n ? + ? λ I ? ? ? ( L i o u ? + ? L d f l ) , (3) { \mathcal L } ( I ) \; = \; { \mathcal L } _ { \mathrm { c o n } } \, + \, \lambda _ { I } \, \cdot \, ( { \mathcal L } _ { \mathrm { i o u } } \, + \, { \mathcal L } _ { \mathrm { d f l } } ) , \tag{3} L(I)=Lcon?+λI??(Liou?+Ldfl?),(3)

2.3 一些細節(jié)

2.3.1 如何大批量自動化生成訓練標注

目前我們可以很方便的拿到圖片對數據,此處的目標是如何將圖文對數據轉化成,圖片-instance annotation ( Ω = { B i , t i } i = 1 N \Omega = \{ B_i, t_i\}^{N}_{i=1} Ω={Bi?,ti?}i=1N?)的形式

作者的方法如下:

import string
import nltk
from nltk import word_tokenize, pos_tag

nltk.download('punkt')
nltk.download('averaged_perceptron_tagger')

def extract_noun_phrases(text):
    
    tokens = word_tokenize(text)
    tokens = [token for token in tokens if token not in string.punctuation]
    tagged = pos_tag(tokens)
    print(tagged)
    grammar = 'NP: {<DT>?<JJ.*>*<NN.*>+}'
    cp = nltk.RegexpParser(grammar)
    result = cp.parse(tagged)
    
    noun_phrases = []
    for subtree in result.subtrees():
        if subtree.label() == 'NP':
            noun_phrases.append(' '.join(t[0] for t in subtree.leaves()))
    
    return noun_phrases

[STEP2]: 將圖片和提取的名詞短語輸入到GLIP中檢測bounding box

[STEP3]: 將(region_img, region_text)和(img, text)送入到CLIP中計算相關度,如果相關度低,則過濾掉這個圖片(作者制定的規(guī)則是 s = s i m g ? s r e g i o n > 0.3 s = \sqrt { s ^ { i m g } * s ^ { r e g i o n }} > 0.3 s=simg?sregion ?>0.3)。再通過NMS過濾掉冗余的bounding box。

2.3.2 Vision-Language PAN 的重參數化

當推理的詞表是固定的時候,此時text encoder的輸出是固定的, W ∈ R C ′ × D W\in \mathbb{R} ^{C' \times D} WRC×D , C ′ C' C是offline詞表的大小, D D D是embedding的維度。此時可以對Vision-Language PAN 層進行重參數化。

Text-guided CSPLayer 的重參數化

由于此時的 W W W是固定的,可以將其reshape成 W ∈ R C ′ × D × 1 × 1 W \in \mathbb{R} ^{C' \times D \times 1 \times 1} WRC×D×1×1隨后作為1x1卷積的權重,此時式1可以轉化為:

X ′ = X ⊙ δ ( max ? ( C o n v ( X , W ) , d i m = 1 ) ) , (4) X ^ { \prime } = X \odot \delta ( \max ( \mathtt{Conv} ( X , W ) , \mathtt { d i m } = 1 ) ) , \tag{4} X=Xδ(max(Conv(X,W),dim=1)),(4)

⊙ \odot 表示包含reshape和transpose的矩陣乘法運算

**Image-Pooling Attention 的重參數化**

作者表示可以將式2簡化為:

W ′ = W + S o f t m a x ( W ⊙ X ~ ) , d i m = ? 1 ) ⊙ W , (5) W ^ { \prime } = W + \mathtt { S o f t m a x } ( W \odot \tilde { X } ) , \mathtt { d i m } = - 1 ) \odot W , \tag{5} W=W+Softmax(WX~),dim=?1)W,(5)

論文給出的這個公式似乎有點問題,dim=-1不確定對應哪個操作?,此公式位于論文式6。
另外 ⊙ \odot 這個符號似乎有點歧義,在式4中, ⊙ \odot 應該是對應元素相乘(Hadamard product),式5中應該是普通矩陣乘法 (matmul product

3 Result

3.1 YOLO world的zero-shot能力

下表展現了YOLO-world在LVIS數據集上的zero-shot能力,可見效果優(yōu)于當前Sota,但速度更快(評估硬件:NVIDIA V100 GPU w/o TensorRT)。

YOLO-World技術小結,目標檢測,YOLO,YOLO-World,開集目標檢測

3.2 預訓練數據集對效果的影響

Object365GlodG就能達到較好的效果。加入CC3M效果提升不是很大,可能是因為CC3M的標簽是用2.3.1節(jié)的方法生成的,含有較多噪聲導致。

YOLO-World技術小結,目標檢測,YOLO,YOLO-World,開集目標檢測

3.3 text encoder對效果的影響

如果用輕量backbone最好結合微調。CLIP本身預訓練的數據規(guī)模特別大,如果微調數據不多的話,frozen的效果反而好。

YOLO-World技術小結,目標檢測,YOLO,YOLO-World,開集目標檢測

5 參考文獻

YOLO-World: Real-Time Open-Vocabulary Object Detection文章來源地址http://www.zghlxwxcb.cn/news/detail-836429.html

到了這里,關于YOLO-World技術小結的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網!

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。如若轉載,請注明出處: 如若內容造成侵權/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經查實,立即刪除!

領支付寶紅包贊助服務器費用

相關文章

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領取紅包,優(yōu)惠每天領

二維碼1

領取紅包

二維碼2

領紅包