product_search.proto 4.8 KB

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