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

fix(examples): load_param always failed #4001

Merged
merged 2 commits into from
Jul 6, 2022
Merged

Conversation

jedi007
Copy link
Contributor

@jedi007 jedi007 commented Jul 6, 2022

同步更新代码后examples无法成功运行,在成功加载模型文件后执行了exit(-1)程序退出

if (!yolov5.load_param("yolov5s.ncnn.param"))
exit(-1);

源码显示加载成功是返回0,所以master中的逻辑是加载成功就执行exit(-1)~~~!!!

ncnn/src/net.h

Lines 81 to 84 in 1892c25

// return 0 if success
int load_param(FILE* fp);
int load_param(const char* protopath);
int load_param_mem(const char* mem);

PS:修改后可以成功运行了,不过感觉转Bool处理有点返人类~为False是成功加载,为True是失败。:-)

@nihui
Copy link
Member

nihui commented Jul 6, 2022

非常感谢!

@nihui nihui merged commit 434e55c into Tencent:master Jul 6, 2022
@jedi007 jedi007 deleted the fix_examples branch July 11, 2022 01:07
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

Successfully merging this pull request may close these issues.

2 participants