Fix AMD and OpenVINO
This commit is contained in:
@@ -218,6 +218,12 @@ namespace ANSCENTER
|
||||
std::min(6, static_cast<int>(std::thread::hardware_concurrency())));
|
||||
sessionOptions.SetGraphOptimizationLevel(GraphOptimizationLevel::ORT_ENABLE_ALL);
|
||||
|
||||
// DirectML REQUIRES these two settings per ORT documentation
|
||||
if (ep.type == ANSCENTER::EngineType::AMD_GPU) {
|
||||
sessionOptions.DisableMemPattern();
|
||||
sessionOptions.SetExecutionMode(ExecutionMode::ORT_SEQUENTIAL);
|
||||
}
|
||||
|
||||
// ── Log available providers ─────────────────────────────────────────
|
||||
std::vector<std::string> availableProviders = Ort::GetAvailableProviders();
|
||||
std::cout << "Available Execution Providers:" << std::endl;
|
||||
@@ -519,7 +525,7 @@ namespace ANSCENTER
|
||||
{
|
||||
try {
|
||||
// Get raw output pointer (NO COPY!)
|
||||
const float* rawOutput = outputTensors[0].GetTensorData<float>();
|
||||
const float* rawOutput = outputTensors[0].GetTensorMutableData<float>();
|
||||
std::vector<int64_t> outputShape = outputTensors[0].GetTensorTypeAndShapeInfo().GetShape();
|
||||
|
||||
const int numClasses = static_cast<int>(outputShape[2]) - 5;
|
||||
@@ -647,11 +653,11 @@ namespace ANSCENTER
|
||||
}
|
||||
return result;
|
||||
}
|
||||
std::vector<Object> YOLOOD::postprocessv11(const cv::Size& originalImageSize,const cv::Size& resizedImageShape,const std::vector<Ort::Value>& outputTensors,float confThreshold,float iouThreshold)
|
||||
std::vector<Object> YOLOOD::postprocessv11(const cv::Size& originalImageSize,const cv::Size& resizedImageShape,std::vector<Ort::Value>& outputTensors,float confThreshold,float iouThreshold)
|
||||
{
|
||||
try {
|
||||
// Get raw output
|
||||
const float* rawOutput = outputTensors[0].GetTensorData<float>();
|
||||
const float* rawOutput = outputTensors[0].GetTensorMutableData<float>();
|
||||
const std::vector<int64_t> outputShape = outputTensors[0].GetTensorTypeAndShapeInfo().GetShape();
|
||||
|
||||
const size_t numFeatures = outputShape[1];
|
||||
@@ -1448,7 +1454,7 @@ namespace ANSCENTER
|
||||
);
|
||||
|
||||
// Parse output
|
||||
const float* rawOutput = outputTensors[0].GetTensorData<float>();
|
||||
const float* rawOutput = outputTensors[0].GetTensorMutableData<float>();
|
||||
const std::vector<int64_t> outputShape = outputTensors[0].GetTensorTypeAndShapeInfo().GetShape();
|
||||
|
||||
const int dimensions = static_cast<int>(outputShape[1]); // 4 + num_classes
|
||||
|
||||
Reference in New Issue
Block a user