nihui / ncnn-webassembly-portrait-segmentation

Portrait segmentation in your web browser with ncnn and webassembly

Home Page:https://nihui.github.io/ncnn-webassembly-portrait-segmentation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ncnn-webassembly-portrait-segmentation

open https://nihui.github.io/ncnn-webassembly-portrait-segmentation and enjoy

build and deploy

  1. 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
  1. Download and extract ncnn webassembly package
wget https://github.com/Tencent/ncnn/releases/download/20230223/ncnn-20230223-webassembly.zip
unzip ncnn-20230223-webassembly.zip
  1. Build four WASM feature variants
mkdir build
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
  1. Deploy the *.data *.js *.wasm and *.html files to your web server

About

Portrait segmentation in your web browser with ncnn and webassembly

https://nihui.github.io/ncnn-webassembly-portrait-segmentation


Languages

Language:C++ 47.5%Language:HTML 42.1%Language:CMake 10.5%