Ignore fetching face stylizer model when the graph doesn't output stylized face images.

PiperOrigin-RevId: 528504312
This commit is contained in:
Jiuqiang Tang 2023-05-01 10:16:20 -07:00 committed by Copybara-Service
parent ad4ae6559b
commit b9a9da5de5

View File

@ -130,9 +130,11 @@ absl::Status SetSubTaskBaseOptions(const ModelAssetBundleResources& resources,
face_landmarks_detector_graph_options->mutable_base_options() face_landmarks_detector_graph_options->mutable_base_options()
->set_use_stream_mode(options->base_options().use_stream_mode()); ->set_use_stream_mode(options->base_options().use_stream_mode());
ASSIGN_OR_RETURN(const auto face_stylizer_file, if (face_stylizer_external_file) {
resources.GetFile(kFaceStylizerTFLiteName)); ASSIGN_OR_RETURN(const auto face_stylizer_file,
SetExternalFile(face_stylizer_file, face_stylizer_external_file, is_copy); resources.GetFile(kFaceStylizerTFLiteName));
SetExternalFile(face_stylizer_file, face_stylizer_external_file, is_copy);
}
return absl::OkStatus(); return absl::OkStatus();
} }
@ -234,7 +236,7 @@ class FaceStylizerGraph : public core::ModelTaskGraph {
MP_RETURN_IF_ERROR(SetSubTaskBaseOptions( MP_RETURN_IF_ERROR(SetSubTaskBaseOptions(
*model_asset_bundle_resources, *model_asset_bundle_resources,
sc->MutableOptions<FaceStylizerGraphOptions>(), sc->MutableOptions<FaceStylizerGraphOptions>(),
face_stylizer_external_file.get(), output_stylized ? face_stylizer_external_file.get() : nullptr,
!sc->Service(::mediapipe::tasks::core::kModelResourcesCacheService) !sc->Service(::mediapipe::tasks::core::kModelResourcesCacheService)
.IsAvailable())); .IsAvailable()));
Graph graph; Graph graph;