detail | 详细描述 | 詳細な説明
static int arcface_forward(const cv::Mat& aligned, std::vector& feature){
ncnn::Mat input = ncnn::Mat::from_pixels(aligned.data,ncnn::Mat::PIXEL_BGR2RGB,112,112);
const float mean_vals[3] = {127.5f, 127.5f, 127.5f};
const float norm_vals[3] = {1 / 128.f, 1 / 128.f, 1 / 128.f};
input.substract_mean_normalize(mean_vals,norm_vals);
ncnn::Extractor ex = ArcFace.create_extractor();
// ex.set_num_threads(1);
ex.set_light_mode(true);
ex.input("data",input);
ncnn::Mat output;
OH_LOG_Print(LOG_APP, LOG_INFO, GLOBAL_RESMGR, TAG, "已完成input操作!");
//提取前向层数据进行转换
ex.extract("fc1",output);
OH_LOG_Print(LOG_APP, LOG_INFO, GLOBAL_RESMGR, TAG, "接下来进行output操作!");
auto dim = output.total();
feature.resize(dim);
for(int i = 0;i < feature.size();i++){
feature[i] = output[i];
}
OH_LOG_Print(LOG_APP, LOG_INFO, GLOBAL_RESMGR, TAG, "接下来进行特征值自然化操作!");
normalize(feature);
return 0; //返回0表示成功处理arcface前向处理
}
在运行至ex.extract("fc1",output);时候报了推理崩溃错误
#00 pc 00000000004feb50 /data/storage/el1/bundle/libs/arm64/libnativerender.so(ncnn::PReLU_arm::forward_inplace_fp16sa(ncnn::Mat&, ncnn::Option const&) const+1240)(144ef6f0e7d26c04722490d478388df16ecf9ed6)
#1 pc 00000000003a2d08 /data/storage/el1/bundle/libs/arm64/libnativerender.so(ncnn::NetPrivate::do_forward_layer(ncnn::Layer const*, std::__n1::vector<ncnn::Mat, std::__n1::allocatorncnn::Mat>&, ncnn::Option const&) const+2844)(144ef6f0e7d26c04722490d478388df16ecf9ed6)
#2 pc 00000000003a204c /data/storage/el1/bundle/libs/arm64/libnativerender.so(ncnn::NetPrivate::forward_layer(int, std::__n1::vector<ncnn::Mat, std::__n1::allocatorncnn::Mat>&, ncnn::Option const&) const+156)(144ef6f0e7d26c04722490d478388df16ecf9ed6)
detail | 详细描述 | 詳細な説明
static int arcface_forward(const cv::Mat& aligned, std::vector& feature){
ncnn::Mat input = ncnn::Mat::from_pixels(aligned.data,ncnn::Mat::PIXEL_BGR2RGB,112,112);
const float mean_vals[3] = {127.5f, 127.5f, 127.5f};
const float norm_vals[3] = {1 / 128.f, 1 / 128.f, 1 / 128.f};
// ex.set_num_threads(1);
ex.set_light_mode(true);
ex.input("data",input);
ncnn::Mat output;
OH_LOG_Print(LOG_APP, LOG_INFO, GLOBAL_RESMGR, TAG, "已完成input操作!");
//提取前向层数据进行转换
ex.extract("fc1",output);
OH_LOG_Print(LOG_APP, LOG_INFO, GLOBAL_RESMGR, TAG, "接下来进行output操作!");
auto dim = output.total();
feature.resize(dim);
for(int i = 0;i < feature.size();i++){
feature[i] = output[i];
}
OH_LOG_Print(LOG_APP, LOG_INFO, GLOBAL_RESMGR, TAG, "接下来进行特征值自然化操作!");
normalize(feature);
return 0; //返回0表示成功处理arcface前向处理
}
在运行至ex.extract("fc1",output);时候报了推理崩溃错误
#00 pc 00000000004feb50 /data/storage/el1/bundle/libs/arm64/libnativerender.so(ncnn::PReLU_arm::forward_inplace_fp16sa(ncnn::Mat&, ncnn::Option const&) const+1240)(144ef6f0e7d26c04722490d478388df16ecf9ed6)
#1 pc 00000000003a2d08 /data/storage/el1/bundle/libs/arm64/libnativerender.so(ncnn::NetPrivate::do_forward_layer(ncnn::Layer const*, std::__n1::vector<ncnn::Mat, std::__n1::allocatorncnn::Mat>&, ncnn::Option const&) const+2844)(144ef6f0e7d26c04722490d478388df16ecf9ed6)
#2 pc 00000000003a204c /data/storage/el1/bundle/libs/arm64/libnativerender.so(ncnn::NetPrivate::forward_layer(int, std::__n1::vector<ncnn::Mat, std::__n1::allocatorncnn::Mat>&, ncnn::Option const&) const+156)(144ef6f0e7d26c04722490d478388df16ecf9ed6)