retinaface wasm
1.0.0
This is a WASM implementation of the Retinaface face detection algorithm. It is based on the Retinaface paper.
本模組支援微信小程式且不依賴任何第三方函式庫, 可直接使用! (手動brotli 壓縮wasm 檔案和拷貝index.ts 程式碼即可)
npm install retinaface-wasm
import Retinaface , { getWasmFile , env } from 'retinaface-wasm'
import imagePath from './R.jpg'
const wasm = await WebAssembly . instantiateStreaming ( fetch ( 'https://cdn.jsdelivr.net/npm/retinaface-wasm/wasm/' + getWasmFile ( ) ) , env )
const retinaface = new Retinaface ( wasm . instance )
const image = new Image ( )
image . src = imagePath
await new Promise ( ( resolve , reject ) => {
image . onload = resolve
image . onerror = reject
} )
const [ data , scale ] = retinaface . processImage ( image )
const result = retinaface . detect ( data , scale )
console . log ( result )
retinaface . close ( )
node -e " fs.writeFileSync('retinaface-basic.wasm.br', zlib.brotliCompressSync(fs.readFileSync('retinaface-basic.wasm'))) "
WeChat Mini Program Example
478 Landmarks Example
Landmark Indexes
Shirasawa
MIT