• <xmp id="om0om">
  • <table id="om0om"><noscript id="om0om"></noscript></table>
  • 3 月 19 日下午 2 點,鎖定 NVIDIA AI 網絡中文專場。立即注冊觀看
    智能圖像分析/物聯網

    使用 NVIDIA DALI 加速醫學圖像處理

    深度學習模型需要大量數據才能產生準確的預測,隨著模型規模和復雜性的增加,這種需求日益迫切。即使是大型數據集,例如擁有 100 多萬張圖像的著名 ImageNet ,也不足以在現代計算機視覺任務中實現最先進的結果。

    為此,需要使用數據增強技術,通過對數據引入隨機干擾(如幾何變形、顏色變換、噪聲添加等),人為地增加數據集的大小。這些干擾有助于生成預測更穩健的模型,避免過度擬合,并提供更好的精度。

    在醫學成像任務中,數據擴充至關重要,因為數據集最多只包含數百或數千個樣本。另一方面,模型往往會產生需要大量 GPU 內存的大激活,特別是在處理 CT 和 MRI 掃描等體積數據時。這通常會導致在小數據集上進行小批量的培訓。為了避免過度擬合,需要更精細的數據預處理和擴充技術。

    然而,預處理通常對系統的整體性能有重大影響。這在處理大輸入的應用程序中尤其如此,例如體積圖像。由于 NumPy 等庫的簡單性、靈活性和可用性,這些預處理任務通常在 CPU 上運行。

    在某些應用中,例如醫學圖像的分割或檢測,由于數據預處理通常在 CPU 中執行,因此訓練期間的 GPU 利用率通常不理想。解決方案之一是嘗試完全重疊數據處理和訓練,但并不總是那么簡單。

    這樣的性能瓶頸導致了雞和蛋的問題。由于性能原因,研究人員避免在他們的模型中引入更高級的增強,并且由于采用率較低,庫不會將精力放在優化預處理原語上。

    GPU 加速解決方案

    通過將數據預處理卸載到 GPU ,可以顯著提高具有大量數據預處理管道的應用程序的性能。 GPU 在此類場景中通常未得到充分利用,但可用于完成 CPU 無法及時完成的工作。其結果是更好的硬件利用率,最終更快的培訓。

    就在最近, NVIDIA 在 MICCAI 2021 腦腫瘤分割挑戰中獲得 10 個頂級排名中的 3 個 ,包括獲勝的解決方案。獲勝的解決方案通過加快系統的 preprocessing pipeline 速度,使 GPU 利用率高達 98% ,并將總訓練時間減少了約 5% ( 30 分鐘)(圖 1 )。

    Training time (time to train for 1000 epochs) with DALI used for preprocessing is 7:20 hours while the native PyTorch data loader is 7:50 hours.Training time (time to train for 1000 epochs) with DALI used for preprocessing is 7:20 hours while the native PyTorch data loader is 7:50 hours.
    圖 1 。 U-Net3D BraTS21 訓練性能比較

    當你查看NVIDIA 提交的[VZX333 ]時,這種差異變得更加顯著。它使用了與BraTS21獲獎解決方案相同的網絡體系結構,但具有更復雜的數據加載管道和更大的輸入量(KITS19數據集)。與本機管道相比,性能提升是令人印象深刻的2倍端到端培訓加速(圖2)。

    Training time (time to train with given accuracy defined in the MLPerf Training benchmark rules) with DALI used for preprocessing is around 80 minutes, with the native PyTorch data loader being 160 minutes. Thanks to DALI, the training is two times shorter.Training time (time to train with given accuracy defined in the MLPerf Training benchmark rules) with DALI used for preprocessing is around 80 minutes, with the native PyTorch data loader being 160 minutes. Thanks to DALI, the training is two times shorter.
    圖 2 。 U-Net3D MLPerf 訓練 1.1 訓練性能比較

    這是由 NVIDIA 數據加載庫( DALI ) 實現的。 DALI 提供了一組 GPU 加速構建塊,使您能夠構建完整的數據處理管道,包括數據加載、解碼和擴充,并將其與所選的深度學習框架集成(圖 3 )。

    DALI is a tool that handles data loading of various formats: images, video, and audio; decodes, transforms (including augmentation), and provides the data in the tensor native to the deep learning framework format. It uses GPU acceleration if possible for all the mentioned operations.DALI is a tool that handles data loading of various formats: images, video, and audio; decodes, transforms (including augmentation), and provides the data in the tensor native to the deep learning framework format. It uses GPU acceleration if possible for all the mentioned operations.
    圖 3 。 DALI 概述及其應用 在 DL 應用程序中用作加速數據加載和預處理的工具

    體積圖像操作

    最初, DALI 是作為圖像分類和檢測工作流的解決方案開發的。后來,它被擴展到其他數據域,如音頻、視頻或體積圖像。有關體積數據處理的更多信息,請參閱 3D TransformsNumPy 讀卡器 .

    DALI 支持多種圖像處理操作員。有些還可以應用于體積圖像。以下是一些值得一提的例子:

    • Resize
    • Warp affine
    • Rotate
    • 隨機對象邊界框

    為了展示上述的一些操作,我們使用了來自 BraTS19 數據集的一個樣本,該樣本由標記為腦腫瘤分割的 MRI 掃描組成。圖 4 顯示了從腦 MRI 掃描體積中提取的二維切片,其中較暗的區域表示標記為異常的區域。

    A cut of the brain scan with a region highlighted in a different color that represents an abnormality; a tumor in this case.A cut of the brain scan with a region highlighted in a different color that represents an abnormality; a tumor in this case.
    圖 4 。來自 BraTS19 數據集樣本的切片

    調整大小運算符

    Resize 通過插值輸入像素將圖像放大或縮小到所需形狀。可以分別為每個維度配置“高比例”或“低比例”,包括選擇插值方法。

    The left image shows a cut of the brain scan with a region highlighted in a different color that represents an abnormality; a tumor in this case. The right image is a recalled cut, where the height dimension is more aggressively scaled than the width.The left image shows a cut of the brain scan with a region highlighted in a different color that represents an abnormality; a tumor in this case. The right image is a recalled cut, where the height dimension is more aggressively scaled than the width.
    圖 5 。來自 BRAST19 數據集樣本(左)的參考切片與 resized 進行比較 sample (right)

    扭曲仿射算子

    Warp affine 通過線性變換將像素坐標從源映射到目標,應用幾何變換。

    Out(x,y,z)=In(xsrc,ysrc,zsrc)Out(x,y,z)=In(xsrc,ysrc,zsrc)

    Warp affine 可用于一次性執行多個變換(旋轉、翻轉、剪切、縮放)。

    A cut of the brain scan that is warped: it is stretched from left bottom to the right top and slightly rotated to the right.A cut of the brain scan that is warped: it is stretched from left bottom to the right top and slightly rotated to the right.
    圖 6 。卷的一部分,用 整經仿射

    旋轉運算符

    Rotate 允許您繞任意軸旋轉體積,該軸作為矢量和角度提供。它還可以選擇性地擴展畫布,使整個旋轉圖像包含在其中。圖 7 顯示了旋轉體積的示例。

    A cut of the brain scan that is slightly rotated to the left.A cut of the brain scan that is slightly rotated to the left.
    圖 7 。旋轉體的切片

    隨機對象邊界框操作符

    隨機對象邊界框 是一種適合于檢測和分段任務的運算符。如前所述,醫療數據集往往相當小,目標類別(如異常)占據的區域相對較小。此外,在許多情況下,輸入容量遠大于網絡預期的容量。如果要使用隨機裁剪窗口進行訓練,則大多數窗口不會包含目標。這可能導致訓練收斂速度減慢或使網絡偏向假陰性結果。

    此運算符選擇可能偏向于對特定標簽采樣的偽隨機作物。連接組件分析是在標簽圖上執行的一個預步驟。然后,以相同的概率隨機選擇一個連接的 blob 。通過這樣做,操作符可以避免過度呈現較大的斑點。

    您還可以選擇將選擇限制為最大的 K 個 blob 或指定最小 blob 大小。選擇特定 blob 時,將在包含給定 blob 的范圍內生成隨機裁剪窗口。圖 8 顯示了這個裁剪窗口選擇過程。

    The first image shows three differently colored groups of objects. Then only one, red, is selected, the smaller objects are filtered out. Then only one object is selected and a set of valid cropping windows that includes this object are displayed.The first image shows three differently colored groups of objects. Then only one, red, is selected, the smaller objects are filtered out. Then only one object is selected and a set of valid cropping windows that includes this object are displayed.
    圖 8 。想象 the 隨機對象邊界框 對具有一組屬于三個不同類別(每個類別用不同顏色高亮顯示)的對象的人造 2D 圖像的操作

    學習速度的提高是非常顯著的。在 KITS19 數據集上, nnU Net 在使用 隨機對象邊界框 運算符的測試運行時段中, 2134 達到與 3222 個隨機裁剪時段相同的精度。

    通常,查找連接組件的過程很慢,但數據集中的樣本數可能很小。操作員可以配置為緩存連接的組件信息,以便僅在培訓的第一個歷元中計算。

    自己加速

    您可以下載預構建和測試的 DALI pip packages 的最新版本。 TensorFlowPyTorchMXNet 的 NGC 容器集成了 DALI 。您可以查看許多 例子 并閱讀最新的 發布說明?,以獲取新功能和增強功能的詳細列表。

    了解 DALI 如何幫助您加速深度學習應用程序的數據預處理。訪問的最佳位置是 NVIDIA DALI 文檔 ,包括許多 示例和教程 。你也可以看我們的節目 GTC 2021 年談 DALI?. DALI 是一個開源項目,我們的代碼可以在 /NVIDIA/DALI GitHub repo 上找到。我們歡迎您的反饋和貢獻。

    ?

    0

    標簽

    人人超碰97caoporen国产