增加MNN模型支持
This commit is contained in:
87
cxx/node.cc
87
cxx/node.cc
@ -1,65 +1,28 @@
|
||||
// #include <unistd.h>
|
||||
// #include <napi.h>
|
||||
// #include "cv/node.h"
|
||||
// #ifdef USE_ORT
|
||||
// #include "ort/node.h"
|
||||
// #endif
|
||||
#include "common/node.h"
|
||||
#include "cv/node.h"
|
||||
#include "mnn/node.h"
|
||||
#include "ort/node.h"
|
||||
|
||||
// using namespace Napi;
|
||||
using namespace Napi;
|
||||
|
||||
// class TestWork : public AsyncWorker
|
||||
// {
|
||||
// public:
|
||||
// TestWork(const Napi::Function &callback, int value) : Napi::AsyncWorker(callback), val_(value) {}
|
||||
// ~TestWork() {}
|
||||
#if defined(BUILD_MAIN_WORD)
|
||||
Object Init(Env env, Object exports)
|
||||
{
|
||||
// OpenCV
|
||||
#ifdef USE_OPENCV
|
||||
printf("use opencv\n");
|
||||
InstallOpenCVAPI(env, exports);
|
||||
#endif
|
||||
// OnnxRuntime
|
||||
#ifdef USE_ONNXRUNTIME
|
||||
InstallOrtAPI(env, exports);
|
||||
#endif
|
||||
// MNN
|
||||
#ifdef USE_MNN
|
||||
InstallMNNAPI(env, exports);
|
||||
#endif
|
||||
|
||||
// void Execute()
|
||||
// {
|
||||
// printf("the worker-thread doing! %d \n", val_);
|
||||
// sleep(3);
|
||||
// printf("the worker-thread done! %d \n", val_);
|
||||
// }
|
||||
|
||||
// void OnOK()
|
||||
// {
|
||||
// Callback().Call({Env().Undefined(), Number::New(Env(), 0)});
|
||||
// }
|
||||
|
||||
// private:
|
||||
// int val_;
|
||||
// };
|
||||
|
||||
// Value test(const CallbackInfo &info)
|
||||
// {
|
||||
// // ai::ORTSession(nullptr, 0);
|
||||
|
||||
// // Function callback = info[1].As<Function>();
|
||||
// // TestWork *work = new TestWork(callback, info[0].As<Number>().Int32Value());
|
||||
// // work->Queue();
|
||||
// return info.Env().Undefined();
|
||||
// }
|
||||
|
||||
// Object Init(Env env, Object exports)
|
||||
// {
|
||||
// //OpenCV
|
||||
// NODE_INIT_OBJECT(cv, InstallOpenCVAPI);
|
||||
// //OnnxRuntime
|
||||
// #ifdef USE_ORT
|
||||
// NODE_INIT_OBJECT(ort, InstallOrtAPI);
|
||||
// #endif
|
||||
|
||||
// Napi::Number::New(env, 0);
|
||||
|
||||
// #define ADD_FUNCTION(name) exports.Set(Napi::String::New(env, #name), Napi::Function::New(env, name))
|
||||
// // ADD_FUNCTION(facedetPredict);
|
||||
// // ADD_FUNCTION(facedetRelease);
|
||||
|
||||
// // ADD_FUNCTION(faceRecognitionCreate);
|
||||
// // ADD_FUNCTION(faceRecognitionPredict);
|
||||
// // ADD_FUNCTION(faceRecognitionRelease);
|
||||
|
||||
// // ADD_FUNCTION(getDistance);
|
||||
// #undef ADD_FUNCTION
|
||||
// return exports;
|
||||
// }
|
||||
// NODE_API_MODULE(addon, Init)
|
||||
return exports;
|
||||
}
|
||||
NODE_API_MODULE(addon, Init)
|
||||
#endif
|
Reference in New Issue
Block a user