Add an option to set image preprocessing backend as gpu.

PiperOrigin-RevId: 483888202
This commit is contained in:
MediaPipe Team
2022-10-26 00:46:19 -07:00
committed by Copybara-Service
parent ae5b09e2b2
commit 254f786624
9 changed files with 43 additions and 10 deletions
@@ -243,8 +243,10 @@ class ImageSegmenterGraph : public core::ModelTaskGraph {
// stream.
auto& preprocessing =
graph.AddNode("mediapipe.tasks.components.ImagePreprocessingSubgraph");
bool use_gpu = components::DetermineImagePreprocessingGpuBackend(
task_options.base_options().acceleration());
MP_RETURN_IF_ERROR(ConfigureImagePreprocessing(
model_resources,
model_resources, use_gpu,
&preprocessing
.GetOptions<tasks::components::ImagePreprocessingOptions>()));
image_in >> preprocessing.In(kImageTag);