42 Views

train CNN on MATLAB without GPU-supporting – Apakah bisa menggunakan training deep machine learning di Matlab tanpa adanya GPU? Postingan ini adalah kelanjutan sebelumnya, sedikit membahas mengenai function/class arrayDatastore yang ada dikenal di Matlab R2020b. Setelah saya install dan timbul masalah lagi, yups ternyata butuh yang namanya GPU yang bagus agar bisa berjalan dengan baik.

gpuArray() sudah menjadi wajib sejak R2011b tapi kalau kita menggunakan Matlab R2020b ternyata butuh spek GPU yang cukup tinggi, bisa kalian cek disini

Sehingga mau tidak mau, harus punya GPU Nvidia yang harganya cukup mehong. Saya sudah mencari beberapa referensi agar tidak perlu menggunakan gpuArray() menjadi CPU saja, tidak didukung oleh Matlab.

https://www.mathworks.com/matlabcentral/answers/377531-why-doesn-t-matlab-support-cpuarray-for-some-array-creation-functions

https://www.mathworks.com/matlabcentral/answers/261235-reading-saved-gpuarray-data-with-a-non-gpu-computer

sampai pada https://www.researchgate.net/post/Are_there_any_ways_to_train_CNN_on_MATLAB_without_GPU-supporting

merujuk pada https://www.vlfeat.org/matconvnet/ –  MatConvNet is a MATLAB toolbox implementing Convolutional Neural Networks (CNNs) for computer vision applications. It is simple, efficient, and can run and learn state-of-the-art CNNs.

Tapi kalian harus punya compiler dulu, disini buat download compiler mingw  atau langsung kesini https://www.mathworks.com/matlabcentral/fileexchange/52848-matlab-support-for-mingw-w64-c-c-compiler pastikan kalian punya account di Matlab ya karena pas install butuh persetujuan lisensi dan login

Setelah kalian instal, setting compiler dulu dengan perintah

mex -setup C++

Kalau sudah menghasilkan output berikut

MEX configured to use 'MinGW64 Compiler (C++)' for C++ language compilation.

tapi….. ternyata butuh Visual Studio 2017. heee… heee sial sekali yaaa… jadi ternyatanya butuh Compilter nya visual studio 2017 karena ada error ketika menjalankan proses kompilasi

'cl.exe' is not recognized as an internal or external command, 
operable program or batch file.

ntar saya lanjutkan lagi setelah download VS 2017

https://www.mathworks.com/matlabcentral/answers/331523-unable-to-find-cl-exe-executing-vl_compilenn

https://www.mathworks.com/matlabcentral/answers/337571-unable-to-find-cl-exe-while-l-download-matconvnet

Setelah download VS 2017 dan mengetikan perintah

mex -setup C++ maka

akan tampil

MEX configured to use 'Microsoft Visual C++ 2017' for C++ language compilation.

Serta jangan lupa setting path agar bisa nemukan lokasi cl.exe nya

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64

Kalau sudah ok semuanya, run saja kode vl_compilenn.m yang ada di lokasi

D:\MatConvNet\matconvnet-1.0-beta25\matlab

Berikut hasil kompilasi kode nya

>> vl_compilenn
Building with 'Microsoft Visual C++ 2017'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017 (C)'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017 (C)'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017 (C)'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017 (C)'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017 (C)'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017 (C)'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017 (C)'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017 (C)'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017 (C)'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017 (C)'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2017 (C)'.
MEX completed successfully.

Atau kalian bisa ikut langkah-langkah di https://www.vlfeat.org/matconvnet/quick/

Kesimpulan

Nampaknya train CNN on MATLAB without GPU-supporting bisa dilakukan menggunakan library tersebut seperti hal umumnya di python-tensorflow yang bebas memilih menggunakan GPU atau tidak ataupun kalian bisa menggunakan ini kalau di Python

Referensi

https://github.com/vlfeat/matconvnet

Leave a Reply

Your email address will not be published. Required fields are marked *

+ 61 = 63