|
| 1 | +# Copyright 2018 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 | +# https://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 | +"""Wrappers for protocol buffer enum types.""" |
| 15 | + |
| 16 | + |
| 17 | +class Likelihood(object): |
| 18 | + """ |
| 19 | + A bucketized representation of likelihood, which is intended to give clients |
| 20 | + highly stable results across model upgrades. |
| 21 | +
|
| 22 | + Attributes: |
| 23 | + UNKNOWN (int): Unknown likelihood. |
| 24 | + VERY_UNLIKELY (int): It is very unlikely that the image belongs to the specified vertical. |
| 25 | + UNLIKELY (int): It is unlikely that the image belongs to the specified vertical. |
| 26 | + POSSIBLE (int): It is possible that the image belongs to the specified vertical. |
| 27 | + LIKELY (int): It is likely that the image belongs to the specified vertical. |
| 28 | + VERY_LIKELY (int): It is very likely that the image belongs to the specified vertical. |
| 29 | + """ |
| 30 | + UNKNOWN = 0 |
| 31 | + VERY_UNLIKELY = 1 |
| 32 | + UNLIKELY = 2 |
| 33 | + POSSIBLE = 3 |
| 34 | + LIKELY = 4 |
| 35 | + VERY_LIKELY = 5 |
| 36 | + |
| 37 | + |
| 38 | +class TextAnnotation(object): |
| 39 | + class DetectedBreak(object): |
| 40 | + class BreakType(object): |
| 41 | + """ |
| 42 | + Enum to denote the type of break found. New line, space etc. |
| 43 | +
|
| 44 | + Attributes: |
| 45 | + UNKNOWN (int): Unknown break label type. |
| 46 | + SPACE (int): Regular space. |
| 47 | + SURE_SPACE (int): Sure space (very wide). |
| 48 | + EOL_SURE_SPACE (int): Line-wrapping break. |
| 49 | + HYPHEN (int): End-line hyphen that is not present in text; does not co-occur with |
| 50 | + ``SPACE``, ``LEADER_SPACE``, or ``LINE_BREAK``. |
| 51 | + LINE_BREAK (int): Line break that ends a paragraph. |
| 52 | + """ |
| 53 | + UNKNOWN = 0 |
| 54 | + SPACE = 1 |
| 55 | + SURE_SPACE = 2 |
| 56 | + EOL_SURE_SPACE = 3 |
| 57 | + HYPHEN = 4 |
| 58 | + LINE_BREAK = 5 |
| 59 | + |
| 60 | + |
| 61 | +class Block(object): |
| 62 | + class BlockType(object): |
| 63 | + """ |
| 64 | + Type of a block (text, image etc) as identified by OCR. |
| 65 | +
|
| 66 | + Attributes: |
| 67 | + UNKNOWN (int): Unknown block type. |
| 68 | + TEXT (int): Regular text block. |
| 69 | + TABLE (int): Table block. |
| 70 | + PICTURE (int): Image block. |
| 71 | + RULER (int): Horizontal/vertical line box. |
| 72 | + BARCODE (int): Barcode block. |
| 73 | + """ |
| 74 | + UNKNOWN = 0 |
| 75 | + TEXT = 1 |
| 76 | + TABLE = 2 |
| 77 | + PICTURE = 3 |
| 78 | + RULER = 4 |
| 79 | + BARCODE = 5 |
| 80 | + |
| 81 | + |
| 82 | +class Feature(object): |
| 83 | + class Type(object): |
| 84 | + """ |
| 85 | + Type of Google Cloud Vision API feature to be extracted. |
| 86 | +
|
| 87 | + Attributes: |
| 88 | + TYPE_UNSPECIFIED (int): Unspecified feature type. |
| 89 | + FACE_DETECTION (int): Run face detection. |
| 90 | + LANDMARK_DETECTION (int): Run landmark detection. |
| 91 | + LOGO_DETECTION (int): Run logo detection. |
| 92 | + LABEL_DETECTION (int): Run label detection. |
| 93 | + TEXT_DETECTION (int): Run text detection / optical character recognition (OCR). Text detection |
| 94 | + is optimized for areas of text within a larger image; if the image is |
| 95 | + a document, use ``DOCUMENT_TEXT_DETECTION`` instead. |
| 96 | + DOCUMENT_TEXT_DETECTION (int): Run dense text document OCR. Takes precedence when both |
| 97 | + ``DOCUMENT_TEXT_DETECTION`` and ``TEXT_DETECTION`` are present. |
| 98 | + SAFE_SEARCH_DETECTION (int): Run Safe Search to detect potentially unsafe |
| 99 | + or undesirable content. |
| 100 | + IMAGE_PROPERTIES (int): Compute a set of image properties, such as the |
| 101 | + image's dominant colors. |
| 102 | + CROP_HINTS (int): Run crop hints. |
| 103 | + WEB_DETECTION (int): Run web detection. |
| 104 | + """ |
| 105 | + TYPE_UNSPECIFIED = 0 |
| 106 | + FACE_DETECTION = 1 |
| 107 | + LANDMARK_DETECTION = 2 |
| 108 | + LOGO_DETECTION = 3 |
| 109 | + LABEL_DETECTION = 4 |
| 110 | + TEXT_DETECTION = 5 |
| 111 | + DOCUMENT_TEXT_DETECTION = 11 |
| 112 | + SAFE_SEARCH_DETECTION = 6 |
| 113 | + IMAGE_PROPERTIES = 7 |
| 114 | + CROP_HINTS = 9 |
| 115 | + WEB_DETECTION = 10 |
| 116 | + |
| 117 | + |
| 118 | +class FaceAnnotation(object): |
| 119 | + class Landmark(object): |
| 120 | + class Type(object): |
| 121 | + """ |
| 122 | + Face landmark (feature) type. |
| 123 | + Left and right are defined from the vantage of the viewer of the image |
| 124 | + without considering mirror projections typical of photos. So, ``LEFT_EYE``, |
| 125 | + typically, is the person's right eye. |
| 126 | +
|
| 127 | + Attributes: |
| 128 | + UNKNOWN_LANDMARK (int): Unknown face landmark detected. Should not be filled. |
| 129 | + LEFT_EYE (int): Left eye. |
| 130 | + RIGHT_EYE (int): Right eye. |
| 131 | + LEFT_OF_LEFT_EYEBROW (int): Left of left eyebrow. |
| 132 | + RIGHT_OF_LEFT_EYEBROW (int): Right of left eyebrow. |
| 133 | + LEFT_OF_RIGHT_EYEBROW (int): Left of right eyebrow. |
| 134 | + RIGHT_OF_RIGHT_EYEBROW (int): Right of right eyebrow. |
| 135 | + MIDPOINT_BETWEEN_EYES (int): Midpoint between eyes. |
| 136 | + NOSE_TIP (int): Nose tip. |
| 137 | + UPPER_LIP (int): Upper lip. |
| 138 | + LOWER_LIP (int): Lower lip. |
| 139 | + MOUTH_LEFT (int): Mouth left. |
| 140 | + MOUTH_RIGHT (int): Mouth right. |
| 141 | + MOUTH_CENTER (int): Mouth center. |
| 142 | + NOSE_BOTTOM_RIGHT (int): Nose, bottom right. |
| 143 | + NOSE_BOTTOM_LEFT (int): Nose, bottom left. |
| 144 | + NOSE_BOTTOM_CENTER (int): Nose, bottom center. |
| 145 | + LEFT_EYE_TOP_BOUNDARY (int): Left eye, top boundary. |
| 146 | + LEFT_EYE_RIGHT_CORNER (int): Left eye, right corner. |
| 147 | + LEFT_EYE_BOTTOM_BOUNDARY (int): Left eye, bottom boundary. |
| 148 | + LEFT_EYE_LEFT_CORNER (int): Left eye, left corner. |
| 149 | + RIGHT_EYE_TOP_BOUNDARY (int): Right eye, top boundary. |
| 150 | + RIGHT_EYE_RIGHT_CORNER (int): Right eye, right corner. |
| 151 | + RIGHT_EYE_BOTTOM_BOUNDARY (int): Right eye, bottom boundary. |
| 152 | + RIGHT_EYE_LEFT_CORNER (int): Right eye, left corner. |
| 153 | + LEFT_EYEBROW_UPPER_MIDPOINT (int): Left eyebrow, upper midpoint. |
| 154 | + RIGHT_EYEBROW_UPPER_MIDPOINT (int): Right eyebrow, upper midpoint. |
| 155 | + LEFT_EAR_TRAGION (int): Left ear tragion. |
| 156 | + RIGHT_EAR_TRAGION (int): Right ear tragion. |
| 157 | + LEFT_EYE_PUPIL (int): Left eye pupil. |
| 158 | + RIGHT_EYE_PUPIL (int): Right eye pupil. |
| 159 | + FOREHEAD_GLABELLA (int): Forehead glabella. |
| 160 | + CHIN_GNATHION (int): Chin gnathion. |
| 161 | + CHIN_LEFT_GONION (int): Chin left gonion. |
| 162 | + CHIN_RIGHT_GONION (int): Chin right gonion. |
| 163 | + """ |
| 164 | + UNKNOWN_LANDMARK = 0 |
| 165 | + LEFT_EYE = 1 |
| 166 | + RIGHT_EYE = 2 |
| 167 | + LEFT_OF_LEFT_EYEBROW = 3 |
| 168 | + RIGHT_OF_LEFT_EYEBROW = 4 |
| 169 | + LEFT_OF_RIGHT_EYEBROW = 5 |
| 170 | + RIGHT_OF_RIGHT_EYEBROW = 6 |
| 171 | + MIDPOINT_BETWEEN_EYES = 7 |
| 172 | + NOSE_TIP = 8 |
| 173 | + UPPER_LIP = 9 |
| 174 | + LOWER_LIP = 10 |
| 175 | + MOUTH_LEFT = 11 |
| 176 | + MOUTH_RIGHT = 12 |
| 177 | + MOUTH_CENTER = 13 |
| 178 | + NOSE_BOTTOM_RIGHT = 14 |
| 179 | + NOSE_BOTTOM_LEFT = 15 |
| 180 | + NOSE_BOTTOM_CENTER = 16 |
| 181 | + LEFT_EYE_TOP_BOUNDARY = 17 |
| 182 | + LEFT_EYE_RIGHT_CORNER = 18 |
| 183 | + LEFT_EYE_BOTTOM_BOUNDARY = 19 |
| 184 | + LEFT_EYE_LEFT_CORNER = 20 |
| 185 | + RIGHT_EYE_TOP_BOUNDARY = 21 |
| 186 | + RIGHT_EYE_RIGHT_CORNER = 22 |
| 187 | + RIGHT_EYE_BOTTOM_BOUNDARY = 23 |
| 188 | + RIGHT_EYE_LEFT_CORNER = 24 |
| 189 | + LEFT_EYEBROW_UPPER_MIDPOINT = 25 |
| 190 | + RIGHT_EYEBROW_UPPER_MIDPOINT = 26 |
| 191 | + LEFT_EAR_TRAGION = 27 |
| 192 | + RIGHT_EAR_TRAGION = 28 |
| 193 | + LEFT_EYE_PUPIL = 29 |
| 194 | + RIGHT_EYE_PUPIL = 30 |
| 195 | + FOREHEAD_GLABELLA = 31 |
| 196 | + CHIN_GNATHION = 32 |
| 197 | + CHIN_LEFT_GONION = 33 |
| 198 | + CHIN_RIGHT_GONION = 34 |
| 199 | + |
| 200 | + |
| 201 | +class OperationMetadata(object): |
| 202 | + class State(object): |
| 203 | + """ |
| 204 | + Batch operation states. |
| 205 | +
|
| 206 | + Attributes: |
| 207 | + STATE_UNSPECIFIED (int): Invalid. |
| 208 | + CREATED (int): Request is received. |
| 209 | + RUNNING (int): Request is actively being processed. |
| 210 | + DONE (int): The batch processing is done. |
| 211 | + CANCELLED (int): The batch processing was cancelled. |
| 212 | + """ |
| 213 | + STATE_UNSPECIFIED = 0 |
| 214 | + CREATED = 1 |
| 215 | + RUNNING = 2 |
| 216 | + DONE = 3 |
| 217 | + CANCELLED = 4 |
0 commit comments