product_search.proto 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. // Copyright 2022 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.cloud.vision.v1p3beta1;
  16. import "google/api/resource.proto";
  17. import "google/cloud/vision/v1p3beta1/geometry.proto";
  18. import "google/cloud/vision/v1p3beta1/product_search_service.proto";
  19. import "google/protobuf/timestamp.proto";
  20. option cc_enable_arenas = true;
  21. option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1p3beta1;vision";
  22. option java_multiple_files = true;
  23. option java_outer_classname = "ProductSearchProto";
  24. option java_package = "com.google.cloud.vision.v1p3beta1";
  25. option objc_class_prefix = "GCVN";
  26. // Parameters for a product search request.
  27. message ProductSearchParams {
  28. // The bounding polygon around the area of interest in the image.
  29. // If it is not specified, system discretion will be applied.
  30. BoundingPoly bounding_poly = 9;
  31. // The resource name of a [ProductSet][google.cloud.vision.v1p3beta1.ProductSet] to be searched for similar images.
  32. //
  33. // Format is:
  34. // `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`.
  35. string product_set = 6 [(google.api.resource_reference) = {
  36. type: "vision.googleapis.com/ProductSet"
  37. }];
  38. // The list of product categories to search in. Currently, we only consider
  39. // the first category, and either "homegoods-v2", "apparel-v2", "toys-v2",
  40. // "packagedgoods-v1", or "general-v1" should be specified. The legacy
  41. // categories "homegoods", "apparel", and "toys" are still supported but will
  42. // be deprecated. For new products, please use "homegoods-v2", "apparel-v2",
  43. // or "toys-v2" for better product search accuracy. It is recommended to
  44. // migrate existing products to these categories as well.
  45. repeated string product_categories = 7;
  46. // The filtering expression. This can be used to restrict search results based
  47. // on Product labels. We currently support an AND of OR of key-value
  48. // expressions, where each expression within an OR must have the same key. An
  49. // '=' should be used to connect the key and value.
  50. //
  51. // For example, "(color = red OR color = blue) AND brand = Google" is
  52. // acceptable, but "(color = red OR brand = Google)" is not acceptable.
  53. // "color: red" is not acceptable because it uses a ':' instead of an '='.
  54. string filter = 8;
  55. }
  56. // Results for a product search request.
  57. message ProductSearchResults {
  58. // Information about a product.
  59. message Result {
  60. // The Product.
  61. Product product = 1;
  62. // A confidence level on the match, ranging from 0 (no confidence) to
  63. // 1 (full confidence).
  64. float score = 2;
  65. // The resource name of the image from the product that is the closest match
  66. // to the query.
  67. string image = 3;
  68. }
  69. // Prediction for what the object in the bounding box is.
  70. message ObjectAnnotation {
  71. // Object ID that should align with EntityAnnotation mid.
  72. string mid = 1;
  73. // The BCP-47 language code, such as "en-US" or "sr-Latn". For more
  74. // information, see
  75. // http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
  76. string language_code = 2;
  77. // Object name, expressed in its `language_code` language.
  78. string name = 3;
  79. // Score of the result. Range [0, 1].
  80. float score = 4;
  81. }
  82. // Information about the products similar to a single product in a query
  83. // image.
  84. message GroupedResult {
  85. // The bounding polygon around the product detected in the query image.
  86. BoundingPoly bounding_poly = 1;
  87. // List of results, one for each product match.
  88. repeated Result results = 2;
  89. // List of generic predictions for the object in the bounding box.
  90. repeated ObjectAnnotation object_annotations = 3;
  91. }
  92. // Timestamp of the index which provided these results. Products added to the
  93. // product set and products removed from the product set after this time are
  94. // not reflected in the current results.
  95. google.protobuf.Timestamp index_time = 2;
  96. // List of results, one for each product match.
  97. repeated Result results = 5;
  98. // List of results grouped by products detected in the query image. Each entry
  99. // corresponds to one bounding polygon in the query image, and contains the
  100. // matching products specific to that region. There may be duplicate product
  101. // matches in the union of all the per-product results.
  102. repeated GroupedResult product_grouped_results = 6;
  103. }