多尺度注意力机制的语义分割
多尺度注意力機(jī)制的語義分割
Using Multi-Scale Attention for Semantic Segmentation
在自動駕駛、醫(yī)學(xué)成像甚至變焦虛擬背景中,有一項重要的技術(shù)是常用的:語義分割。這是將圖像中的像素標(biāo)記為屬于N個類(N是任意數(shù)量的類)之一的過程,其中類可以是汽車、道路、人或樹等。對于醫(yī)學(xué)圖像,類對應(yīng)于不同的器官或解剖結(jié)構(gòu)。
NVIDIA是一種應(yīng)用廣泛的語義分割技術(shù)。還認(rèn)為,改進(jìn)語義分割的技術(shù)也可能有助于改進(jìn)許多其密集預(yù)測任務(wù),如光流預(yù)測(預(yù)測物體運動)、圖像超分辨率等。 開發(fā)了一種新的語義分割方法,在兩個共同的基準(zhǔn)上實現(xiàn)了創(chuàng)紀(jì)錄的最新結(jié)果:城市景觀Cityscapes數(shù)據(jù)集和地圖景觀,如下表所示。IOU是union上的交集,是一種描述語義預(yù)測準(zhǔn)確性的度量。
在城市景觀Cityscapes數(shù)據(jù)集中,這種方法在測試集上達(dá)到85.4個IOU,與其條目相比有了很大的改進(jìn),因為這些分?jǐn)?shù)彼此非常接近。
Table 1. Results on Cityscapes test set.
與使用集成實現(xiàn)58.7的次優(yōu)結(jié)果相比,使用Mapillary,在使用單個模型的驗證集上實現(xiàn)61.1 IOU。
Table 2. Results on Mapillary Vistas semantic segmentation validation set.
Research journey
為了開發(fā)這種新方法,考慮了圖像的哪些特定區(qū)域需要改進(jìn)。圖1顯示了當(dāng)前語義分割模型的兩種最大的失敗模式:細(xì)節(jié)錯誤和類混淆。
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).
在這個例子中,存在兩個問題:細(xì)節(jié)和類混淆。
在2倍尺度預(yù)測中,第一張圖片中的柱子的精細(xì)細(xì)節(jié)得到了最好的解決,但是在0.5倍尺度下,分辨率很差。
與中值分割相比,道路的粗預(yù)測在0.5倍尺度下比在2倍尺度下(存在等級混淆)得到更好的解決。
解決方案在這兩個問題上都表現(xiàn)得更好,類混淆幾乎消失,對精細(xì)細(xì)節(jié)的預(yù)測更加平滑和一致。
在確定了這些故障模式之后,該團(tuán)隊試驗了許多不同的策略,包括不同的網(wǎng)絡(luò)主干模型(例如,WiderResnet-38、EfficientNet-B4、Xception-71),以及不同的分段解碼器(例如,DeeperLab)。決定采用HRNet作為網(wǎng)絡(luò)主干,RMI作為主要的損耗函數(shù)。
HRNet被證明非常適合于計算機(jī)視覺任務(wù),因為保持了比以前的網(wǎng)絡(luò)WiderResnet38高2倍的分辨率。RMI損失提供了一種無需借助于條件隨機(jī)場之類的東西就可以獲得結(jié)構(gòu)損失的方法。HRNet和RMI丟失都有助于解決精細(xì)細(xì)節(jié)和類混淆問題。
為了進(jìn)一步解決主要的失效模式,創(chuàng)新了兩種方法:多尺度注意和自動標(biāo)記。
Multi-scale attention
為了達(dá)到最好的效果,在計算機(jī)視覺模型中通常使用多尺度推理。通過網(wǎng)絡(luò)運行多個圖像尺度,并將結(jié)果與平均池化相結(jié)合。
使用平均池化作為組合策略將所有規(guī)模視為同等重要。然而,精細(xì)細(xì)節(jié)通常最好在較高的尺度下預(yù)測,而大型物體在較低的尺度下預(yù)測更好,因為在較低的尺度下,網(wǎng)絡(luò)的接收場能夠更好地理解場景。
學(xué)習(xí)如何在像素級組合多尺度預(yù)測有助于解決這個問題。在這一策略上已有先例,陳的方法關(guān)注的規(guī)模是最接近的。在陳的方法中,注意力是同時學(xué)習(xí)所有尺度大小的。稱之為顯式方法,如圖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.
在陳的方法的激勵下,提出了一個多尺度注意力模型,該模型還訓(xùn)練預(yù)測一個稠密的面具,將多尺度預(yù)測結(jié)合在一起。然而,在這個方法中,訓(xùn)練了一個相對注意mask面罩,以便在一個尺度和下一個更高的尺度之間進(jìn)行嘗試,如圖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.
這種方法的主要好處如下:
理論訓(xùn)練花費比陳的方法減少了約4倍。
雖然訓(xùn)練只使用一對尺度進(jìn)行,但推理是靈活的,可以使用任意數(shù)量的尺度進(jìn)行。
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顯示了方法的一些例子,以及學(xué)習(xí)到的注意面罩。對于左邊圖片中的細(xì)條,0.5x預(yù)測的關(guān)注度很低,而2.0x尺度預(yù)測的關(guān)注度很高。相反,對于右側(cè)圖像中非常大的道路/分隔帶區(qū)域,注意機(jī)制學(xué)習(xí)如何最大程度地利用較低的尺度(0.5x),而更少地利用錯誤的2.0x預(yù)測。
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城市景觀數(shù)據(jù)集改善語義分割結(jié)果的一種常用方法是利用大量的粗?jǐn)?shù)據(jù)集。這個數(shù)據(jù)大約是基準(zhǔn)精細(xì)數(shù)據(jù)的7倍。以前的SOTA方法對城市景觀使用的是粗略的標(biāo)簽,要么使用粗略的數(shù)據(jù)對網(wǎng)絡(luò)進(jìn)行預(yù)訓(xùn)練,要么將其與精細(xì)的數(shù)據(jù)混合。
然而,粗糙的標(biāo)簽是一個挑戰(zhàn),因為是噪音和不精確的。真值粗標(biāo)簽如圖5所示為“原始粗標(biāo)簽”。
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.
受最近工作的啟發(fā),追求自動標(biāo)簽作為一種手段,以產(chǎn)生更豐富的標(biāo)簽,以填補標(biāo)簽空白的真值粗標(biāo)簽。生成的自動標(biāo)簽顯示的細(xì)節(jié)要比圖5中所示的基線粗略標(biāo)簽精細(xì)得多。相信這有助于通過填補長尾類數(shù)據(jù)分布中的空白來進(jìn)行泛化。
一個簡單的使用自動標(biāo)記的方法,例如使用教師網(wǎng)絡(luò)中的多類概率來指導(dǎo)學(xué)生,在磁盤空間上是非常昂貴的。為20000個粗圖像生成標(biāo)簽(19個類的分辨率都是1920×1080)大約需要2 TB的存儲空間。如此大的足跡所帶來的最大影響將是降低培訓(xùn)績效。
使用硬閾值方法而不是軟閾值方法,將生成的標(biāo)簽占用空間從2TB大大減少到600mb。在這種方法中,概率大于0.5的教師預(yù)測是有效的,概率較低的預(yù)測被視為“忽略”類。表4顯示了將粗?jǐn)?shù)據(jù)添加到細(xì)數(shù)據(jù)中以及使用融合數(shù)據(jù)集訓(xùn)練新學(xué)員的好處。
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.
總結(jié)
以上是生活随笔為你收集整理的多尺度注意力机制的语义分割的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: CUDA 8混合精度编程
- 下一篇: NVIDIA A100 GPUs上硬件J