Linux 下 MNN編譯 | 安裝 | 測試
文章目錄
文檔學(xué)習(xí)
首先安裝 protobuf (手動源碼安裝)
MNN 正確編譯和安裝
Demo 2.1 姿態(tài)檢測 ( TF 模型轉(zhuǎn)換 MNN 測試 )
文檔學(xué)習(xí)
系統(tǒng)環(huán)境: Ubuntu 18.04.5
MNN快速了解
中文文檔 – https://www.yuque.com/mnn/cn/cvrt_linux_mac
首先安裝 protobuf (手動源碼安裝)
git clone https://github.com/google/protobuf.git cd protobuf git submodule update --init --recursive ./autogen.sh ./configure 或者 指定 安裝目錄 (個人用戶要指定到 /home/當前用戶名/usr/local/ 不然下方可能會報錯) ./configure --prefix=/home/moli/usr/local/ make make check make install ldconfig # refresh shared library cache.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
git submodule update --init --recursive 執(zhí)行,可能遇到 benchmark.git 和 googletest.git 下載失敗;
我的方法是手動下載這兩個 git 庫 然后 復(fù)制到 protobuf/third_party 進行解壓
git submodule update --init --recursive # 報錯如下 Cloning into 'third_party/benchmark'... error: RPC failed; result=52, HTTP code = 0 fatal: The remote end hung up unexpectedly Clone of 'https://github.com/google/benchmark.git' into submodule path 'third_party/benchmark' failed
1
2
3
4
5
6
7
8
./autogen.sh 執(zhí)行遇到報錯
./autogen.sh # 報錯如下 + mkdir -p third_party/googletest/m4 + autoreconf -f -i -Wall,no-obsolete ./autogen.sh: 37: ./autogen.sh: autoreconf: not found
1
2
3
4
5
6
7
解決方法為
sudo apt-get install cmake-curses-gui sudo apt-get install autoconf automake libtool
1
2
3
4
普通用戶 make install 執(zhí)行遇到報錯
root 權(quán)限用戶應(yīng)該不會遇到這個問題
libtool: error: error: cannot install 'libprotoc.la' to a directory not ending in /usr/local/lib
1
解決方法:個人用戶則指定安裝到 當前用戶 usr/local/ 目錄 下,例如
./configure --prefix=/home/moli/usr/local/
1
MNN 正確編譯和安裝
git clone https://github.com/alibaba/MNN.git cd MNN cd schema && ./generate.sh cd .. mkdir build && cd build cmake -DMNN_BUILD_DEMO=ON -DMNN_BUILD_CONVERTER=true .. make -j32 # 安裝完成, 查看 版本 ./MNNConvert --version 0.2.1.5git
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Protobuf 如果沒有安裝可能會遇到如下報錯:
CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message): Could NOT find Protobuf (missing: Protobuf_INCLUDE_DIR) Call Stack (most recent call first): .. tools/converter/CMakeLists.txt:14 (find_package) -- Configuring incomplete, errors occurred!
1
2
3
4
5
6
7
8
9
Ubuntu 解決方法(似乎還是上面的手動源碼安裝能夠根本解決)
sudo apt-get install libprotobuf-dev protobuf-compiler protoc --version # 輸出如下 libprotoc 3.0.0
1
2
3
4
5
6
Demo 2.1 姿態(tài)檢測 ( TF 模型轉(zhuǎn)換 MNN 測試 )
測試主頁 :https://www.yuque.com/mnn/cn/demo_project
我的轉(zhuǎn)換命令如下( MNN/build 目錄下 ):
./MNNConvert -f TF --modelFile ../../changeModel/model-mobilenet_v1_075.pb --MNNModel mobilenet.mnn --bizCode biz # 輸出如下: MNNConverter Version: 0.2.1.5git - MNN @ 2018 Start to Convert Other Model Format To MNN Model... Start to Optimize the MNN Net... Converted Done!
1
2
3
4
5
6
7
8
9
10
選擇圖片進行測試
選取一張人像圖像 test.png 安放在 MNN/build/test 目錄下
執(zhí)行命令如下:
./multiPose.out mobilenet.mnn test/test.png pose.png
1
效果如下
恭喜你已經(jīng)讀到文末啦,多謝你的鼓勵!
Git linux
版權(quán)聲明:本文內(nèi)容由網(wǎng)絡(luò)用戶投稿,版權(quán)歸原作者所有,本站不擁有其著作權(quán),亦不承擔相應(yīng)法律責(zé)任。如果您發(fā)現(xiàn)本站中有涉嫌抄襲或描述失實的內(nèi)容,請聯(lián)系我們jiasou666@gmail.com 處理,核實后本網(wǎng)站將在24小時內(nèi)刪除侵權(quán)內(nèi)容。
版權(quán)聲明:本文內(nèi)容由網(wǎng)絡(luò)用戶投稿,版權(quán)歸原作者所有,本站不擁有其著作權(quán),亦不承擔相應(yīng)法律責(zé)任。如果您發(fā)現(xiàn)本站中有涉嫌抄襲或描述失實的內(nèi)容,請聯(lián)系我們jiasou666@gmail.com 處理,核實后本網(wǎng)站將在24小時內(nèi)刪除侵權(quán)內(nèi)容。