Internal update

PiperOrigin-RevId: 563553758
This commit is contained in:
MediaPipe Team 2023-09-07 14:56:49 -07:00 committed by Copybara-Service
parent 80b762a281
commit 7549677408

View File

@ -44,7 +44,6 @@ import com.google.mediapipe.tasks.vision.imagegenerator.proto.ImageGeneratorGrap
import com.google.mediapipe.tasks.vision.imagesegmenter.ImageSegmenter.ImageSegmenterOptions; import com.google.mediapipe.tasks.vision.imagesegmenter.ImageSegmenter.ImageSegmenterOptions;
import com.google.mediapipe.tasks.vision.imagesegmenter.proto.ImageSegmenterGraphOptionsProto.ImageSegmenterGraphOptions; import com.google.mediapipe.tasks.vision.imagesegmenter.proto.ImageSegmenterGraphOptionsProto.ImageSegmenterGraphOptions;
import com.google.protobuf.Any; import com.google.protobuf.Any;
import com.google.protobuf.ExtensionRegistryLite;
import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.InvalidProtocolBufferException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -566,14 +565,13 @@ public final class ImageGenerator extends BaseVisionTaskApi {
/** Converts an {@link ImageGeneratorOptions} to a {@link Any} protobuf message. */ /** Converts an {@link ImageGeneratorOptions} to a {@link Any} protobuf message. */
@Override @Override
@SuppressWarnings("ProtoParseWithRegistry")
public Any convertToAnyProto() { public Any convertToAnyProto() {
ImageGeneratorGraphOptionsProto.ImageGeneratorGraphOptions.Builder taskOptionsBuilder = ImageGeneratorGraphOptionsProto.ImageGeneratorGraphOptions.Builder taskOptionsBuilder =
ImageGeneratorGraphOptionsProto.ImageGeneratorGraphOptions.newBuilder(); ImageGeneratorGraphOptionsProto.ImageGeneratorGraphOptions.newBuilder();
if (conditionOptions != null && conditionOptions.isPresent()) { if (conditionOptions != null && conditionOptions.isPresent()) {
try { try {
taskOptionsBuilder.mergeFrom( taskOptionsBuilder.mergeFrom(conditionOptions.get().convertToAnyProto().getValue());
conditionOptions.get().convertToAnyProto().getValue(),
ExtensionRegistryLite.getGeneratedRegistry());
} catch (InvalidProtocolBufferException e) { } catch (InvalidProtocolBufferException e) {
Log.e(TAG, "Error converting ConditionOptions to proto. " + e.getMessage()); Log.e(TAG, "Error converting ConditionOptions to proto. " + e.getMessage());
e.printStackTrace(); e.printStackTrace();