4.2 C/C++编程详解
4.2.1 加载bmodel
...
string net_name_;
SSD::SSD(bm_handle_t& bm_handle, const string bmodel):p_bmrt_(nullptr) {
bool ret;
bm_handle_ = bm_handle;
// init bmruntime contxt
p_bmrt_ = bmrt_create(bm_handle_);
if (NULL == p_bmrt_) {
cout << "ERROR: get handle failed!" << endl;
exit(1);
}
// load bmodel from file
ret = bmrt_load_bmodel(p_bmrt_, bmodel.c_str());
if (!ret) {
cout << "ERROR: Load bmodel[" << bmodel << "] failed" << endl;
exit(1);
}
const char **net_names;
bmrt_get_network_names(p_bmrt_, &net_names);
net_name_ = net_names[0];
free(net_names);
// get model info by model name
net_info_ = bmrt_get_network_info(p_bmrt_, net_name_.c_str());
if (NULL == net_info_) {
cout << "ERROR: get net-info failed!" << endl;
exit(1);
}
// get data type
if (NULL == net_info_->input_dtypes) {
cout << "ERROR: get net input type failed!" << endl;
exit(1);
}
if (BM_FLOAT32 == net_info_->input_dtypes[0]) {
threshold_ = 0.6;
is_int8_ = false;
} else {
threshold_ = 0.52;
...4.2.2 预处理
4.2.2.1 预处理初始化
4.2.2.2 打开视频流
4.2.2.3 解码视频帧
4.2.2.4 Mat 转换 bm_image
4.2.2.5 预处理
4.2.3 推理
4.2.4 后处理
4.2.5 算法开发注意事项汇总
最后更新于