Skip to content
Draft

Debug #958

Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions shared/api/c_api_processor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "ortx_processor.h"
#include "image_processor.h"
#include <iostream>

#include "c_api_utils.hpp"

Expand Down Expand Up @@ -89,8 +90,10 @@ extError_t ORTX_API_CALL OrtxImagePreProcess(OrtxProcessor* processor, OrtxRawIm
}

auto result_ptr = std::make_unique<TensorResult>();
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<OrtxTensorResult*>(result_ptr.release());
} else {
Expand Down
5 changes: 4 additions & 1 deletion shared/api/image_processor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License.

#include <string_view>
#include <iostream>

#include "nlohmann/json.hpp"
#include "file_sys.h"
Expand Down Expand Up @@ -154,6 +155,7 @@ ImageProcessor::PreProcess(ort_extensions::span<ImageRawData> image_data,
OrtxStatus ImageProcessor::PreProcess(ort_extensions::span<ImageRawData> image_data, TensorResult& r) const {
std::vector<TensorArgs> inputs(image_data.size());
std::vector<TensorPtr> 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];
Expand All @@ -168,7 +170,7 @@ OrtxStatus ImageProcessor::PreProcess(ort_extensions::span<ImageRawData> image_d
if (!status.IsOk()) {
return status;
}

std::cout << "ImageProcessor::PreProcess Finish Push" << std::endl;
// clear the input tensors
input_tensor_objects.clear();

Expand All @@ -182,6 +184,7 @@ OrtxStatus ImageProcessor::PreProcess(ort_extensions::span<ImageRawData> image_d
if (status.IsOk()) {
r.SetTensors(std::move(img_result));
}
std::cout << "ImageProcessor::PreProcess Finish" << std::endl;

return status;
}
Expand Down
Loading