1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484
|
<html><body>
<style>
body, h1, h2, h3, div, span, p, pre, a {
margin: 0;
padding: 0;
border: 0;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
font-family: inherit;
vertical-align: baseline;
}
body {
font-size: 13px;
padding: 1em;
}
h1 {
font-size: 26px;
margin-bottom: 1em;
}
h2 {
font-size: 24px;
margin-bottom: 1em;
}
h3 {
font-size: 20px;
margin-bottom: 1em;
margin-top: 1em;
}
pre, code {
line-height: 1.5;
font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
}
pre {
margin-top: 0.5em;
}
h1, h2, h3, p {
font-family: Arial, sans serif;
}
h1, h2, h3 {
border-bottom: solid #CCC 1px;
}
.toc_element {
margin-top: 0.5em;
}
.firstline {
margin-left: 2 em;
}
.method {
margin-top: 1em;
border: solid 1px #CCC;
padding: 1em;
background: #EEE;
}
.details {
font-weight: bold;
font-size: 14px;
}
</style>
<h1><a href="vision_v1p2beta1.html">Cloud Vision API</a> . <a href="vision_v1p2beta1.files.html">files</a></h1>
<h2>Instance Methods</h2>
<p class="toc_element">
<code><a href="#annotate">annotate(body, x__xgafv=None)</a></code></p>
<p class="firstline">Service that performs image detection and annotation for a batch of files.</p>
<p class="toc_element">
<code><a href="#asyncBatchAnnotate">asyncBatchAnnotate(body, x__xgafv=None)</a></code></p>
<p class="firstline">Run asynchronous image detection and annotation for a list of generic</p>
<h3>Method Details</h3>
<div class="method">
<code class="details" id="annotate">annotate(body, x__xgafv=None)</code>
<pre>Service that performs image detection and annotation for a batch of files.
Now only "application/pdf", "image/tiff" and "image/gif" are supported.
This service will extract at most 5 (customers can specify which 5 in
AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each
file provided and perform detection and annotation for each image
extracted.
Args:
body: object, The request body. (required)
The object takes the form of:
{ # A list of requests to annotate files using the BatchAnnotateFiles API.
"requests": [ # The list of file annotation requests. Right now we support only one
# AnnotateFileRequest in BatchAnnotateFilesRequest.
{ # A request to annotate one single file, e.g. a PDF, TIFF or GIF file.
"imageContext": { # Image context and/or feature-specific parameters. # Additional context that may accompany the image(s) in the file.
"latLongRect": { # Rectangle determined by min and max `LatLng` pairs. # Not used.
"minLatLng": { # An object representing a latitude/longitude pair. This is expressed as a pair # Min lat/long pair.
# of doubles representing degrees latitude and degrees longitude. Unless
# specified otherwise, this must conform to the
# <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
# standard</a>. Values must be within normalized ranges.
"latitude": 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0].
"longitude": 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0].
},
"maxLatLng": { # An object representing a latitude/longitude pair. This is expressed as a pair # Max lat/long pair.
# of doubles representing degrees latitude and degrees longitude. Unless
# specified otherwise, this must conform to the
# <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
# standard</a>. Values must be within normalized ranges.
"latitude": 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0].
"longitude": 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0].
},
},
"languageHints": [ # List of languages to use for TEXT_DETECTION. In most cases, an empty value
# yields the best results since it enables automatic language detection. For
# languages based on the Latin alphabet, setting `language_hints` is not
# needed. In rare cases, when the language of the text in the image is known,
# setting a hint will help get better results (although it will be a
# significant hindrance if the hint is wrong). Text detection returns an
# error if one or more of the specified languages is not one of the
# [supported languages](/vision/docs/languages).
"A String",
],
"productSearchParams": { # Parameters for a product search request. # Parameters for product search.
"productCategories": [ # The list of product categories to search in. Currently, we only consider
# the first category, and either "homegoods-v2", "apparel-v2", or "toys-v2"
# should be specified. The legacy categories "homegoods", "apparel", and
# "toys" are still supported but will be deprecated. For new products, please
# use "homegoods-v2", "apparel-v2", or "toys-v2" for better product search
# accuracy. It is recommended to migrate existing products to these
# categories as well.
"A String",
],
"filter": "A String", # The filtering expression. This can be used to restrict search results based
# on Product labels. We currently support an AND of OR of key-value
# expressions, where each expression within an OR must have the same key. An
# '=' should be used to connect the key and value.
#
# For example, "(color = red OR color = blue) AND brand = Google" is
# acceptable, but "(color = red OR brand = Google)" is not acceptable.
# "color: red" is not acceptable because it uses a ':' instead of an '='.
"productSet": "A String", # The resource name of a ProductSet to be searched for similar images.
#
# Format is:
# `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`.
"boundingPoly": { # A bounding polygon for the detected image annotation. # The bounding polygon around the area of interest in the image.
# Optional. If it is not specified, system discretion will be applied.
"normalizedVertices": [ # The bounding polygon normalized vertices.
{ # A vertex represents a 2D point in the image.
# NOTE: the normalized vertex coordinates are relative to the original image
# and range from 0 to 1.
"y": 3.14, # Y coordinate.
"x": 3.14, # X coordinate.
},
],
"vertices": [ # The bounding polygon vertices.
{ # A vertex represents a 2D point in the image.
# NOTE: the vertex coordinates are in the same scale as the original image.
"y": 42, # Y coordinate.
"x": 42, # X coordinate.
},
],
},
},
"cropHintsParams": { # Parameters for crop hints annotation request. # Parameters for crop hints annotation request.
"aspectRatios": [ # Aspect ratios in floats, representing the ratio of the width to the height
# of the image. For example, if the desired aspect ratio is 4/3, the
# corresponding float value should be 1.33333. If not specified, the
# best possible crop is returned. The number of provided aspect ratios is
# limited to a maximum of 16; any aspect ratios provided after the 16th are
# ignored.
3.14,
],
},
"webDetectionParams": { # Parameters for web detection request. # Parameters for web detection.
"includeGeoResults": True or False, # Whether to include results derived from the geo information in the image.
},
},
"pages": [ # Pages of the file to perform image annotation.
#
# Pages starts from 1, we assume the first page of the file is page 1.
# At most 5 pages are supported per request. Pages can be negative.
#
# Page 1 means the first page.
# Page 2 means the second page.
# Page -1 means the last page.
# Page -2 means the second to the last page.
#
# If the file is GIF instead of PDF or TIFF, page refers to GIF frames.
#
# If this field is empty, by default the service performs image annotation
# for the first 5 pages of the file.
42,
],
"inputConfig": { # The desired input location and metadata. # Required. Information about the input file.
"mimeType": "A String", # The type of the file. Currently only "application/pdf", "image/tiff" and
# "image/gif" are supported. Wildcards are not supported.
"content": "A String", # File content, represented as a stream of bytes.
# Note: As with all `bytes` fields, protobuffers use a pure binary
# representation, whereas JSON representations use base64.
#
# Currently, this field only works for BatchAnnotateFiles requests. It does
# not work for AsyncBatchAnnotateFiles requests.
"gcsSource": { # The Google Cloud Storage location where the input will be read from. # The Google Cloud Storage location to read the input from.
"uri": "A String", # Google Cloud Storage URI for the input file. This must only be a
# Google Cloud Storage object. Wildcards are not currently supported.
},
},
"features": [ # Required. Requested features.
{ # The type of Google Cloud Vision API detection to perform, and the maximum
# number of results to return for that type. Multiple `Feature` objects can
# be specified in the `features` list.
"model": "A String", # Model to use for the feature.
# Supported values: "builtin/stable" (the default if unset) and
# "builtin/latest".
"type": "A String", # The feature type.
"maxResults": 42, # Maximum number of results of this type. Does not apply to
# `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`.
},
],
},
],
}
x__xgafv: string, V1 error format.
Allowed values
1 - v1 error format
2 - v2 error format
Returns:
An object of the form:
{ # A list of file annotation responses.
"responses": [ # The list of file annotation responses, each response corresponding to each
# AnnotateFileRequest in BatchAnnotateFilesRequest.
{ # Response to a single file annotation request. A file may contain one or more
# images, which individually have their own responses.
"totalPages": 42, # This field gives the total number of pages in the file.
"responses": [ # Individual responses to images found within the file.
{ # Response to an image annotation request.
"safeSearchAnnotation": { # Set of features pertaining to the image, computed by computer vision # If present, safe-search annotation has completed successfully.
# methods over safe-search verticals (for example, adult, spoof, medical,
# violence).
"medical": "A String", # Likelihood that this is a medical image.
"violence": "A String", # Likelihood that this image contains violent content.
"spoof": "A String", # Spoof likelihood. The likelihood that an modification
# was made to the image's canonical version to make it appear
# funny or offensive.
"adult": "A String", # Represents the adult content likelihood for the image. Adult content may
# contain elements such as nudity, pornographic images or cartoons, or
# sexual activities.
"racy": "A String", # Likelihood that the request image contains racy content. Racy content may
# include (but is not limited to) skimpy or sheer clothing, strategically
# covered nudity, lewd or provocative poses, or close-ups of sensitive
# body areas.
},
"textAnnotations": [ # If present, text (OCR) detection has completed successfully.
{ # Set of detected entity features.
"confidence": 3.14, # **Deprecated. Use `score` instead.**
# The accuracy of the entity detection in an image.
# For example, for an image in which the "Eiffel Tower" entity is detected,
# this field represents the confidence that there is a tower in the query
# image. Range [0, 1].
"description": "A String", # Entity textual description, expressed in its `locale` language.
"locale": "A String", # The language code for the locale in which the entity textual
# `description` is expressed.
"topicality": 3.14, # The relevancy of the ICA (Image Content Annotation) label to the
# image. For example, the relevancy of "tower" is likely higher to an image
# containing the detected "Eiffel Tower" than to an image containing a
# detected distant towering building, even though the confidence that
# there is a tower in each image may be the same. Range [0, 1].
"mid": "A String", # Opaque entity ID. Some IDs may be available in
# [Google Knowledge Graph Search
# API](https://developers.google.com/knowledge-graph/).
"locations": [ # The location information for the detected entity. Multiple
# `LocationInfo` elements can be present because one location may
# indicate the location of the scene in the image, and another location
# may indicate the location of the place where the image was taken.
# Location information is usually present for landmarks.
{ # Detected entity location information.
"latLng": { # An object representing a latitude/longitude pair. This is expressed as a pair # lat/long location coordinates.
# of doubles representing degrees latitude and degrees longitude. Unless
# specified otherwise, this must conform to the
# <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
# standard</a>. Values must be within normalized ranges.
"latitude": 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0].
"longitude": 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0].
},
},
],
"score": 3.14, # Overall score of the result. Range [0, 1].
"boundingPoly": { # A bounding polygon for the detected image annotation. # Image region to which this entity belongs. Not produced
# for `LABEL_DETECTION` features.
"normalizedVertices": [ # The bounding polygon normalized vertices.
{ # A vertex represents a 2D point in the image.
# NOTE: the normalized vertex coordinates are relative to the original image
# and range from 0 to 1.
"y": 3.14, # Y coordinate.
"x": 3.14, # X coordinate.
},
],
"vertices": [ # The bounding polygon vertices.
{ # A vertex represents a 2D point in the image.
# NOTE: the vertex coordinates are in the same scale as the original image.
"y": 42, # Y coordinate.
"x": 42, # X coordinate.
},
],
},
"properties": [ # Some entities may have optional user-supplied `Property` (name/value)
# fields, such a score or string that qualifies the entity.
{ # A `Property` consists of a user-supplied name/value pair.
"uint64Value": "A String", # Value of numeric properties.
"name": "A String", # Name of the property.
"value": "A String", # Value of the property.
},
],
},
],
"webDetection": { # Relevant information for the image from the Internet. # If present, web detection has completed successfully.
"fullMatchingImages": [ # Fully matching images from the Internet.
# Can include resized copies of the query image.
{ # Metadata for online images.
"url": "A String", # The result image URL.
"score": 3.14, # (Deprecated) Overall relevancy score for the image.
},
],
"pagesWithMatchingImages": [ # Web pages containing the matching images from the Internet.
{ # Metadata for web pages.
"url": "A String", # The result web page URL.
"pageTitle": "A String", # Title for the web page, may contain HTML markups.
"score": 3.14, # (Deprecated) Overall relevancy score for the web page.
"partialMatchingImages": [ # Partial matching images on the page.
# Those images are similar enough to share some key-point features. For
# example an original image will likely have partial matching for its
# crops.
{ # Metadata for online images.
"url": "A String", # The result image URL.
"score": 3.14, # (Deprecated) Overall relevancy score for the image.
},
],
"fullMatchingImages": [ # Fully matching images on the page.
# Can include resized copies of the query image.
{ # Metadata for online images.
"url": "A String", # The result image URL.
"score": 3.14, # (Deprecated) Overall relevancy score for the image.
},
],
},
],
"visuallySimilarImages": [ # The visually similar image results.
{ # Metadata for online images.
"url": "A String", # The result image URL.
"score": 3.14, # (Deprecated) Overall relevancy score for the image.
},
],
"partialMatchingImages": [ # Partial matching images from the Internet.
# Those images are similar enough to share some key-point features. For
# example an original image will likely have partial matching for its crops.
{ # Metadata for online images.
"url": "A String", # The result image URL.
"score": 3.14, # (Deprecated) Overall relevancy score for the image.
},
],
"webEntities": [ # Deduced entities from similar images on the Internet.
{ # Entity deduced from similar images on the Internet.
"entityId": "A String", # Opaque entity ID.
"score": 3.14, # Overall relevancy score for the entity.
# Not normalized and not comparable across different image queries.
"description": "A String", # Canonical description of the entity, in English.
},
],
"bestGuessLabels": [ # The service's best guess as to the topic of the request image.
# Inferred from similar images on the open web.
{ # Label to provide extra metadata for the web detection.
"languageCode": "A String", # The BCP-47 language code for `label`, such as "en-US" or "sr-Latn".
# For more information, see
# http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
"label": "A String", # Label for extra metadata.
},
],
},
"localizedObjectAnnotations": [ # If present, localized object detection has completed successfully.
# This will be sorted descending by confidence score.
{ # Set of detected objects with bounding boxes.
"languageCode": "A String", # The BCP-47 language code, such as "en-US" or "sr-Latn". For more
# information, see
# http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
"score": 3.14, # Score of the result. Range [0, 1].
"mid": "A String", # Object ID that should align with EntityAnnotation mid.
"boundingPoly": { # A bounding polygon for the detected image annotation. # Image region to which this object belongs. This must be populated.
"normalizedVertices": [ # The bounding polygon normalized vertices.
{ # A vertex represents a 2D point in the image.
# NOTE: the normalized vertex coordinates are relative to the original image
# and range from 0 to 1.
"y": 3.14, # Y coordinate.
"x": 3.14, # X coordinate.
},
],
"vertices": [ # The bounding polygon vertices.
{ # A vertex represents a 2D point in the image.
# NOTE: the vertex coordinates are in the same scale as the original image.
"y": 42, # Y coordinate.
"x": 42, # X coordinate.
},
],
},
"name": "A String", # Object name, expressed in its `language_code` language.
},
],
"fullTextAnnotation": { # TextAnnotation contains a structured representation of OCR extracted text. # If present, text (OCR) detection or document (OCR) text detection has
# completed successfully.
# This annotation provides the structural hierarchy for the OCR detected
# text.
# The hierarchy of an OCR extracted text structure is like this:
# TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol
# Each structural component, starting from Page, may further have their own
# properties. Properties describe detected languages, breaks etc.. Please refer
# to the TextAnnotation.TextProperty message definition below for more
# detail.
"text": "A String", # UTF-8 text detected on the pages.
"pages": [ # List of pages detected by OCR.
{ # Detected page from OCR.
"width": 42, # Page width. For PDFs the unit is points. For images (including
# TIFFs) the unit is pixels.
"confidence": 3.14, # Confidence of the OCR results on the page. Range [0, 1].
"property": { # Additional information detected on the structural component. # Additional information detected on the page.
"detectedBreak": { # Detected start or end of a structural component. # Detected start or end of a text segment.
"isPrefix": True or False, # True if break prepends the element.
"type": "A String", # Detected break type.
},
"detectedLanguages": [ # A list of detected languages together with confidence.
{ # Detected language for a structural component.
"languageCode": "A String", # The BCP-47 language code, such as "en-US" or "sr-Latn". For more
# information, see
# http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
"confidence": 3.14, # Confidence of detected language. Range [0, 1].
},
],
},
"blocks": [ # List of blocks of text, images etc on this page.
{ # Logical element on the page.
"boundingBox": { # A bounding polygon for the detected image annotation. # The bounding box for the block.
# The vertices are in the order of top-left, top-right, bottom-right,
# bottom-left. When a rotation of the bounding box is detected the rotation
# is represented as around the top-left corner as defined when the text is
# read in the 'natural' orientation.
# For example:
#
# * when the text is horizontal it might look like:
#
# 0----1
# | |
# 3----2
#
# * when it's rotated 180 degrees around the top-left corner it becomes:
#
# 2----3
# | |
# 1----0
#
# and the vertex order will still be (0, 1, 2, 3).
"normalizedVertices": [ # The bounding polygon normalized vertices.
{ # A vertex represents a 2D point in the image.
# NOTE: the normalized vertex coordinates are relative to the original image
# and range from 0 to 1.
"y": 3.14, # Y coordinate.
"x": 3.14, # X coordinate.
},
],
"vertices": [ # The bounding polygon vertices.
{ # A vertex represents a 2D point in the image.
# NOTE: the vertex coordinates are in the same scale as the original image.
"y": 42, # Y coordinate.
"x": 42, # X coordinate.
},
],
},
"blockType": "A String", # Detected block type (text, image etc) for this block.
"property": { # Additional information detected on the structural component. # Additional information detected for the block.
"detectedBreak": { # Detected start or end of a structural component. # Detected start or end of a text segment.
"isPrefix": True or False, # True if break prepends the element.
"type": "A String", # Detected break type.
},
"detectedLanguages": [ # A list of detected languages together with confidence.
{ # Detected language for a structural component.
"languageCode": "A String", # The BCP-47 language code, such as "en-US" or "sr-Latn". For more
# information, see
# http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
"confidence": 3.14, # Confidence of detected language. Range [0, 1].
},
],
},
"confidence": 3.14, # Confidence of the OCR results on the block. Range [0, 1].
"paragraphs": [ # List of paragraphs in this block (if this blocks is of type text).
{ # Structural unit of text representing a number of words in certain order.
"boundingBox": { # A bounding polygon for the detected image annotation. # The bounding box for the paragraph.
# The vertices are in the order of top-left, top-right, bottom-right,
# bottom-left. When a rotation of the bounding box is detected the rotation
# is represented as around the top-left corner as defined when the text is
# read in the 'natural' orientation.
# For example:
# * when the text is horizontal it might look like:
# 0----1
# | |
# 3----2
# * when it's rotated 180 degrees around the top-left corner it becomes:
# 2----3
# | |
# 1----0
# and the vertex order will still be (0, 1, 2, 3).
"normalizedVertices": [ # The bounding polygon normalized vertices.
{ # A vertex represents a 2D point in the image.
# NOTE: the normalized vertex coordinates are relative to the original image
# and range from 0 to 1.
"y": 3.14, # Y coordinate.
"x": 3.14, # X coordinate.
},
],
"vertices": [ # The bounding polygon vertices.
{ # A vertex represents a 2D point in the image.
# NOTE: the vertex coordinates are in the same scale as the original image.
"y": 42, # Y coordinate.
"x": 42, # X coordinate.
},
],
},
"confidence": 3.14, # Confidence of the OCR results for the paragraph. Range [0, 1].
"property": { # Additional information detected on the structural component. # Additional information detected for the paragraph.
"detectedBreak": { # Detected start or end of a structural component. # Detected start or end of a text segment.
"isPrefix": True or False, # True if break prepends the element.
"type": "A String", # Detected break type.
},
"detectedLanguages": [ # A list of detected languages together with confidence.
{ # Detected language for a structural component.
"languageCode": "A String", # The BCP-47 language code, such as "en-US" or "sr-Latn". For more
# information, see
# http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
"confidence": 3.14, # Confidence of detected language. Range [0, 1].
},
],
},
"words": [ # List of words in this paragraph.
{ # A word representation.
"symbols": [ # List of symbols in the word.
# The order of the symbols follows the natural reading order.
{ # A single symbol representation.
"boundingBox": { # A bounding polygon for the detected image annotation. # The bounding box for the symbol.
# The vertices are in the order of top-left, top-right, bottom-right,
# bottom-left. When a rotation of the bounding box is detected the rotation
# is represented as around the top-left corner as defined when the text is
# read in the 'natural' orientation.
# For example:
# * when the text is horizontal it might look like:
# 0----1
# | |
# 3----2
# * when it's rotated 180 degrees around the top-left corner it becomes:
# 2----3
# | |
# 1----0
# and the vertice order will still be (0, 1, 2, 3).
"normalizedVertices": [ # The bounding polygon normalized vertices.
{ # A vertex represents a 2D point in the image.
# NOTE: the normalized vertex coordinates are relative to the original image
# and range from 0 to 1.
"y": 3.14, # Y coordinate.
"x": 3.14, # X coordinate.
},
],
"vertices": [ # The bounding polygon vertices.
{ # A vertex represents a 2D point in the image.
# NOTE: the vertex coordinates are in the same scale as the original image.
"y": 42, # Y coordinate.
"x": 42, # X coordinate.
},
],
},
"text": "A String", # The actual UTF-8 representation of the symbol.
"confidence": 3.14, # Confidence of the OCR results for the symbol. Range [0, 1].
"property": { # Additional information detected on the structural component. # Additional information detected for the symbol.
"detectedBreak": { # Detected start or end of a structural component. # Detected start or end of a text segment.
"isPrefix": True or False, # True if break prepends the element.
"type": "A String", # Detected break type.
},
"detectedLanguages": [ # A list of detected languages together with confidence.
{ # Detected language for a structural component.
"languageCode": "A String", # The BCP-47 language code, such as "en-US" or "sr-Latn". For more
# information, see
# http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
"confidence": 3.14, # Confidence of detected language. Range [0, 1].
},
],
},
},
],
"boundingBox": { # A bounding polygon for the detected image annotation. # The bounding box for the word.
# The vertices are in the order of top-left, top-right, bottom-right,
# bottom-left. When a rotation of the bounding box is detected the rotation
# is represented as around the top-left corner as defined when the text is
# read in the 'natural' orientation.
# For example:
# * when the text is horizontal it might look like:
# 0----1
# | |
# 3----2
# * when it's rotated 180 degrees around the top-left corner it becomes:
# 2----3
# | |
# 1----0
# and the vertex order will still be (0, 1, 2, 3).
"normalizedVertices": [ # The bounding polygon normalized vertices.
{ # A vertex represents a 2D point in the image.
# NOTE: the normalized vertex coordinates are relative to the original image
# and range from 0 to 1.
"y": 3.14, # Y coordinate.
"x": 3.14, # X coordinate.
},
],
"vertices": [ # The bounding polygon vertices.
{ # A vertex represents a 2D point in the image.
# NOTE: the vertex coordinates are in the same scale as the original image.
"y": 42, # Y coordinate.
"x": 42, # X coordinate.
},
],
},
"confidence": 3.14, # Confidence of the OCR results for the word. Range [0, 1].
"property": { # Additional information detected on the structural component. # Additional information detected for the word.
"detectedBreak": { # Detected start or end of a structural component. # Detected start or end of a text segment.
"isPrefix": True or False, # True if break prepends the element.
"type": "A String", # Detected break type.
},
"detectedLanguages": [ # A list of detected languages together with confidence.
{ # Detected language for a structural component.
"languageCode": "A String", # The BCP-47 language code, such as "en-US" or "sr-Latn". For more
# information, see
# http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
"confidence": 3.14, # Confidence of detected language. Range [0, 1].
},
],
},
},
],
},
],
},
],
"height": 42, # Page height. For PDFs the unit is points. For images (including
# TIFFs) the unit is pixels.
},
],
},
"labelAnnotations": [ # If present, label detection has completed successfully.
{ # Set of detected entity features.
"confidence": 3.14, # **Deprecated. Use `score` instead.**
# The accuracy of the entity detection in an image.
# For example, for an image in which the "Eiffel Tower" entity is detected,
# this field represents the confidence that there is a tower in the query
# image. Range [0, 1].
"description": "A String", # Entity textual description, expressed in its `locale` language.
"locale": "A String", # The language code for the locale in which the entity textual
# `description` is expressed.
"topicality": 3.14, # The relevancy of the ICA (Image Content Annotation) label to the
# image. For example, the relevancy of "tower" is likely higher to an image
# containing the detected "Eiffel Tower" than to an image containing a
# detected distant towering building, even though the confidence that
# there is a tower in each image may be the same. Range [0, 1].
"mid": "A String", # Opaque entity ID. Some IDs may be available in
# [Google Knowledge Graph Search
# API](https://developers.google.com/knowledge-graph/).
"locations": [ # The location information for the detected entity. Multiple
# `LocationInfo` elements can be present because one location may
# indicate the location of the scene in the image, and another location
# may indicate the location of the place where the image was taken.
# Location information is usually present for landmarks.
{ # Detected entity location information.
"latLng": { # An object representing a latitude/longitude pair. This is expressed as a pair # lat/long location coordinates.
# of doubles representing degrees latitude and degrees longitude. Unless
# specified otherwise, this must conform to the
# <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
# standard</a>. Values must be within normalized ranges.
"latitude": 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0].
"longitude": 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0].
},
},
],
"score": 3.14, # Overall score of the result. Range [0, 1].
"boundingPoly": { # A bounding polygon for the detected image annotation. # Image region to which this entity belongs. Not produced
# for `LABEL_DETECTION` features.
"normalizedVertices": [ # The bounding polygon normalized vertices.
{ # A vertex represents a 2D point in the image.
# NOTE: the normalized vertex coordinates are relative to the original image
# and range from 0 to 1.
"y": 3.14, # Y coordinate.
"x": 3.14, # X coordinate.
},
],
"vertices": [ # The bounding polygon vertices.
{ # A vertex represents a 2D point in the image.
# NOTE: the vertex coordinates are in the same scale as the original image.
"y": 42, # Y coordinate.
"x": 42, # X coordinate.
},
],
},
"properties": [ # Some entities may have optional user-supplied `Property` (name/value)
# fields, such a score or string that qualifies the entity.
{ # A `Property` consists of a user-supplied name/value pair.
"uint64Value": "A String", # Value of numeric properties.
"name": "A String", # Name of the property.
"value": "A String", # Value of the property.
},
],
},
],
"imagePropertiesAnnotation": { # Stores image properties, such as dominant colors. # If present, image properties were extracted successfully.
"dominantColors": { # Set of dominant colors and their corresponding scores. # If present, dominant colors completed successfully.
"colors": [ # RGB color values with their score and pixel fraction.
{ # Color information consists of RGB channels, score, and the fraction of
# the image that the color occupies in the image.
"color": { # Represents a color in the RGBA color space. This representation is designed # RGB components of the color.
# for simplicity of conversion to/from color representations in various
# languages over compactness; for example, the fields of this representation
# can be trivially provided to the constructor of "java.awt.Color" in Java; it
# can also be trivially provided to UIColor's "+colorWithRed:green:blue:alpha"
# method in iOS; and, with just a little work, it can be easily formatted into
# a CSS "rgba()" string in JavaScript, as well.
#
# Note: this proto does not carry information about the absolute color space
# that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB,
# DCI-P3, BT.2020, etc.). By default, applications SHOULD assume the sRGB color
# space.
#
# Example (Java):
#
# import com.google.type.Color;
#
# // ...
# public static java.awt.Color fromProto(Color protocolor) {
# float alpha = protocolor.hasAlpha()
# ? protocolor.getAlpha().getValue()
# : 1.0;
#
# return new java.awt.Color(
# protocolor.getRed(),
# protocolor.getGreen(),
# protocolor.getBlue(),
# alpha);
# }
#
# public static Color toProto(java.awt.Color color) {
# float red = (float) color.getRed();
# float green = (float) color.getGreen();
# float blue = (float) color.getBlue();
# float denominator = 255.0;
# Color.Builder resultBuilder =
# Color
# .newBuilder()
# .setRed(red / denominator)
# .setGreen(green / denominator)
# .setBlue(blue / denominator);
# int alpha = color.getAlpha();
# if (alpha != 255) {
# result.setAlpha(
# FloatValue
# .newBuilder()
# .setValue(((float) alpha) / denominator)
# .build());
# }
# return resultBuilder.build();
# }
# // ...
#
# Example (iOS / Obj-C):
#
# // ...
# static UIColor* fromProto(Color* protocolor) {
# float red = [protocolor red];
# float green = [protocolor green];
# float blue = [protocolor blue];
# FloatValue* alpha_wrapper = [protocolor alpha];
# float alpha = 1.0;
# if (alpha_wrapper != nil) {
# alpha = [alpha_wrapper value];
# }
# return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
# }
#
# static Color* toProto(UIColor* color) {
# CGFloat red, green, blue, alpha;
# if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) {
# return nil;
# }
# Color* result = [[Color alloc] init];
# [result setRed:red];
# [result setGreen:green];
# [result setBlue:blue];
# if (alpha <= 0.9999) {
# [result setAlpha:floatWrapperWithValue(alpha)];
# }
# [result autorelease];
# return result;
# }
# // ...
#
# Example (JavaScript):
#
# // ...
#
# var protoToCssColor = function(rgb_color) {
# var redFrac = rgb_color.red || 0.0;
# var greenFrac = rgb_color.green || 0.0;
# var blueFrac = rgb_color.blue || 0.0;
# var red = Math.floor(redFrac * 255);
# var green = Math.floor(greenFrac * 255);
# var blue = Math.floor(blueFrac * 255);
#
# if (!('alpha' in rgb_color)) {
# return rgbToCssColor_(red, green, blue);
# }
#
# var alphaFrac = rgb_color.alpha.value || 0.0;
# var rgbParams = [red, green, blue].join(',');
# return ['rgba(', rgbParams, ',', alphaFrac, ')'].join('');
# };
#
# var rgbToCssColor_ = function(red, green, blue) {
# var rgbNumber = new Number((red << 16) | (green << 8) | blue);
# var hexString = rgbNumber.toString(16);
# var missingZeros = 6 - hexString.length;
# var resultBuilder = ['#'];
# for (var i = 0; i < missingZeros; i++) {
# resultBuilder.push('0');
# }
# resultBuilder.push(hexString);
# return resultBuilder.join('');
# };
#
# // ...
"blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1].
"alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is,
# the final pixel color is defined by the equation:
#
# pixel color = alpha * (this color) + (1.0 - alpha) * (background color)
#
# This means that a value of 1.0 corresponds to a solid color, whereas
# a value of 0.0 corresponds to a completely transparent color. This
# uses a wrapper message rather than a simple float scalar so that it is
# possible to distinguish between a default value and the value being unset.
# If omitted, this color object is to be rendered as a solid color
# (as if the alpha value had been explicitly given with a value of 1.0).
"green": 3.14, # The amount of green in the color as a value in the interval [0, 1].
"red": 3.14, # The amount of red in the color as a value in the interval [0, 1].
},
"pixelFraction": 3.14, # The fraction of pixels the color occupies in the image.
# Value in range [0, 1].
"score": 3.14, # Image-specific score for this color. Value in range [0, 1].
},
],
},
},
"faceAnnotations": [ # If present, face detection has completed successfully.
{ # A face annotation object contains the results of face detection.
"sorrowLikelihood": "A String", # Sorrow likelihood.
"landmarkingConfidence": 3.14, # Face landmarking confidence. Range [0, 1].
"underExposedLikelihood": "A String", # Under-exposed likelihood.
"detectionConfidence": 3.14, # Detection confidence. Range [0, 1].
"joyLikelihood": "A String", # Joy likelihood.
"landmarks": [ # Detected face landmarks.
{ # A face-specific landmark (for example, a face feature).
"position": { # A 3D position in the image, used primarily for Face detection landmarks. # Face landmark position.
# A valid Position must have both x and y coordinates.
# The position coordinates are in the same scale as the original image.
"y": 3.14, # Y coordinate.
"x": 3.14, # X coordinate.
"z": 3.14, # Z coordinate (or depth).
},
"type": "A String", # Face landmark type.
},
],
"surpriseLikelihood": "A String", # Surprise likelihood.
"blurredLikelihood": "A String", # Blurred likelihood.
"tiltAngle": 3.14, # Pitch angle, which indicates the upwards/downwards angle that the face is
# pointing relative to the image's horizontal plane. Range [-180,180].
"angerLikelihood": "A String", # Anger likelihood.
"boundingPoly": { # A bounding polygon for the detected image annotation. # The bounding polygon around the face. The coordinates of the bounding box
# are in the original image's scale.
# The bounding box is computed to "frame" the face in accordance with human
# expectations. It is based on the landmarker results.
# Note that one or more x and/or y coordinates may not be generated in the
# `BoundingPoly` (the polygon will be unbounded) if only a partial face
# appears in the image to be annotated.
"normalizedVertices": [ # The bounding polygon normalized vertices.
{ # A vertex represents a 2D point in the image.
# NOTE: the normalized vertex coordinates are relative to the original image
# and range from 0 to 1.
"y": 3.14, # Y coordinate.
"x": 3.14, # X coordinate.
},
],
"vertices": [ # The bounding polygon vertices.
{ # A vertex represents a 2D point in the image.
# NOTE: the vertex coordinates are in the same scale as the original image.
"y": 42, # Y coordinate.
"x": 42, # X coordinate.
},
],
},
"rollAngle": 3.14, # Roll angle, which indicates the amount of clockwise/anti-clockwise rotation
# of the face relative to the image vertical about the axis perpendicular to
# the face. Range [-180,180].
"panAngle": 3.14, # Yaw angle, which indicates the leftward/rightward angle that the face is
# pointing relative to the vertical plane perpendicular to the image. Range
# [-180,180].
"headwearLikelihood": "A String", # Headwear likelihood.
"fdBoundingPoly": { # A bounding polygon for the detected image annotation. # The `fd_bounding_poly` bounding polygon is tighter than the
# `boundingPoly`, and encloses only the skin part of the face. Typically, it
# is used to eliminate the face from any image analysis that detects the
# "amount of skin" visible in an image. It is not based on the
# landmarker results, only on the initial face detection, hence
# the <code>fd</code> (face detection) prefix.
"normalizedVertices": [ # The bounding polygon normalized vertices.
{ # A vertex represents a 2D point in the image.
# NOTE: the normalized vertex coordinates are relative to the original image
# and range from 0 to 1.
"y": 3.14, # Y coordinate.
"x": 3.14, # X coordinate.
},
],
"vertices": [ # The bounding polygon vertices.
{ # A vertex represents a 2D point in the image.
# NOTE: the vertex coordinates are in the same scale as the original image.
"y": 42, # Y coordinate.
"x": 42, # X coordinate.
},
],
},
},
],
"productSearchResults": { # Results for a product search request. # If present, product search has completed successfully.
"productGroupedResults": [ # List of results grouped by products detected in the query image. Each entry
# corresponds to one bounding polygon in the query image, and contains the
# matching products specific to that region. There may be duplicate product
# matches in the union of all the per-product results.
{ # Information about the products similar to a single product in a query
# image.
"results": [ # List of results, one for each product match.
{ # Information about a product.
"image": "A String", # The resource name of the image from the product that is the closest match
# to the query.
"score": 3.14, # A confidence level on the match, ranging from 0 (no confidence) to
# 1 (full confidence).
"product": { # A Product contains ReferenceImages. # The Product.
"productLabels": [ # Key-value pairs that can be attached to a product. At query time,
# constraints can be specified based on the product_labels.
#
# Note that integer values can be provided as strings, e.g. "1199". Only
# strings with integer values can match a range-based restriction which is
# to be supported soon.
#
# Multiple values can be assigned to the same key. One product may have up to
# 100 product_labels.
{ # A product label represented as a key-value pair.
"value": "A String", # The value of the label attached to the product. Cannot be empty and
# cannot exceed 128 bytes.
"key": "A String", # The key of the label attached to the product. Cannot be empty and cannot
# exceed 128 bytes.
},
],
"displayName": "A String", # The user-provided name for this Product. Must not be empty. Must be at most
# 4096 characters long.
"name": "A String", # The resource name of the product.
#
# Format is:
# `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
#
# This field is ignored when creating a product.
"productCategory": "A String", # The category for the product identified by the reference image. This should
# be either "homegoods-v2", "apparel-v2", or "toys-v2". The legacy categories
# "homegoods", "apparel", and "toys" are still supported, but these should
# not be used for new products.
#
# This field is immutable.
"description": "A String", # User-provided metadata to be stored with this product. Must be at most 4096
# characters long.
},
},
],
"boundingPoly": { # A bounding polygon for the detected image annotation. # The bounding polygon around the product detected in the query image.
"normalizedVertices": [ # The bounding polygon normalized vertices.
{ # A vertex represents a 2D point in the image.
# NOTE: the normalized vertex coordinates are relative to the original image
# and range from 0 to 1.
"y": 3.14, # Y coordinate.
"x": 3.14, # X coordinate.
},
],
"vertices": [ # The bounding polygon vertices.
{ # A vertex represents a 2D point in the image.
# NOTE: the vertex coordinates are in the same scale as the original image.
"y": 42, # Y coordinate.
"x": 42, # X coordinate.
},
],
},
},
],
"results": [ # List of results, one for each product match.
{ # Information about a product.
"image": "A String", # The resource name of the image from the product that is the closest match
# to the query.
"score": 3.14, # A confidence level on the match, ranging from 0 (no confidence) to
# 1 (full confidence).
"product": { # A Product contains ReferenceImages. # The Product.
"productLabels": [ # Key-value pairs that can be attached to a product. At query time,
# constraints can be specified based on the product_labels.
#
# Note that integer values can be provided as strings, e.g. "1199". Only
# strings with integer values can match a range-based restriction which is
# to be supported soon.
#
# Multiple values can be assigned to the same key. One product may have up to
# 100 product_labels.
{ # A product label represented as a key-value pair.
"value": "A String", # The value of the label attached to the product. Cannot be empty and
# cannot exceed 128 bytes.
"key": "A String", # The key of the label attached to the product. Cannot be empty and cannot
# exceed 128 bytes.
},
],
"displayName": "A String", # The user-provided name for this Product. Must not be empty. Must be at most
# 4096 characters long.
"name": "A String", # The resource name of the product.
#
# Format is:
# `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
#
# This field is ignored when creating a product.
"productCategory": "A String", # The category for the product identified by the reference image. This should
# be either "homegoods-v2", "apparel-v2", or "toys-v2". The legacy categories
# "homegoods", "apparel", and "toys" are still supported, but these should
# not be used for new products.
#
# This field is immutable.
"description": "A String", # User-provided metadata to be stored with this product. Must be at most 4096
# characters long.
},
},
],
"indexTime": "A String", # Timestamp of the index which provided these results. Products added to the
# product set and products removed from the product set after this time are
# not reflected in the current results.
},
"logoAnnotations": [ # If present, logo detection has completed successfully.
{ # Set of detected entity features.
"confidence": 3.14, # **Deprecated. Use `score` instead.**
# The accuracy of the entity detection in an image.
# For example, for an image in which the "Eiffel Tower" entity is detected,
# this field represents the confidence that there is a tower in the query
# image. Range [0, 1].
"description": "A String", # Entity textual description, expressed in its `locale` language.
"locale": "A String", # The language code for the locale in which the entity textual
# `description` is expressed.
"topicality": 3.14, # The relevancy of the ICA (Image Content Annotation) label to the
# image. For example, the relevancy of "tower" is likely higher to an image
# containing the detected "Eiffel Tower" than to an image containing a
# detected distant towering building, even though the confidence that
# there is a tower in each image may be the same. Range [0, 1].
"mid": "A String", # Opaque entity ID. Some IDs may be available in
# [Google Knowledge Graph Search
# API](https://developers.google.com/knowledge-graph/).
"locations": [ # The location information for the detected entity. Multiple
# `LocationInfo` elements can be present because one location may
# indicate the location of the scene in the image, and another location
# may indicate the location of the place where the image was taken.
# Location information is usually present for landmarks.
{ # Detected entity location information.
"latLng": { # An object representing a latitude/longitude pair. This is expressed as a pair # lat/long location coordinates.
# of doubles representing degrees latitude and degrees longitude. Unless
# specified otherwise, this must conform to the
# <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
# standard</a>. Values must be within normalized ranges.
"latitude": 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0].
"longitude": 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0].
},
},
],
"score": 3.14, # Overall score of the result. Range [0, 1].
"boundingPoly": { # A bounding polygon for the detected image annotation. # Image region to which this entity belongs. Not produced
# for `LABEL_DETECTION` features.
"normalizedVertices": [ # The bounding polygon normalized vertices.
{ # A vertex represents a 2D point in the image.
# NOTE: the normalized vertex coordinates are relative to the original image
# and range from 0 to 1.
"y": 3.14, # Y coordinate.
"x": 3.14, # X coordinate.
},
],
"vertices": [ # The bounding polygon vertices.
{ # A vertex represents a 2D point in the image.
# NOTE: the vertex coordinates are in the same scale as the original image.
"y": 42, # Y coordinate.
"x": 42, # X coordinate.
},
],
},
"properties": [ # Some entities may have optional user-supplied `Property` (name/value)
# fields, such a score or string that qualifies the entity.
{ # A `Property` consists of a user-supplied name/value pair.
"uint64Value": "A String", # Value of numeric properties.
"name": "A String", # Name of the property.
"value": "A String", # Value of the property.
},
],
},
],
"landmarkAnnotations": [ # If present, landmark detection has completed successfully.
{ # Set of detected entity features.
"confidence": 3.14, # **Deprecated. Use `score` instead.**
# The accuracy of the entity detection in an image.
# For example, for an image in which the "Eiffel Tower" entity is detected,
# this field represents the confidence that there is a tower in the query
# image. Range [0, 1].
"description": "A String", # Entity textual description, expressed in its `locale` language.
"locale": "A String", # The language code for the locale in which the entity textual
# `description` is expressed.
"topicality": 3.14, # The relevancy of the ICA (Image Content Annotation) label to the
# image. For example, the relevancy of "tower" is likely higher to an image
# containing the detected "Eiffel Tower" than to an image containing a
# detected distant towering building, even though the confidence that
# there is a tower in each image may be the same. Range [0, 1].
"mid": "A String", # Opaque entity ID. Some IDs may be available in
# [Google Knowledge Graph Search
# API](https://developers.google.com/knowledge-graph/).
"locations": [ # The location information for the detected entity. Multiple
# `LocationInfo` elements can be present because one location may
# indicate the location of the scene in the image, and another location
# may indicate the location of the place where the image was taken.
# Location information is usually present for landmarks.
{ # Detected entity location information.
"latLng": { # An object representing a latitude/longitude pair. This is expressed as a pair # lat/long location coordinates.
# of doubles representing degrees latitude and degrees longitude. Unless
# specified otherwise, this must conform to the
# <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
# standard</a>. Values must be within normalized ranges.
"latitude": 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0].
"longitude": 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0].
},
},
],
"score": 3.14, # Overall score of the result. Range [0, 1].
"boundingPoly": { # A bounding polygon for the detected image annotation. # Image region to which this entity belongs. Not produced
# for `LABEL_DETECTION` features.
"normalizedVertices": [ # The bounding polygon normalized vertices.
{ # A vertex represents a 2D point in the image.
# NOTE: the normalized vertex coordinates are relative to the original image
# and range from 0 to 1.
"y": 3.14, # Y coordinate.
"x": 3.14, # X coordinate.
},
],
"vertices": [ # The bounding polygon vertices.
{ # A vertex represents a 2D point in the image.
# NOTE: the vertex coordinates are in the same scale as the original image.
"y": 42, # Y coordinate.
"x": 42, # X coordinate.
},
],
},
"properties": [ # Some entities may have optional user-supplied `Property` (name/value)
# fields, such a score or string that qualifies the entity.
{ # A `Property` consists of a user-supplied name/value pair.
"uint64Value": "A String", # Value of numeric properties.
"name": "A String", # Name of the property.
"value": "A String", # Value of the property.
},
],
},
],
"context": { # If an image was produced from a file (e.g. a PDF), this message gives # If present, contextual information is needed to understand where this image
# comes from.
# information about the source of that image.
"pageNumber": 42, # If the file was a PDF or TIFF, this field gives the page number within
# the file used to produce the image.
"uri": "A String", # The URI of the file used to produce the image.
},
"error": { # The `Status` type defines a logical error model that is suitable for # If set, represents the error message for the operation.
# Note that filled-in image annotations are guaranteed to be
# correct, even when `error` is set.
# different programming environments, including REST APIs and RPC APIs. It is
# used by [gRPC](https://github.com/grpc). Each `Status` message contains
# three pieces of data: error code, error message, and error details.
#
# You can find out more about this error model and how to work with it in the
# [API Design Guide](https://cloud.google.com/apis/design/errors).
"message": "A String", # A developer-facing error message, which should be in English. Any
# user-facing error message should be localized and sent in the
# google.rpc.Status.details field, or localized by the client.
"code": 42, # The status code, which should be an enum value of google.rpc.Code.
"details": [ # A list of messages that carry the error details. There is a common set of
# message types for APIs to use.
{
"a_key": "", # Properties of the object. Contains field @type with type URL.
},
],
},
"cropHintsAnnotation": { # Set of crop hints that are used to generate new crops when serving images. # If present, crop hints have completed successfully.
"cropHints": [ # Crop hint results.
{ # Single crop hint that is used to generate a new crop when serving an image.
"confidence": 3.14, # Confidence of this being a salient region. Range [0, 1].
"boundingPoly": { # A bounding polygon for the detected image annotation. # The bounding polygon for the crop region. The coordinates of the bounding
# box are in the original image's scale.
"normalizedVertices": [ # The bounding polygon normalized vertices.
{ # A vertex represents a 2D point in the image.
# NOTE: the normalized vertex coordinates are relative to the original image
# and range from 0 to 1.
"y": 3.14, # Y coordinate.
"x": 3.14, # X coordinate.
},
],
"vertices": [ # The bounding polygon vertices.
{ # A vertex represents a 2D point in the image.
# NOTE: the vertex coordinates are in the same scale as the original image.
"y": 42, # Y coordinate.
"x": 42, # X coordinate.
},
],
},
"importanceFraction": 3.14, # Fraction of importance of this salient region with respect to the original
# image.
},
],
},
},
],
"inputConfig": { # The desired input location and metadata. # Information about the file for which this response is generated.
"mimeType": "A String", # The type of the file. Currently only "application/pdf", "image/tiff" and
# "image/gif" are supported. Wildcards are not supported.
"content": "A String", # File content, represented as a stream of bytes.
# Note: As with all `bytes` fields, protobuffers use a pure binary
# representation, whereas JSON representations use base64.
#
# Currently, this field only works for BatchAnnotateFiles requests. It does
# not work for AsyncBatchAnnotateFiles requests.
"gcsSource": { # The Google Cloud Storage location where the input will be read from. # The Google Cloud Storage location to read the input from.
"uri": "A String", # Google Cloud Storage URI for the input file. This must only be a
# Google Cloud Storage object. Wildcards are not currently supported.
},
},
},
],
}</pre>
</div>
<div class="method">
<code class="details" id="asyncBatchAnnotate">asyncBatchAnnotate(body, x__xgafv=None)</code>
<pre>Run asynchronous image detection and annotation for a list of generic
files, such as PDF files, which may contain multiple pages and multiple
images per page. Progress and results can be retrieved through the
`google.longrunning.Operations` interface.
`Operation.metadata` contains `OperationMetadata` (metadata).
`Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results).
Args:
body: object, The request body. (required)
The object takes the form of:
{ # Multiple async file annotation requests are batched into a single service
# call.
"requests": [ # Individual async file annotation requests for this batch.
{ # An offline file annotation request.
"imageContext": { # Image context and/or feature-specific parameters. # Additional context that may accompany the image(s) in the file.
"latLongRect": { # Rectangle determined by min and max `LatLng` pairs. # Not used.
"minLatLng": { # An object representing a latitude/longitude pair. This is expressed as a pair # Min lat/long pair.
# of doubles representing degrees latitude and degrees longitude. Unless
# specified otherwise, this must conform to the
# <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
# standard</a>. Values must be within normalized ranges.
"latitude": 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0].
"longitude": 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0].
},
"maxLatLng": { # An object representing a latitude/longitude pair. This is expressed as a pair # Max lat/long pair.
# of doubles representing degrees latitude and degrees longitude. Unless
# specified otherwise, this must conform to the
# <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
# standard</a>. Values must be within normalized ranges.
"latitude": 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0].
"longitude": 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0].
},
},
"languageHints": [ # List of languages to use for TEXT_DETECTION. In most cases, an empty value
# yields the best results since it enables automatic language detection. For
# languages based on the Latin alphabet, setting `language_hints` is not
# needed. In rare cases, when the language of the text in the image is known,
# setting a hint will help get better results (although it will be a
# significant hindrance if the hint is wrong). Text detection returns an
# error if one or more of the specified languages is not one of the
# [supported languages](/vision/docs/languages).
"A String",
],
"productSearchParams": { # Parameters for a product search request. # Parameters for product search.
"productCategories": [ # The list of product categories to search in. Currently, we only consider
# the first category, and either "homegoods-v2", "apparel-v2", or "toys-v2"
# should be specified. The legacy categories "homegoods", "apparel", and
# "toys" are still supported but will be deprecated. For new products, please
# use "homegoods-v2", "apparel-v2", or "toys-v2" for better product search
# accuracy. It is recommended to migrate existing products to these
# categories as well.
"A String",
],
"filter": "A String", # The filtering expression. This can be used to restrict search results based
# on Product labels. We currently support an AND of OR of key-value
# expressions, where each expression within an OR must have the same key. An
# '=' should be used to connect the key and value.
#
# For example, "(color = red OR color = blue) AND brand = Google" is
# acceptable, but "(color = red OR brand = Google)" is not acceptable.
# "color: red" is not acceptable because it uses a ':' instead of an '='.
"productSet": "A String", # The resource name of a ProductSet to be searched for similar images.
#
# Format is:
# `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`.
"boundingPoly": { # A bounding polygon for the detected image annotation. # The bounding polygon around the area of interest in the image.
# Optional. If it is not specified, system discretion will be applied.
"normalizedVertices": [ # The bounding polygon normalized vertices.
{ # A vertex represents a 2D point in the image.
# NOTE: the normalized vertex coordinates are relative to the original image
# and range from 0 to 1.
"y": 3.14, # Y coordinate.
"x": 3.14, # X coordinate.
},
],
"vertices": [ # The bounding polygon vertices.
{ # A vertex represents a 2D point in the image.
# NOTE: the vertex coordinates are in the same scale as the original image.
"y": 42, # Y coordinate.
"x": 42, # X coordinate.
},
],
},
},
"cropHintsParams": { # Parameters for crop hints annotation request. # Parameters for crop hints annotation request.
"aspectRatios": [ # Aspect ratios in floats, representing the ratio of the width to the height
# of the image. For example, if the desired aspect ratio is 4/3, the
# corresponding float value should be 1.33333. If not specified, the
# best possible crop is returned. The number of provided aspect ratios is
# limited to a maximum of 16; any aspect ratios provided after the 16th are
# ignored.
3.14,
],
},
"webDetectionParams": { # Parameters for web detection request. # Parameters for web detection.
"includeGeoResults": True or False, # Whether to include results derived from the geo information in the image.
},
},
"outputConfig": { # The desired output location and metadata. # Required. The desired output location and metadata (e.g. format).
"batchSize": 42, # The max number of response protos to put into each output JSON file on
# Google Cloud Storage.
# The valid range is [1, 100]. If not specified, the default value is 20.
#
# For example, for one pdf file with 100 pages, 100 response protos will
# be generated. If `batch_size` = 20, then 5 json files each
# containing 20 response protos will be written under the prefix
# `gcs_destination`.`uri`.
#
# Currently, batch_size only applies to GcsDestination, with potential future
# support for other output configurations.
"gcsDestination": { # The Google Cloud Storage location where the output will be written to. # The Google Cloud Storage location to write the output(s) to.
"uri": "A String", # Google Cloud Storage URI prefix where the results will be stored. Results
# will be in JSON format and preceded by its corresponding input URI prefix.
# This field can either represent a gcs file prefix or gcs directory. In
# either case, the uri should be unique because in order to get all of the
# output files, you will need to do a wildcard gcs search on the uri prefix
# you provide.
#
# Examples:
#
# * File Prefix: gs://bucket-name/here/filenameprefix The output files
# will be created in gs://bucket-name/here/ and the names of the
# output files will begin with "filenameprefix".
#
# * Directory Prefix: gs://bucket-name/some/location/ The output files
# will be created in gs://bucket-name/some/location/ and the names of the
# output files could be anything because there was no filename prefix
# specified.
#
# If multiple outputs, each response is still AnnotateFileResponse, each of
# which contains some subset of the full list of AnnotateImageResponse.
# Multiple outputs can happen if, for example, the output JSON is too large
# and overflows into multiple sharded files.
},
},
"inputConfig": { # The desired input location and metadata. # Required. Information about the input file.
"mimeType": "A String", # The type of the file. Currently only "application/pdf", "image/tiff" and
# "image/gif" are supported. Wildcards are not supported.
"content": "A String", # File content, represented as a stream of bytes.
# Note: As with all `bytes` fields, protobuffers use a pure binary
# representation, whereas JSON representations use base64.
#
# Currently, this field only works for BatchAnnotateFiles requests. It does
# not work for AsyncBatchAnnotateFiles requests.
"gcsSource": { # The Google Cloud Storage location where the input will be read from. # The Google Cloud Storage location to read the input from.
"uri": "A String", # Google Cloud Storage URI for the input file. This must only be a
# Google Cloud Storage object. Wildcards are not currently supported.
},
},
"features": [ # Required. Requested features.
{ # The type of Google Cloud Vision API detection to perform, and the maximum
# number of results to return for that type. Multiple `Feature` objects can
# be specified in the `features` list.
"model": "A String", # Model to use for the feature.
# Supported values: "builtin/stable" (the default if unset) and
# "builtin/latest".
"type": "A String", # The feature type.
"maxResults": 42, # Maximum number of results of this type. Does not apply to
# `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`.
},
],
},
],
}
x__xgafv: string, V1 error format.
Allowed values
1 - v1 error format
2 - v2 error format
Returns:
An object of the form:
{ # This resource represents a long-running operation that is the result of a
# network API call.
"metadata": { # Service-specific metadata associated with the operation. It typically
# contains progress information and common metadata such as create time.
# Some services might not provide such metadata. Any method that returns a
# long-running operation should document the metadata type, if any.
"a_key": "", # Properties of the object. Contains field @type with type URL.
},
"error": { # The `Status` type defines a logical error model that is suitable for # The error result of the operation in case of failure or cancellation.
# different programming environments, including REST APIs and RPC APIs. It is
# used by [gRPC](https://github.com/grpc). Each `Status` message contains
# three pieces of data: error code, error message, and error details.
#
# You can find out more about this error model and how to work with it in the
# [API Design Guide](https://cloud.google.com/apis/design/errors).
"message": "A String", # A developer-facing error message, which should be in English. Any
# user-facing error message should be localized and sent in the
# google.rpc.Status.details field, or localized by the client.
"code": 42, # The status code, which should be an enum value of google.rpc.Code.
"details": [ # A list of messages that carry the error details. There is a common set of
# message types for APIs to use.
{
"a_key": "", # Properties of the object. Contains field @type with type URL.
},
],
},
"done": True or False, # If the value is `false`, it means the operation is still in progress.
# If `true`, the operation is completed, and either `error` or `response` is
# available.
"response": { # The normal response of the operation in case of success. If the original
# method returns no data on success, such as `Delete`, the response is
# `google.protobuf.Empty`. If the original method is standard
# `Get`/`Create`/`Update`, the response should be the resource. For other
# methods, the response should have the type `XxxResponse`, where `Xxx`
# is the original method name. For example, if the original method name
# is `TakeSnapshot()`, the inferred response type is
# `TakeSnapshotResponse`.
"a_key": "", # Properties of the object. Contains field @type with type URL.
},
"name": "A String", # The server-assigned name, which is only unique within the same service that
# originally returns it. If you use the default HTTP mapping, the
# `name` should be a resource name ending with `operations/{unique_id}`.
}</pre>
</div>
</body></html>
|