Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ void Utils::PostProcess(std::vector<Ort::Value>& output_tensors, const cv::Mat&
if (output_tensors.empty())
{
CONSOLE_BRIDGE_logError("[SAM]: Decoder returned no outputs.");
// Push empty mask to preserve index alignment with boxes (one mask slot per box).
result.masks.push_back(cv::Mat());
return;
}

Expand All @@ -148,6 +150,8 @@ void Utils::PostProcess(std::vector<Ort::Value>& output_tensors, const cv::Mat&
if (masksIdx < 0)
{
CONSOLE_BRIDGE_logError("[SAM]: No 4D mask tensor found in decoder outputs.");
// Push empty mask to preserve index alignment with boxes (one mask slot per box).
result.masks.push_back(cv::Mat());
return;
}

Expand Down Expand Up @@ -244,5 +248,7 @@ void Utils::PostProcess(std::vector<Ort::Value>& output_tensors, const cv::Mat&
else
{
CONSOLE_BRIDGE_logError("[SAM]: Unexpected mask tensor shape.");
// Push empty mask to preserve index alignment with boxes (one mask slot per box).
result.masks.push_back(cv::Mat());
}
}