Tengine
Tengine copied to clipboard
run centernet with tengine-lite 1.4 prerun_graph_multithread core dump?
I trained a detection model (centernet, backbone shufflenet), then I change the format :pth->onnex->tmfile. I tried to use tengine-lite(x86 linux) to debug my code. Here is my code:
/* set runtime options */
struct options opt;
opt.num_thread = num_thread;
opt.cluster = TENGINE_CLUSTER_ALL;
opt.precision = TENGINE_MODE_FP32;
opt.affinity = cpu_affinity;
int loop_count = 1;
float mean[3] = {-1.f, -1.f, -1.f};
float scale[3] = {0.f, 0.f, 0.f};
/* inital tengine */
if (init_tengine() != 0){
fprintf(stderr, "Initial tengine failed.\n");
return -1;
}
/* create graph, load tengine model xxx.tmfile */
graph_t graph = create_graph(NULL, "tengine", model_file);
if (NULL == graph){
fprintf(stderr, "Create graph failed.\n");
fprintf(stderr, "errno: %d \n", get_tengine_errno());
return -1;
}else{
printf("create graph success.\n");
}
int img_h = 96;
int img_w = 768;
/* set the shape, data buffer of input_tensor of the graph */
int img_size = img_h * img_w * 3;
int dims[] = {1, 3, img_h, img_w}; // nchw
float* input_data = ( float* )malloc(img_size * sizeof(float));
tensor_t input_tensor = get_graph_input_tensor(graph, 0, 0);
if (input_tensor == NULL){
fprintf(stderr, "Get input tensor failed\n");
return -1;
}else{
printf("Get input tensor success \n");
}
if (set_tensor_shape(input_tensor, dims, 4) < 0){
fprintf(stderr, "Set input tensor shape failed\n");
return -1;
}else{
printf("Set input tensor shape success \n");
}
if (set_tensor_buffer(input_tensor, input_data, img_size * 4) < 0){
fprintf(stderr, "Set input tensor buffer failed\n");
return -1;
}else{
printf("Set input tensor buffer success \n");
}
/* prerun graph, set work options(num_thread, cluster, precision) */
if (prerun_graph_multithread(graph, opt) < 0){
fprintf(stderr, "Prerun multithread graph failed.\n");
return -1;
}else{
printf("Prerun multithread graph success.\n");
}
It was just core_dumped in function prerun_graph_multithread; Here is the break info:
Program terminated with signal 11, Segmentation fault.
#0 0x00007fdf59508906 in get_ir_graph_tensor ()
from /data/hh/Tengine/project/centernet_shufflenet/tengine_lite/lib/libtengine-lite.so
(gdb) bt
#0 0x00007fdf59508906 in get_ir_graph_tensor ()
from /data/hh/Tengine/project/centernet_shufflenet/tengine_lite/lib/libtengine-lite.so
#1 0x00007fdf5950bc83 in generate_sub_graph_io ()
from /data/hh/Tengine/project/centernet_shufflenet/tengine_lite/lib/libtengine-lite.so
#2 0x00007fdf5947d083 in cpu_split_graph ()
from /data/hh/Tengine/project/centernet_shufflenet/tengine_lite/lib/libtengine-lite.so
#3 0x00007fdf5947ba57 in prerun_graph_multithread ()
from /data/hh/Tengine/project/centernet_shufflenet/tengine_lite/lib/libtengine-lite.so
#4 0x00000000004018f2 in centernet_detect (model_file=0x7fff07dbaba4 "models/centernet_shfflenetv2.tmfile",
image_file=0x7fff07dbabc8 "o2_resize.jpg", outputPath=<optimized out>, num_thread=num_thread@entry=4,
cpu_affinity=cpu_affinity@entry=255) at src/main.cpp:73
#5 0x00000000004015c8 in main (argc=<optimized out>, argv=<optimized out>) at src/main.cpp:142
Has this problem been solved? I have a similar problem