2025-03-20 18:24:12 +08:00
2025-03-20 18:24:12 +08:00
2025-03-07 17:07:02 +08:00
2025-03-06 14:38:32 +08:00
2025-03-06 14:45:32 +08:00
2025-03-11 11:34:05 +08:00
2025-03-20 18:24:12 +08:00
2025-03-17 12:24:30 +08:00
2025-03-06 14:38:32 +08:00

#AI工具箱

安装

npm install @yizhi/ai

使用

import ai from "@yizhi/ai";

// 配置相应的node插件插件需自行编译
ai.config("CV_ADDON_FILE", "/path/to/cv.node");
ai.config("MNN_ADDON_FILE", "/path/to/mnn.node");
ai.config("ORT_ADDON_FILE", "/path/to/onnxruntime.node");

//直接推理
const facedet = await ai.deploy.facedet.Yolov5Face.load("YOLOV5S_ONNX");
const boxes = await facedet.predict("/path/to/image");

//使用自己的模型
const session = new ai.backend.ort.Session(modelBuffer);
const outputs = session.run(inputs);

插件编译

  1. 依赖

    1. cmake
    2. ninja
    3. c++编译器(gcc,clang,Visual Studio ...)
  2. 编译第三方库

node thirdpart/install.js --with-mnn --with-onnx
  1. 编译插件
cmake -B build -G Ninja . -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release

注意注意在Windows下编译时需要打开Visual Studio命令行

Description
AI工具箱
Readme 220 KiB
1.0.6 Latest
2025-03-20 09:57:58 +00:00
Languages
TypeScript 57%
C++ 25.7%
JavaScript 11.9%
CMake 4.9%
C 0.5%