问题描述
在Utils::crop_resize(crop_box, ai2d_builder_, ai2d_in_tensor_, ai2d_out_tensor_);创建ai2d_builder的时候报错
OCRReco::OCRReco(const char *kmodel_file, int dict_size, Bbox crop_box,const int debug_mode)
:dict_size(dict_size), AIBase(kmodel_file,"OCRReco", debug_mode)
{
ifstream dict_string(DICT_STRING);
while (!dict_string.eof())
{
string line;
while (getline(dict_string, line))
// 如果行末有回车符 (\r),将其去除
if (!line.empty() && line.back() == '\r') {
line.pop_back();
}
txt_string.push_back(line);
}
model_name_ = "OCRReco";
input_width = input_shapes_[0][3];
input_height = input_shapes_[0][2];
ai2d_out_tensor_ = this -> get_input_tensor(0);
Utils::crop_resize(crop_box, ai2d_builder_, ai2d_in_tensor_, ai2d_out_tensor_);
}
这段代码是我改的ocr类的构建
Bbox num_range = { (int)((r.x2 -r.x1)/2), (int)((r.y2 -r.y1)/2), (int)(r.x2 - r.x1), (int)(r.y2 - r.y1) };
OCRReco ocr(argv[5], dict_len, num_range, atoi(argv[6]));
这里是把数字框的位置和长宽作为类构建的输入
复现步骤
在识别出数字框后报错
flipDetect yolo_post_process took 2.22852 ms
1
2
OCRReco set_input init took 0.043926 ms
OCRReco set_output_init took 3.0[ 4126.694929] flip_version.el[1038]: unhandled signal 11 code 0x1 at 0x0000000000000010 in flip_version.elf[10000+498000]
547 ms
a
b
[ 4126.706886] CPU: 0 PID: 1038 Comm: flip_version.el Tainted: G O 6.6.36 #2
d
A
[ 4126.716408] Hardware name: Canaan CanMV-K230 (DT)
[ 4126.721705] epc : 00000000000a0d02 ra : 00000000000839b4 sp : 0000003fa8373780
[ 4126.728984] gp : 00000000004aded0 tp : 0000003fa8375850 t0 : 0000000002fd2261
[ 4126.736254] t1 : 0000003fa865071c t2 : ffffffffffffffff s0 : 0000000000000000
[ 4126.743529] s1 : 0000003fa8373f18 a0 : 0000003fa8374070 a1 : 0000000000000000
[ 4126.750786] a2 : 0000000000000001 a3 : 0000000000000002 a4 : 4008000000000000
[ 4126.758052] a5 : 0000000000000001 a6 : 0000003fa83751b8 a7 : 0000000000000040
[ 4126.765313] s2 : 0000000000000780 s3 : 0000000000000438 s4 : fffffffffffff000
[ 4126.772564] s5 : 0000003fa87d8260 s6 : 0000000000000008 s7 : 0000003fa83750b0
[ 4126.779832] s8 : 0000000000000000 s9 : 0000000000000001 s10: ffffffffffffffff
[ 4126.787089] s11: 0000003fa87dc308 t3 : 0000003fa841d5e4 t4 : 0000003fa85d1140
[ 4126.794364] t5 : 0000000000000016 t6 : 00000000004c8b90
[ 4126.799704] status: 8000000200004620 badaddr: 0000000000000010 cause: 000000000000000d
[ 4127.208790] vvcam-mipi 9000a800.mipi.0: vvcam_mipi_release
[ 4127.218899] vvcam-isp 90000000.isp.0: vvcam_isp_release:125
Segmentation fault
这里是报错信息,12,ab,AB是我打印的断点位置
void Utils::crop_resize(Bbox &crop_info, std::unique_ptr<ai2d_builder> &builder, runtime_tensor &ai2d_in_tensor, runtime_tensor &ai2d_out_tensor)
{
std::cout<<"A"<<std::endl;
// run ai2d
ai2d_datatype_t ai2d_dtype{ai2d_format::NCHW_FMT, ai2d_format::NCHW_FMT, ai2d_in_tensor.datatype(), ai2d_out_tensor.datatype()};
std::cout<<"B"<<std::endl;
卡在了这个位置
硬件板卡
创乐博v3
软件版本
LinuxSDK