多尺度注意力机制的语义分割
多尺度注意力機制的語義分割
Using Multi-Scale Attention for Semantic Segmentation
在自動駕駛、醫學成像甚至變焦虛擬背景中,有一項重要的技術是常用的:語義分割。這是將圖像中的像素標記為屬于N個類(N是任意數量的類)之一的過程,其中類可以是汽車、道路、人或樹等。對于醫學圖像,類對應于不同的器官或解剖結構。
NVIDIA是一種應用廣泛的語義分割技術。還認為,改進語義分割的技術也可能有助于改進許多其密集預測任務,如光流預測(預測物體運動)、圖像超分辨率等。 開發了一種新的語義分割方法,在兩個共同的基準上實現了創紀錄的最新結果:城市景觀Cityscapes數據集和地圖景觀,如下表所示。IOU是union上的交集,是一種描述語義預測準確性的度量。
在城市景觀Cityscapes數據集中,這種方法在測試集上達到85.4個IOU,與其條目相比有了很大的改進,因為這些分數彼此非常接近。
Table 1. Results on Cityscapes test set.
與使用集成實現58.7的次優結果相比,使用Mapillary,在使用單個模型的驗證集上實現61.1 IOU。
Table 2. Results on Mapillary Vistas semantic segmentation validation set.
Research journey
為了開發這種新方法,考慮了圖像的哪些特定區域需要改進。圖1顯示了當前語義分割模型的兩種最大的失敗模式:細節錯誤和類混淆。
Figure 1. Illustration of common failures modes for semantic segmentation as they relate to inference scale. In the first row, the thin posts are inconsistently segmented in the scaled down (0.5x) image, but better predicted in the scaled-up (2.0x) image. In the second row, the large road / divider region is better segmented at lower resolution (0.5x).
在這個例子中,存在兩個問題:細節和類混淆。
在2倍尺度預測中,第一張圖片中的柱子的精細細節得到了最好的解決,但是在0.5倍尺度下,分辨率很差。
與中值分割相比,道路的粗預測在0.5倍尺度下比在2倍尺度下(存在等級混淆)得到更好的解決。
解決方案在這兩個問題上都表現得更好,類混淆幾乎消失,對精細細節的預測更加平滑和一致。
在確定了這些故障模式之后,該團隊試驗了許多不同的策略,包括不同的網絡主干模型(例如,WiderResnet-38、EfficientNet-B4、Xception-71),以及不同的分段解碼器(例如,DeeperLab)。決定采用HRNet作為網絡主干,RMI作為主要的損耗函數。
HRNet被證明非常適合于計算機視覺任務,因為保持了比以前的網絡WiderResnet38高2倍的分辨率。RMI損失提供了一種無需借助于條件隨機場之類的東西就可以獲得結構損失的方法。HRNet和RMI丟失都有助于解決精細細節和類混淆問題。
為了進一步解決主要的失效模式,創新了兩種方法:多尺度注意和自動標記。
Multi-scale attention
為了達到最好的效果,在計算機視覺模型中通常使用多尺度推理。通過網絡運行多個圖像尺度,并將結果與平均池化相結合。
使用平均池化作為組合策略將所有規模視為同等重要。然而,精細細節通常最好在較高的尺度下預測,而大型物體在較低的尺度下預測更好,因為在較低的尺度下,網絡的接收場能夠更好地理解場景。
學習如何在像素級組合多尺度預測有助于解決這個問題。在這一策略上已有先例,陳的方法關注的規模是最接近的。在陳的方法中,注意力是同時學習所有尺度大小的。稱之為顯式方法,如圖2所示。
Figure 2. The explicit approach of Chen, et al. learns a dense attention mask for a fixed set of scales to combine them to form a final semantic prediction.fusion.
在陳的方法的激勵下,提出了一個多尺度注意力模型,該模型還訓練預測一個稠密的面具,將多尺度預測結合在一起。然而,在這個方法中,訓練了一個相對注意mask面罩,以便在一個尺度和下一個更高的尺度之間進行嘗試,如圖3所示。稱之為層次方法。
Figure 3. Our hierarchical multi-scale attention method. Top: During training, our model learns to predict attention between two adjacent scale pairs. Bottom: Inference is done in a chained/hierarchical manner in order to combine multiple scales of predictions together. Lower scale attention determines the contribution of the next higher
scale.
這種方法的主要好處如下:
理論訓練花費比陳的方法減少了約4倍。
雖然訓練只使用一對尺度進行,但推理是靈活的,可以使用任意數量的尺度進行。
Table 3. Comparison of the hierarchical multi-scale attention method vs. other approaches on the Mapillary validation set. The network architecture is DeepLab V3+ with a ResNet-50 trunk. Eval scales: scales used for multi-scale evaluation. FLOPS: the relative amount of flops consumed by the network for training. This method achieves the best validation score, but with only a moderate cost as compared to the explicit approach.
圖4顯示了方法的一些例子,以及學習到的注意面罩。對于左邊圖片中的細條,0.5x預測的關注度很低,而2.0x尺度預測的關注度很高。相反,對于右側圖像中非常大的道路/分隔帶區域,注意機制學習如何最大程度地利用較低的尺度(0.5x),而更少地利用錯誤的2.0x預測。
Figure 4. Semantic and attention predictions at every scale level for two different scenes. The scene on the left illustrates a fine detail problem while the scene on the right illustrates a large region segmentation problem. A white color for attention indicates a high value (close to 1.0). The attention values for a given pixel across all scales sums to 1.0. Left: The thin road-side posts are best resolved at 2x scale, and the attention successfully attends more to that scale than other scales, as evidenced by the white color for the posts in the 2x attention image. Right: The large road/divider region is best predicted at 0.5x scale, and the attention does successfully focus most heavily on the 0.5x scale for that region.
Auto-labelling
利用Cityscapes城市景觀數據集改善語義分割結果的一種常用方法是利用大量的粗數據集。這個數據大約是基準精細數據的7倍。以前的SOTA方法對城市景觀使用的是粗略的標簽,要么使用粗略的數據對網絡進行預訓練,要么將其與精細的數據混合。
然而,粗糙的標簽是一個挑戰,因為是噪音和不精確的。真值粗標簽如圖5所示為“原始粗標簽”。
Figure 5. Example of our auto-generated coarse image labels. Auto-generated coarse labels (right) provide finer detail of labeling than the original ground truth coarse labels (middle). This finer labeling improves the distribution of the labels since both small and large items are now represented, as opposed to primarily large items.
受最近工作的啟發,追求自動標簽作為一種手段,以產生更豐富的標簽,以填補標簽空白的真值粗標簽。生成的自動標簽顯示的細節要比圖5中所示的基線粗略標簽精細得多。相信這有助于通過填補長尾類數據分布中的空白來進行泛化。
一個簡單的使用自動標記的方法,例如使用教師網絡中的多類概率來指導學生,在磁盤空間上是非常昂貴的。為20000個粗圖像生成標簽(19個類的分辨率都是1920×1080)大約需要2 TB的存儲空間。如此大的足跡所帶來的最大影響將是降低培訓績效。
使用硬閾值方法而不是軟閾值方法,將生成的標簽占用空間從2TB大大減少到600mb。在這種方法中,概率大于0.5的教師預測是有效的,概率較低的預測被視為“忽略”類。表4顯示了將粗數據添加到細數據中以及使用融合數據集訓練新學員的好處。
Table 4. The baseline method shown here uses HRNet-OCR as the trunk and our multi-scale attention method. We compare two regimes: training with ground truth fine + ground truth coarse labels to ground truth fine + auto-coarse labels (our method). The regime including the auto-coarse labels improves on the baseline by 0.9 IOU.
Figure 6. Qualitative example of auto-generated coarse image labels.
總結
以上是生活随笔為你收集整理的多尺度注意力机制的语义分割的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: CUDA 8混合精度编程
- 下一篇: NVIDIA A100 GPUs上硬件J