二階段最優質量傳輸的數值軟體實作
Software Implementation of Two Stage Optimal Mass Transportation
摘要
二階段最優質量傳輸作為深度學習任務的前處理時最大的問題是太花時間,一次的保質量最優質量傳輸參數化通常需要計算非常多次的線性系統,在以往的研究中為了能夠減少 二階段最優質量傳輸的計算時間,這些大量的線性系統的計算工作都是在 MATLAB 上執行,而之後的深度學習任務則是回到 Python 上用 Pytorch 模組執行,這會導致兩個嚴重問題,第一,檔案的 I/O 問題,儘管 Python 中的 Scipy 模組有針對 MATLAB 的 Mat 檔案的讀取方法,但是 MATLAB 和 Python 對於三維影像的讀取方式是有差別的,這對以往的研究中造成不少困擾,第二是 MATLAB 不易取得和對於硬體要求過高,在現今深度學習任務多元化的大環境中,研究團隊經常需要在他人的電腦或是伺服器上進行深度學習任務,而需要付費的 MATLAB 就成為一個大問題,就算有 MATLAB 可以使用,也經常會遇到開發環境不同問題,雖然 Docker 等開發工具可以解決這類問題,但是仍然造成許多串接和開發問題,例如因為 MATLAB 對軟硬體需求較高,因此也很難在一些小型裝置上運作,此外,如果二階段最優質量傳輸有機會成為某些現實產品的一部份時,會遇到另一個嚴重問題, MATLAB 是需要付費的,因此產品方式需要購買 MATLAB 才能使用二階段最優質量傳輸,因此Python 版本二階段最優質量傳輸的開發是勢在必行的,這也是本論文的主要貢獻。
The main challenge of using two stage optimal mass transportation (TSOMT) as a preprocessing step in deep learning tasks is the extensive computational time required. A single volume-measure-preserving optimal mass transportation parameterization usually requires the computation of a large number of linear systems. In previous studies, to reduce the computational time of TSOMT, these extensive computations were performed in MATLAB, while the subsequent deep learning tasks were performed in Python using PyTorch. This approach led to two significant problems. First, there were file I/O issues. Although the SciPy module in Python provides support for reading MATLAB mat files, MATLAB and Python still have different ways of handling three-dimensional image. This discrepancy has caused considerable difficulty in previous research. Second, MATLAB is not easily accessible and executable. In today's diverse environment of deep learning tasks, research teams often need to perform deep learning tasks on other people's computers or servers. The need for paid MATLAB licenses becomes a major obstacle. Even when MATLAB is available, compatibility issues often arise due to different development environments. While tools like Docker can help address these issues, they still pose various integration and development challenges. For example, MATLAB has higher requirements for hardware and software, making it difficult to operate on certain edge devices. Furthermore, if TSOMT has the potential to become part of certain real-world products, another significant issue arises: MATLAB requires a paid license, which means that purchasing MATLAB would be necessary to use TSOMT in the product. Therefore, the development of a Python version of TSOMT is essential. This contribution is the main focus of this thesis.