一、簡述
"SBNet: Sparse Blocks Network for Fast Inference"
來自多倫多大學和Uber ATG,針對
稀疏性資料
改進了傳統卷積網路結構,應用在自動駕駛環境下的物體檢測,檢測效率能提高
2~4倍
,並且理論上能夠
植入
到任何一個網路單元中,具備較好的擴充套件性。(好像就是名字起得不太好?)。此外還提供了
官方解說影片(無牆版)
及
程式碼
。
二、核心思路總結
根據已知或預測的
binary mask(attention mechanism)
,對feature map進行
blockwise分解
,生成
稀疏塊
及對應的
tile indices
(示意圖如圖一),然後將這些稀疏塊
聚集(Gather)
在一起形成新的tensor,透過卷積操作(
valid convolution
)後將結果
分散(Scatter)
回原先的位置上,並更新原始tensor。
圖一:Reduce Mask Operation from SBNet
可以看到思路很明確,只對mask對應的稀疏塊進行卷積,大大提高了系統的執行效率。SBNet模組結構見下圖。
圖二:Tiled Sparse Convolution Module
三、要點分析
1. Attention Mechanism
傳統“全域性搜尋”式
Dense
Convolution效率比較低,因為我們需要關注的事物可能僅僅位於某一個
特定區域
。針對自動駕駛環境下的物體檢測,無人車只關注
道路上
的物體,而其他空間的物體是無關緊要的,如果進行dense conv會無益於檢測精度並導致檢測效率降低。
進一步說,如何找到特定區域(mask)併合理進行卷積操作是提高系統效率的關鍵,這裡的特定區域可以理解為一系列的
region proposals
組合而成(之間存在重疊)。
SBNet透過兩種方式獲取mask,一是利用Uber的
Car3D LiDAR Dataset
中road and sidewalk mask,如圖三所示,淺藍色區域即為mask,標記了道路以及人行道;二是根據其他網路線上預測mask,比如
PSPNet
。
圖三:Road Mask from SBNet
預測得到的mask擁有
更小的區域
,因此能進一步提高檢測效率,但是受到某些不準確預測結果的影響,會導致檢測精度在一定程度上降低。Dense conv, SBNet + Road Mask, SBNet + Predicted Mask檢測結果見下圖,可以看出第三列的淡藍色區域明顯減少並呈現塊狀分佈,檢測效率比基於Road Mask的要快1。5倍,如表一所示。相比於Dense,SBNet + PSP檢測結果中有
誤檢
和
漏檢
的情況,因此mAP要低一些。
圖四:Detection Results of Different Methods
表一:Speed and Accuracy Comparisons
2. Gather and Scatter Kernel
在聚集過程(
Sparse-to-Dense
)中,假設輸入tensor尺寸為
並且塊個數為
,利用
大小的切片將各個塊從feature map中“切下來”,然後
堆疊
到一起可以得到尺寸為
的新tensor,如圖二所示。這一過程中,塊之間是存在重疊的。此後,在新tensor上進行卷積操作,並生成
的tensor。
在分散過程(
Dense-to-Sparse
)中,輸入
的tensor,將每一塊結果重新
覆蓋
到原始輸入tensor上。覆蓋時,每一個塊對應一個執行緒,因此多個塊可以同時
並行寫入
,但是在gather時塊之間是有重疊區域的,即存在很多
臨界區
,導致不能同時對其進行寫操作。SBNet提出只覆蓋
非重疊
的塊區域,所以不需要
原子鎖
等處理方式,並可以生成
無縫鄰接塊
。在圖二中可以看到,黃色區域要比橙色區域小一些。
這兩個kernel可以植入到其他網路單元中,以針對稀疏結構的資料提高系統執行效率,比如下圖裡植入到殘差單元中。
圖五:Plug into Residual Unit
四、一些思考
1. 更精準的mask
SBNet是應用在點雲投影為
BEV
(Bird‘s Eye View)場景下,其尺寸為800x1400x33,給出的mask是基於路面的,相當於只限制了點雲中點的x和y座標,在
豎直方向
是沒有約束的。但是,我們知道幾乎所有的物體都位於同一水平面上,因此可以進一步縮小mask的z座標範圍。
此外,只是利用預先已知的mask進行檢測還是存在很大的
侷限性
。因此,動態預測mask是一個有趣且有用的工作,
高質量
的mask能夠同時提高檢測系統的精度和效率。
2. SDNet
雖然目前的SBNet能夠完美應用於BEV上,但是還沒有真正推廣至raw point cloud,畢竟將點雲投影為BEV存在
空間資訊損失
。個人認為從Sparse Block Network完善到
Sparse Data Network
(SDNet。。。這個名字也很尬)是一項有意義的工作。
鑑於點雲過於稀疏,可以先採用
VoxelNet
類似的預處理方式,將點雲劃分、聚類為一系列的
Voxel
,然後根據mask提取對應部分Voxel,對其進行
gather-3d conv-scatter
操作。這種方式可以保證在不損失任何空間資訊的前提下,縮小卷積操作範圍,從而提高VoxelNet的執行效率。
Attention mechanism也同樣可以遷移至
AVOD
,
PointFusion
等存在
點雲和RGB資訊融合
的模組中。
3. 多尺度聚合卷積
在SBNet中,為了方便卷積操作,所有的block尺寸大小是相同的,因此會限制最終檢測器的檢測能力。由2D Detection中
anchor
的設計自然能想到設計不同尺度的block,以提高不同大小物體的檢測效能。解決方案的話可以在聚合時,另外多延伸出若干個不同尺度的分支,分別利用不同尺度的卷積核並行進行卷積操作。
除此之外,block尺寸的
全域性動態分配
也是一個值得深入的點。
五、靈句解釋
1。 Spending
equal amount
of computation at
all spatial locations
is a tremendous
waste
, since
spatial sparsity
is ubiquitous in many applications。 Spatial sparsity can be represented as
binary computation masks
where ones indicate
active locations
that need more computation and zeros inactive。
# 表明空間稀疏性是普遍存在的,空間全域性計算是一個低效率的方式,同時給出了空間稀疏性的表示
2。 Instead of convolving the input features at every location, we propose to use the
masks
to guide the convolutional filters。 Computation masks can also be considered as a form of
attention mechanism
where the attention weights are binary。
# 針對空間稀疏性的解決方法
3。 We gather
overlapping blocks
, but during the scatter stage, each thread writes to
non-overlapping blocks
so that the writes do not require
atomics locking
and yield“
gapless"
equivalent results for adjacent blocks。 In the scatter kernel, the results of convolution operation are then
copied back
on top of the dense activation tensor。
# gather和scatter的實施細節
4。 This
input overlap
is essential to producing the output that
seamlessly stitches
the results of adjacent block convolutions in a way that is locally-equivalent to a dense convolution on a larger block and fused indexing capability is critical to
practical speed-up
。
# 重疊部分對生成無縫鄰接塊是重要的
5。 To achieve the maximum speed-up we perform a
search sweep
over a range of block sizes to
automatically pick
the fastest-performing block decomposition。
# 塊的尺寸是自動選取的