ncnn-webassembly-nanodet
ๆดๆฐ nanodet-plus ็ๆฌ
็ซๅจๅทจไบบ็่ฉ่ไธ๏ผๆ่ฐข nihui ๅคงไฝฌ
ๅ่ https://github.com/Tencent/ncnn/blob/master/examples/nanodetplus_pnnx.cpp ไฟฎๆนไบ nanodet-plus ็ๆฌ็ Web ็
open https://nihui.github.io/ncnn-webassembly-nanodet and enjoy
build and deploy
- Install emscripten
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install 3.1.28
./emsdk activate 3.1.28
source emsdk/emsdk_env.sh
- clone this repo
git clone https://github.com/nihui/ncnn-webassembly-nanodet.git
- Enter the repo direcroty and Download and extract ncnn webassembly package
wget https://github.com/Tencent/ncnn/releases/download/20230223/ncnn-20230223-webassembly.zip
unzip ncnn-20230223-webassembly.zip
- Build four WASM feature variants
mkdir build # in ncnn-webassembly-nanodet directory
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DWASM_FEATURE=basic ..
make -j4
cmake -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DWASM_FEATURE=simd ..
make -j4
cmake -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DWASM_FEATURE=threads ..
make -j4
cmake -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DWASM_FEATURE=simd-threads ..
make -j4
- Deploy the _.data _.js _.wasm and _.html files to your web server(you can find them in /build directory and this repo)
# deploy files
deploy/
โโโ index.html
โโโ nanodet-basic.data
โโโ nanodet-basic.js
โโโ nanodet-basic.wasm
โโโ nanodet-simd.data
โโโ nanodet-simd.js
โโโ nanodet-simd-threads.data
โโโ nanodet-simd-threads.js
โโโ nanodet-simd-threads.wasm
โโโ nanodet-simd-threads.worker.js
โโโ nanodet-simd.wasm
โโโ nanodet-threads.data
โโโ nanodet-threads.js
โโโ nanodet-threads.wasm
โโโ nanodet-threads.worker.js
โโโ wasmFeatureDetect.js
- Deploy local server(python3 as a example)
python3 -m http.server --directory deploy
- Access local server(chrome as a example)
# launch chrome browser, enter following command to address bar and press ENTER:
chrome://flags/#unsafely-treat-insecure-origin-as-secure
# enter following keyword to "Search flags" and press ENTER:
"insecure origins"
you will find "Insecure origins treated as secure" key
#enter local server url and click right side dropdown list, select "Enabled"
url example: http://192.168.1.100:8000
#relaunch chrome browser and access http://192.168.1.100:8000 (replace 192.168.1.100 with your local ip)