https://github.com/talkuhulk/aidb-webassembly-demo
ai.deploy.box webassembly demo
https://github.com/talkuhulk/aidb-webassembly-demo
3ddfa movenet ncnn pfld scrfd wasm webassembly yolov7 yolov8 yolox
Last synced: about 2 months ago
JSON representation
ai.deploy.box webassembly demo
- Host: GitHub
- URL: https://github.com/talkuhulk/aidb-webassembly-demo
- Owner: TalkUHulk
- Created: 2023-04-24T03:07:11.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-11T09:52:52.000Z (2 months ago)
- Last Synced: 2025-02-11T10:41:05.497Z (2 months ago)
- Topics: 3ddfa, movenet, ncnn, pfld, scrfd, wasm, webassembly, yolov7, yolov8, yolox
- Language: HTML
- Homepage: https://www.hulk.show/aidb-webassembly-demo/
- Size: 64 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## aidb-webassembly-demo
๐ถ[Try Demo](https://www.hulk.show/aidb-webassembly-demo/)
## build and deploy
Prior to starting, make sure you have `cmake` installed.
* 1. Clone ai.deploy.box
```
https://github.com/TalkUHulk/ai.deploy.box.git
cd ai.deploy.box
mkdir build && cd build
```* 2. Install emscripten
```shell
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install latest
./emsdk activate latestsource emsdk_env.sh
```* 3. Build
```shell
cmake .. -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DWASM_FEATURE=basic -DENGINE_NCNN_WASM=ON -DENGINE_MNN=OFF -DENGINE_ORT=OFF -DENGINE_NCNN=OFF -DENGINE_TNN=OFF -DENGINE_OPV=OFF -DENGINE_PPLite=OFF
make -j4cmake .. -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DWASM_FEATURE=simd -DENGINE_NCNN_WASM=ON -DENGINE_MNN=OFF -DENGINE_ORT=OFF -DENGINE_NCNN=OFF -DENGINE_TNN=OFF -DENGINE_OPV=OFF -DENGINE_PPLite=OFF
make -j4cmake .. -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DWASM_FEATURE=threads -DENGINE_NCNN_WASM=ON -DENGINE_MNN=OFF -DENGINE_ORT=OFF -DENGINE_NCNN=OFF -DENGINE_TNN=OFF -DENGINE_OPV=OFF -DENGINE_PPLite=OFF
make -j4cmake .. -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DWASM_FEATURE=simd-threads -DENGINE_NCNN_WASM=ON -DENGINE_MNN=OFF -DENGINE_ORT=OFF -DENGINE_NCNN=OFF -DENGINE_TNN=OFF -DENGINE_OPV=OFF -DENGINE_PPLite=OFF
make -j4
```* 4. Deploy
Clone the project, create a folder named `aidb` in the root project directory and copy the following files into it:
```
# deploy files
aidb/
โโโ aidb-wasm-basic.js
โโโ aidb-wasm-basic.wasm
โโโ aidb-wasm-simd.js
โโโ aidb-wasm-simd-threads.js
โโโ aidb-wasm-simd-threads.wasm
โโโ aidb-wasm-simd-threads.worker.js
โโโ aidb-wasm-simd.wasm
โโโ aidb-wasm-threads.js
โโโ aidb-wasm-threads.wasm
โโโ aidb-wasm-threads.worker.js
```Run local server:
```
python3 server.py
```* 5. 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://localhost:12580#relaunch chrome browser and access http://localhost:12580.
```## Reference
ๆ่ฐข[nihui](https://github.com/nihui)ๅคงไฝฌ๏ฝ
[่ทๅจๆต่งๅจ้็ncnnๅwebassembly](https://zhuanlan.zhihu.com/p/305601273)
[ncnn-webassembly-aidb-wasm](https://github.com/nihui/ncnn-webassembly-aidb-wasm)