1. **Export ONNX Models:** * Cloned [[SAM2Export](https://github.com/Aimol-l/SAM2Export/tree/main)](https://github.com/Aimol-l/SAM2Export/tree/main) repository. * Ran the `export_onnx.py` script to generate the four ONNX files. 2. **Setup [OrtInference](https://github.com/Aimol-l/OrtInference/tree/main):** * Cloned [OrtInference](https://github.com/Aimol-l/OrtInference/tree/main) repository. * Installed all required dependencies according to the provided instructions. 3. **Encountered Issue when running `./main`:** Initially faced the following error: ``` terminate called after throwing an instance of 'Ort::Exception' what(): not enough space: expected 8388608, got 16 ``` #### Temporary Fix (Uncertain correctness): * Commented out the following lines in `SAM2.cpp` within the function `img_decoder_infer`: ```cpp input_tensor.push_back(Ort::Value::CreateTensor<int64>(memory_info, frame_size.data(), frame_size.size(), this->img_decoder_input_nodes[2].dim.data(), this->img_decoder_input_nodes[2].dim.size())); ``` * After commenting these lines, the program runs, but then another issue occurs. #### Persistent Issue (Segmentation Fault): * Running inference on video leads to a segmentation fault. * The frame number at which the segmentation fault occurs varies each run, indicating potential memory handling or concurrency issues. #### Environment: * CUDA: 12.9 * cuDNN: 9.10.2 * GPU: NVIDIA RTX 5090 #### Questions: * Is commenting out the mentioned lines the correct approach? * Could the segmentation fault be related to incorrect tensor shapes or memory management? * How can I ensure stable inference over video without encountering segmentation faults?
Export ONNX Models:
export_onnx.pyscript to generate the four ONNX files.Setup OrtInference:
Encountered Issue when running
./main:Initially faced the following error:
Temporary Fix (Uncertain correctness):
SAM2.cppwithin the functionimg_decoder_infer:input_tensor.push_back(Ort::Value::CreateTensor<int64>(memory_info, frame_size.data(), frame_size.size(), this->img_decoder_input_nodes[2].dim.data(), this->img_decoder_input_nodes[2].dim.size()));Persistent Issue (Segmentation Fault):
Environment:
Questions: