diff --git a/shared/api/c_api_processor.cc b/shared/api/c_api_processor.cc index 6340a78dc..de8f5f196 100644 --- a/shared/api/c_api_processor.cc +++ b/shared/api/c_api_processor.cc @@ -3,6 +3,7 @@ #include "ortx_processor.h" #include "image_processor.h" +#include #include "c_api_utils.hpp" @@ -89,8 +90,10 @@ extError_t ORTX_API_CALL OrtxImagePreProcess(OrtxProcessor* processor, OrtxRawIm } auto result_ptr = std::make_unique(); + std::cout << "OrtxImagePreProcess: num_images=" << images_ptr->num_images << std::endl; status = processor_ptr->PreProcess(ort_extensions::span(images_ptr->images.get(), images_ptr->num_images), *result_ptr); + std::cout << "OrtxImagePreProcess: Finish PreProcess" << std::endl; if (status.IsOk()) { *result = static_cast(result_ptr.release()); } else { diff --git a/shared/api/image_processor.cc b/shared/api/image_processor.cc index c7eecfd19..aff7bece3 100644 --- a/shared/api/image_processor.cc +++ b/shared/api/image_processor.cc @@ -2,6 +2,7 @@ // Licensed under the MIT License. #include +#include #include "nlohmann/json.hpp" #include "file_sys.h" @@ -154,21 +155,26 @@ ImageProcessor::PreProcess(ort_extensions::span image_data, OrtxStatus ImageProcessor::PreProcess(ort_extensions::span image_data, TensorResult& r) const { std::vector inputs(image_data.size()); std::vector input_tensor_objects(image_data.size()); + std::cout << "ImageProcessor::PreProcess image_data size=" << image_data.size() << std::endl; for (size_t i = 0; i < image_data.size(); ++i) { auto& ts_input = inputs[i]; ImageRawData& image = image_data[i]; std::vector shape = {static_cast(image.size())}; + for (int n : shape) { + std::cout << n << ","; + } + std::cout << std::endl; input_tensor_objects[i] = std::make_unique>(shape, image.data()); ts_input.push_back(input_tensor_objects[i].get()); } - + std::cout << "ImageProcessor::PreProcess Finish loop" << std::endl; std::vector outputs; OrtxRunner runner(op_plan_); auto status = runner.Run(inputs, outputs); if (!status.IsOk()) { return status; } - + std::cout << "ImageProcessor::PreProcess Finish Push" << std::endl; // clear the input tensors input_tensor_objects.clear(); @@ -182,6 +188,7 @@ OrtxStatus ImageProcessor::PreProcess(ort_extensions::span image_d if (status.IsOk()) { r.SetTensors(std::move(img_result)); } + std::cout << "ImageProcessor::PreProcess Finish" << std::endl; return status; }