- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Environment: ubuntu 16.04 (I installed using apt-get)
The following code has segmentation fault only if `TF_NumDims` is used in a dummy function. dummy function is not used anywhere in the code.
The code is seg faulted at line `ExecutableNetwork executable_network = ie.LoadNetwork(network, device_name, openvino_config);`
include <iostream> #include <inference_engine.hpp> #include <opencv2/opencv.hpp> #include <tensorflow/c/c_api.h> int64_t dummy (TF_Tensor* tensor) { return TF_NumDims(tensor); // with this line, segmentation fault at LoadNetwork // return 0; // with this line, there is no segmentationf fault } int main(int argc, char** argv) { std::cout << "Hello world!\n"; using namespace InferenceEngine; try { const std::string device_name = "CPU"; const std::string input_model = "./ml_runtime-test-data/resnet_v1_50.xml"; const std::string input_param = "./ml_runtime-test-data/resnet_v1_50.bin"; Core ie; CNNNetwork network = ie.ReadNetwork(input_model, input_param); network.setBatchSize(1); InputInfo::Ptr input_info = network.getInputsInfo().begin()->second; std::string input_name = network.getInputsInfo().begin()->first; input_info->getPreProcess().setResizeAlgorithm(RESIZE_BILINEAR); input_info->setLayout(Layout::NHWC); input_info->setPrecision(Precision::U8); DataPtr output_info = network.getOutputsInfo().begin()->second; std::string output_name = network.getOutputsInfo().begin()->first; output_info->setPrecision(Precision::FP32); const std::map< std::string, std::string > openvino_config; ExecutableNetwork executable_network = ie.LoadNetwork(network, device_name, openvino_config); InferRequest infer_request = executable_network.CreateInferRequest(); std::cout << input_name << std::endl; std::cout << output_name << std::endl; cv::Mat mat = cv::imread("./ml_runtime-test-data/golden-retriever-puppy.jpg", cv::IMREAD_COLOR); size_t channels = mat.channels(); size_t height = mat.size().height; size_t width = mat.size().width; size_t strideH = mat.step.buf[0]; size_t strideW = mat.step.buf[1]; InferenceEngine::TensorDesc tDesc(InferenceEngine::Precision::U8, {1, channels, height, width}, InferenceEngine::Layout::NHWC); Blob::Ptr imgBlob = InferenceEngine::make_shared_blob<uint8_t>(tDesc, mat.data); infer_request.SetBlob(input_name, imgBlob); // infer_request accepts input blob of any size infer_request.Infer(); Blob::Ptr output = infer_request.GetBlob(output_name); InferenceEngine::TBlob<float32_t>& tblob = dynamic_cast<InferenceEngine::TBlob<float32_t>&>(*output); InferenceEngine::SizeVector dims = tblob.getTensorDesc().getDims(); size_t input_rank = dims.size(); size_t batchSize = dims[0]; std::vector<unsigned> indexes(tblob.size()); float32_t* data = tblob.data(); std::iota(std::begin(indexes), std::end(indexes), 0); std::partial_sort(std::begin(indexes), std::begin(indexes) + 5, std::end(indexes), [&data](unsigned l, unsigned r) { return data> data ; }); std::cout << indexes.at(0) << std::endl; } catch (const std::exception & ex) { std::cerr << ex.what() << std::endl; } return 0; }
Here is back trace.
[Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Hello world! [New Thread 0x7fffe65a5700 (LWP 13802)] [New Thread 0x7fffe5da4700 (LWP 13803)] Thread 2 "test" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fffe65a5700 (LWP 13802)] 0x00007fffe913e68c in ?? () from /opt/intel/openvino_2020.1.023/deployment_tools/inference_engine/lib/intel64/libMKLDNNPlugin.so (gdb) bt #0 0x00007fffe913e68c in ?? () from /opt/intel/openvino_2020.1.023/deployment_tools/inference_engine/lib/intel64/libMKLDNNPlugin.so #1 0x00007fffef136cf2 in ?? () from /opt/intel/openvino_2020.1.023/deployment_tools/inference_engine/lib/intel64/libinference_engine.so #2 0x00007fffef1362d9 in ?? () from /opt/intel/openvino_2020.1.023/deployment_tools/inference_engine/lib/intel64/libinference_engine.so #3 0x00007fffede97a99 in __pthread_once_slow (once_control=0x8464098, init_routine=0x7ffff7b07750 <__once_proxy>) at pthread_once.c:116 #4 0x00007fffef13730a in ?? () from /opt/intel/openvino_2020.1.023/deployment_tools/inference_engine/lib/intel64/libinference_engine.so #5 0x00007fffef13650e in ?? () from /opt/intel/openvino_2020.1.023/deployment_tools/inference_engine/lib/intel64/libinference_engine.so #6 0x00007ffff7b088e0 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #7 0x00007fffede906ba in start_thread (arg=0x7fffe65a5700) at pthread_create.c:333 #8 0x00007fffedbc641d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am able to repeat the above steps in a different machine and got the same segmentation fault.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page