diff --git a/function/object-detection-function/pom.xml b/function/object-detection-function/pom.xml index 17f4abc6..2bcbfe1f 100644 --- a/function/object-detection-function/pom.xml +++ b/function/object-detection-function/pom.xml @@ -20,6 +20,11 @@ tensorflow-common ${project.version} + + com.google.protobuf + protobuf-java + 3.19.6 + @@ -27,8 +32,8 @@ com.github.os72 protoc-jar-maven-plugin - - 3.7.0 + + 3.11.4 generate-sources diff --git a/function/object-detection-function/src/main/java/org/springframework/cloud/fn/object/detection/protos/StringIntLabelMapOuterClass.java b/function/object-detection-function/src/main/java/org/springframework/cloud/fn/object/detection/protos/StringIntLabelMapOuterClass.java index 19a7177d..0bfd368a 100644 --- a/function/object-detection-function/src/main/java/org/springframework/cloud/fn/object/detection/protos/StringIntLabelMapOuterClass.java +++ b/function/object-detection-function/src/main/java/org/springframework/cloud/fn/object/detection/protos/StringIntLabelMapOuterClass.java @@ -26,6 +26,7 @@ public final class StringIntLabelMapOuterClass { * * * optional string name = 1; + * @return Whether the name field is set. */ boolean hasName(); /** @@ -36,6 +37,7 @@ public final class StringIntLabelMapOuterClass { * * * optional string name = 1; + * @return The name. */ java.lang.String getName(); /** @@ -46,6 +48,7 @@ public final class StringIntLabelMapOuterClass { * * * optional string name = 1; + * @return The bytes for name. */ com.google.protobuf.ByteString getNameBytes(); @@ -57,6 +60,7 @@ public final class StringIntLabelMapOuterClass { * * * optional int32 id = 2; + * @return Whether the id field is set. */ boolean hasId(); /** @@ -66,6 +70,7 @@ public final class StringIntLabelMapOuterClass { * * * optional int32 id = 2; + * @return The id. */ int getId(); @@ -75,6 +80,7 @@ public final class StringIntLabelMapOuterClass { * * * optional string display_name = 3; + * @return Whether the displayName field is set. */ boolean hasDisplayName(); /** @@ -83,6 +89,7 @@ public final class StringIntLabelMapOuterClass { * * * optional string display_name = 3; + * @return The displayName. */ java.lang.String getDisplayName(); /** @@ -91,6 +98,7 @@ public final class StringIntLabelMapOuterClass { * * * optional string display_name = 3; + * @return The bytes for displayName. */ com.google.protobuf.ByteString getDisplayNameBytes(); @@ -112,6 +120,13 @@ public final class StringIntLabelMapOuterClass { displayName_ = ""; } + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new StringIntLabelMapItem(); + } + @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { @@ -196,6 +211,7 @@ public final class StringIntLabelMapOuterClass { * * * optional string name = 1; + * @return Whether the name field is set. */ public boolean hasName() { return ((bitField0_ & 0x00000001) != 0); @@ -208,6 +224,7 @@ public final class StringIntLabelMapOuterClass { * * * optional string name = 1; + * @return The name. */ public java.lang.String getName() { java.lang.Object ref = name_; @@ -231,6 +248,7 @@ public final class StringIntLabelMapOuterClass { * * * optional string name = 1; + * @return The bytes for name. */ public com.google.protobuf.ByteString getNameBytes() { @@ -255,6 +273,7 @@ public final class StringIntLabelMapOuterClass { * * * optional int32 id = 2; + * @return Whether the id field is set. */ public boolean hasId() { return ((bitField0_ & 0x00000002) != 0); @@ -266,6 +285,7 @@ public final class StringIntLabelMapOuterClass { * * * optional int32 id = 2; + * @return The id. */ public int getId() { return id_; @@ -279,6 +299,7 @@ public final class StringIntLabelMapOuterClass { * * * optional string display_name = 3; + * @return Whether the displayName field is set. */ public boolean hasDisplayName() { return ((bitField0_ & 0x00000004) != 0); @@ -289,6 +310,7 @@ public final class StringIntLabelMapOuterClass { * * * optional string display_name = 3; + * @return The displayName. */ public java.lang.String getDisplayName() { java.lang.Object ref = displayName_; @@ -310,6 +332,7 @@ public final class StringIntLabelMapOuterClass { * * * optional string display_name = 3; + * @return The bytes for displayName. */ public com.google.protobuf.ByteString getDisplayNameBytes() { @@ -700,6 +723,7 @@ public final class StringIntLabelMapOuterClass { * * * optional string name = 1; + * @return Whether the name field is set. */ public boolean hasName() { return ((bitField0_ & 0x00000001) != 0); @@ -712,6 +736,7 @@ public final class StringIntLabelMapOuterClass { * * * optional string name = 1; + * @return The name. */ public java.lang.String getName() { java.lang.Object ref = name_; @@ -735,6 +760,7 @@ public final class StringIntLabelMapOuterClass { * * * optional string name = 1; + * @return The bytes for name. */ public com.google.protobuf.ByteString getNameBytes() { @@ -757,6 +783,8 @@ public final class StringIntLabelMapOuterClass { * * * optional string name = 1; + * @param value The name to set. + * @return This builder for chaining. */ public Builder setName( java.lang.String value) { @@ -776,6 +804,7 @@ public final class StringIntLabelMapOuterClass { * * * optional string name = 1; + * @return This builder for chaining. */ public Builder clearName() { bitField0_ = (bitField0_ & ~0x00000001); @@ -791,6 +820,8 @@ public final class StringIntLabelMapOuterClass { * * * optional string name = 1; + * @param value The bytes for name to set. + * @return This builder for chaining. */ public Builder setNameBytes( com.google.protobuf.ByteString value) { @@ -811,6 +842,7 @@ public final class StringIntLabelMapOuterClass { * * * optional int32 id = 2; + * @return Whether the id field is set. */ public boolean hasId() { return ((bitField0_ & 0x00000002) != 0); @@ -822,6 +854,7 @@ public final class StringIntLabelMapOuterClass { * * * optional int32 id = 2; + * @return The id. */ public int getId() { return id_; @@ -833,6 +866,8 @@ public final class StringIntLabelMapOuterClass { * * * optional int32 id = 2; + * @param value The id to set. + * @return This builder for chaining. */ public Builder setId(int value) { bitField0_ |= 0x00000002; @@ -847,6 +882,7 @@ public final class StringIntLabelMapOuterClass { * * * optional int32 id = 2; + * @return This builder for chaining. */ public Builder clearId() { bitField0_ = (bitField0_ & ~0x00000002); @@ -862,6 +898,7 @@ public final class StringIntLabelMapOuterClass { * * * optional string display_name = 3; + * @return Whether the displayName field is set. */ public boolean hasDisplayName() { return ((bitField0_ & 0x00000004) != 0); @@ -872,6 +909,7 @@ public final class StringIntLabelMapOuterClass { * * * optional string display_name = 3; + * @return The displayName. */ public java.lang.String getDisplayName() { java.lang.Object ref = displayName_; @@ -893,6 +931,7 @@ public final class StringIntLabelMapOuterClass { * * * optional string display_name = 3; + * @return The bytes for displayName. */ public com.google.protobuf.ByteString getDisplayNameBytes() { @@ -913,6 +952,8 @@ public final class StringIntLabelMapOuterClass { * * * optional string display_name = 3; + * @param value The displayName to set. + * @return This builder for chaining. */ public Builder setDisplayName( java.lang.String value) { @@ -930,6 +971,7 @@ public final class StringIntLabelMapOuterClass { * * * optional string display_name = 3; + * @return This builder for chaining. */ public Builder clearDisplayName() { bitField0_ = (bitField0_ & ~0x00000004); @@ -943,6 +985,8 @@ public final class StringIntLabelMapOuterClass { * * * optional string display_name = 3; + * @param value The bytes for displayName to set. + * @return This builder for chaining. */ public Builder setDisplayNameBytes( com.google.protobuf.ByteString value) { @@ -1051,6 +1095,13 @@ public final class StringIntLabelMapOuterClass { item_ = java.util.Collections.emptyList(); } + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new StringIntLabelMap(); + } + @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { @@ -1815,18 +1866,10 @@ public final class StringIntLabelMapOuterClass { "ingframework.cloud.fn.object.detection.p" + "rotos.StringIntLabelMapItem" }; - com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = - new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { - public com.google.protobuf.ExtensionRegistry assignDescriptors( - com.google.protobuf.Descriptors.FileDescriptor root) { - descriptor = root; - return null; - } - }; - com.google.protobuf.Descriptors.FileDescriptor + descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { - }, assigner); + }); internal_static_org_springframework_cloud_fn_object_detection_protos_StringIntLabelMapItem_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_org_springframework_cloud_fn_object_detection_protos_StringIntLabelMapItem_fieldAccessorTable = new diff --git a/function/object-detection-function/src/test/java/org/springframework/cloud/fn/object/detection/examples/ExampleInstanceSegmentation.java b/function/object-detection-function/src/test/java/org/springframework/cloud/fn/object/detection/examples/ExampleInstanceSegmentation.java index 58ecf276..e1c6870c 100644 --- a/function/object-detection-function/src/test/java/org/springframework/cloud/fn/object/detection/examples/ExampleInstanceSegmentation.java +++ b/function/object-detection-function/src/test/java/org/springframework/cloud/fn/object/detection/examples/ExampleInstanceSegmentation.java @@ -16,6 +16,7 @@ package org.springframework.cloud.fn.object.detection.examples; +import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.List; @@ -84,6 +85,9 @@ public class ExampleInstanceSegmentation { // Draw the detected object metadata on top of the original image and store the result byte[] annotatedImage = new ObjectDetectionImageAugmenter(INSTANCE_SEGMENTATION).apply(image, detectedObjects); - IOUtils.write(annotatedImage, new FileOutputStream("./object-detection-function/target/object-detection-segmentation-augmented.jpg")); + File projectDir = new File("functions/function/object-detection-function"); + File output = new File(projectDir,"target/object-detection-segmentation-augmented.jpg"); + IOUtils.write(annotatedImage, new FileOutputStream(output)); + System.out.println("Created:" +output.getPath()); } }