Skip to content

Runtime Error and Segmentation Fault during Video Inference with SAM2 Model #23

Description

@georgebaknis
  1. Export ONNX Models:

  2. Setup OrtInference:

    • Cloned OrtInference 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:
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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions