Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Linux] facesdk_readModelFromFile 参数和编译后运行报错问题 #19

Closed
wasupandceacar opened this issue Dec 3, 2020 · 6 comments

Comments

@wasupandceacar
Copy link

如果直接编译 Linux 版本,会出现和 #15 一样的问题。

libTengineKitSDK.so 中,tenginekit_api.h 引用的 facesdk_readModelFromFile 函数的参数和 demo.cpp 中的函数参数不一样,多了一个 bool 参数,我也不知道这个参数的具体意义。

自己在 tenginekit_api.h 加入了这个 bool 参数,比如将

void facesdk_readModelFromFile(ModelType type, const char* model_path, ImageFormat modelInputFormat);

改为

void facesdk_readModelFromFile(ModelType type, const char* model_path, ImageFormat modelInputFormat, bool why);

之后,能够编译成功。但运行识别会报错:

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

colab 复现链接 可以复现这个报错

我看了一下,是 demo.app 的第 45 行会报错:

facesdk_readModelFromFile(ModelType::Detect, "models/detect.bin", ImageFormat::RGB, true);

另外,如果把 45 行的最后那个 bool 参数改为 false 的话:

facesdk_readModelFromFile(ModelType::Detect, "models/detect.bin", ImageFormat::RGB, false);

45 行不会报错,但 46 行会报错:

sdkFaces faces = facesdk_detect(data);

这种情况下,colab 不会显示错误,会直接退出运行,但在我自己机子上会显示这个错误:

Segmentation fault (core dumped)
@wasupandceacar
Copy link
Author

@Crusoekid 请问开发者这个问题有什么解决方法吗?

@Crusoekid
Copy link
Collaborator

你模型路径设置对了吗?"models/detect.bin"这个路径

@Crusoekid
Copy link
Collaborator

你用 facesdk_readModelFromFile(ModelType type, const char* model_path, ImageFormat modelInputFormat)这个接口就好

@Crusoekid
Copy link
Collaborator

我已经更新了最新版本的库,你可以替换尝试一下

@Litou-lyh
Copy link

我使用了最新版本,然后把模型路径改为绝对路径就行了,看来是demo里写的路径不对

@wasupandceacar
Copy link
Author

已解决,谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants