|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272 |
- /**
- * Copyright 2019-2020 Huawei Technologies Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
- #ifndef GE_OP_MAGE_OPS_H_
- #define GE_OP_MAGE_OPS_H_
-
- #include "graph/operator_reg.h"
-
- namespace ge {
-
- /**
- *@brief Adjust the hue of one or more images.
-
- *@par Inputs:
- *Input images is a tensor of at least 3 dimensions. The last dimension is \n
- interpretted as channels, and must be three. Inputs include: \n
- *@li images:A Tensor of type float. Images to adjust. At least 3-D.
- *@li delta:A Tensor of type float. A float delta to add to the hue.
-
- *@par Outputs:
- *y:A Tensor of type float.
-
- *@attention Constraints: \n
- *Input images is a tensor of at least 3 dimensions. The last dimension is \n
- interpretted as channels, and must be three.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow AdjustHue operator.
- */
-
- REG_OP(AdjustHue)
- .INPUT(images, TensorType({DT_FLOAT16,DT_FLOAT}))
- .INPUT(delta, TensorType({DT_FLOAT}))
- .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT}))
- .OP_END_FACTORY_REG(AdjustHue)
-
- /**
- *@brief Adjust the saturation of one or more images.
-
- *@par Inputs:
- *Input images is a tensor of at least 3 dimensions. The last dimension is \n
- interpretted as channels, and must be three. Inputs include: \n
- *@li images:A Tensor of type float. Images to adjust. At least 3-D.
- *@li scale:A Tensor of type float. A float scale to add to the saturation.
-
- *@par Outputs:
- *y:A Tensor of type float.
-
- *@attention Constraints: \n
- *Input images is a tensor of at least 3 dimensions. The last dimension is \n
- interpretted as channels, and must be three.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow AdjustSaturation operator.
- */
-
- REG_OP(AdjustSaturation)
- .INPUT(images, TensorType({DT_FLOAT16,DT_FLOAT}))
- .INPUT(scale, TensorType({DT_FLOAT}))
- .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT}))
- .OP_END_FACTORY_REG(AdjustSaturation)
-
- /**
- *@brief Adjust the contrast of one or more images.
-
- *@par Inputs:
- *Input images is a tensor of at least 3 dimensions. The last 3 dimensions are \n
- interpreted as '[height, width, channels]'. Inputs include: \n
- *@li images:A Tensor of type float. Images to adjust. At least 3-D.
- *@li scale:A Tensor of type float. A float multiplier for adjusting contrast.
-
- *@par Outputs:
- *y:A Tensor of type float.
-
- *@attention Constraints: \n
- *Input images is a tensor of at least 3 dimensions. The last dimension is \n
- interpretted as channels, and must be three.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow AdjustContrast operator.
- */
-
- REG_OP(AdjustContrast)
- .INPUT(images, TensorType({DT_FLOAT16,DT_FLOAT}))
- .INPUT(contrast_factor, TensorType({DT_FLOAT}))
- .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT}))
- .OP_END_FACTORY_REG(AdjustContrast)
-
- /**
- *@brief Extracts crops from the input image tensor and resizes them. Extracts \n
- crops from the input image tensor and resizes them using bilinear sampling or \n
- nearest neighbor sampling to a common output size specified by crop_size.
-
- *@par Inputs:
- *Input images must be a 4-D tensor. Inputs include: \n
- *@li images:A Tensor. Must be one of the following types:uint8, uint16, int8, \n
- int16, int32, int64, float16, float, double. A 4-D tensor of shape \n
- [batch, image_height, image_width, depth].
- *@li boxes: A Tensor of type float. A 2-D tensor of shape [num_boxes, 4].
- *@li box_index: A Tensor of type int32. A 1-D tensor of shape [num_boxes] with \n
- int32 values in [0, batch).
- *@li crop_size: A Tensor of type int32. A 1-D tensor of 2 elements, crop_size \n
- = [crop_height, crop_width]. All cropped image patches are resized to this size.
-
- *@par Attributes:
- *@li extrapolation_value: An optional float. Defaults to 0. Value used for \n
- extrapolation, when applicable.
- *@li method: An optional string from: '"bilinear", "nearest"'. Defaults to \n
- "bilinear". Currently two sampling methods are supported: Bilinear and \n
- NearestNeighbor.
-
- *@par Outputs:
- *y:A Tensor of type float.
-
- *@attention Constraints: \n
- *Input images must be a 4-D tensor.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow CropAndResize operator.
- */
-
- REG_OP(CropAndResize)
- .INPUT(x, TensorType({DT_UINT8, DT_UINT16, DT_INT8, \
- DT_INT16, DT_INT32, DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .INPUT(boxes, TensorType({DT_FLOAT}))
- .INPUT(box_index, TensorType({DT_INT32}))
- .INPUT(crop_size, TensorType({DT_INT32}))
- .OUTPUT(y, TensorType({DT_FLOAT}))
- .ATTR(extrapolation_value, Float, 0)
- .ATTR(method, String, "bilinear")
- .OP_END_FACTORY_REG(CropAndResize)
-
- /**
- *@brief Computes the gradient of the crop_and_resize op wrt the input \n
- boxes tensor.
-
- *@par Inputs:
- *Input images and grads must be a 4-D tensor. Inputs include: \n
- *@li grads: A 4-D tensor of shape [num_boxes, crop_height, crop_width, depth].
- *@li images: A 4-D tensor of shape [batch, image_height, image_width, depth]. \n
- Both image_height and image_width need to be positive.
- *@li boxes: A 2-D tensor of shape [num_boxes, 4]. The i-th row of the tensor \n
- specifies the coordinates of a box in the box_ind[i] image and is specified in \n
- normalized coordinates [y1, x1, y2, x2].
- *@li box_index: A 1-D tensor of shape [num_boxes] with int32 values in \n
- [0, batch). The value of box_ind[i] specifies the image that the i-th box \n
- refers to.
-
- *@par Attributes:
- method: A string specifying the interpolation method. Only 'bilinear' is \n
- supported for now.
-
- *@par Outputs:
- *y:A 2-D tensor of shape [num_boxes, 4].
-
- *@attention Constraints: \n
- *Input images and grads must be a 4-D tensor.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow CropAndResizeGradBoxes operator.
- */
-
- REG_OP(CropAndResizeGradBoxes)
- .INPUT(grads, TensorType({DT_FLOAT}))
- .INPUT(images, TensorType({DT_UINT8, DT_UINT16, DT_INT8, DT_INT16, \
- DT_INT32, DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .INPUT(boxes, TensorType({DT_FLOAT}))
- .INPUT(box_index, TensorType({DT_INT32}))
- .OUTPUT(y, TensorType({DT_FLOAT}))
- .ATTR(method, String, "bilinear")
- .OP_END_FACTORY_REG(CropAndResizeGradBoxes)
-
- /**
- *@brief Computes the gradient of the crop_and_resize op wrt the input \n
- images tensor.
-
- *@par Inputs:
- *Input grads must be a 4-D tensor. Inputs include: \n
- *@li grads: A 4-D tensor of shape [num_boxes, crop_height, crop_width, depth].
- *@li boxes: A 2-D tensor of shape [num_boxes, 4]. The i-th row of the tensor \n
- specifies the coordinates of a box in the box_ind[i] image and is specified \n
- in normalized coordinates [y1, x1, y2, x2].
- *@li box_index: A 1-D tensor of shape [num_boxes] with int32 values in \n
- [0, batch). The value of box_ind[i] specifies the image that the i-th box \n
- refers to.
- *@li image_size: A 1-D tensor with value [batch, image_height, image_width, \n
- depth] containing the original image size. Both image_height and image_width \n
- need to be positive.
-
- *@par Attributes:
- method: A string specifying the interpolation method. Only 'bilinear' is \n
- supported for now.
-
- *@par Outputs:
- *y:A 4-D tensor of shape [batch, image_height, image_width, depth].
-
- *@attention Constraints: \n
- *Input grads must be a 4-D tensor.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow CropAndResizeGradImage operator.
- */
-
- REG_OP(CropAndResizeGradImage)
- .INPUT(grads, TensorType({DT_FLOAT}))
- .INPUT(boxes, TensorType({DT_FLOAT}))
- .INPUT(box_index, TensorType({DT_INT32}))
- .INPUT(image_size, TensorType({DT_INT32}))
- .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .ATTR(method, String, "bilinear")
- .REQUIRED_ATTR(T, Type)
- .OP_END_FACTORY_REG(CropAndResizeGradImage)
-
- /**
- *@brief Extracts a glimpse from the input tensor.
-
- *@par Inputs:
- *Input x must be a 4-D tensor. Inputs include: \n
- *@li x: A 4-D float tensor of shape [batch_size, height, width, channels].
- *@li size: A 1-D tensor of 2 elements containing the size of the glimpses to \n
- extract. The glimpse height must be specified first, following by the glimpse \n
- width.
- *@li offsets: A 2-D integer tensor of shape [batch_size, 2] containing the y, \n
- x locations of the center of each window.
-
- *@par Attributes:
- *@li centered: indicates if the offset coordinates are centered relative to \n
- the image, in which case the (0, 0) offset is relative to the center of the \n
- input images. If false, the (0,0) offset corresponds to the upper left corner \n
- of the input images.
- *@li normalized: indicates if the offset coordinates are normalized.
- *@li uniform_noise: indicates if the noise should be generated using a \n
- uniform distribution or a Gaussian distribution.
- *@li noise: indicates if the noise should uniform, gaussian, or zero. \n
- The default is uniform which means the the noise type will be decided by \n
- uniform_noise.
-
- *@par Outputs:
- *y:A tensor representing the glimpses [batch_size, glimpse_height, \n
- glimpse_width, channels].
-
- *@attention Constraints: \n
- *Input x must be a 4-D tensor.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow CropAndResizeGradImage operator.
- */
-
- REG_OP(ExtractGlimpse)
- .INPUT(x, TensorType({DT_FLOAT}))
- .INPUT(size, TensorType({DT_INT32}))
- .INPUT(offsets, TensorType({DT_FLOAT}))
- .OUTPUT(y, TensorType({DT_FLOAT}))
- .ATTR(centered, Bool, true)
- .ATTR(normalized, Bool, true)
- .ATTR(uniform_noise, Bool, true)
- .ATTR(noise, String, "uniform")
- .OP_END_FACTORY_REG(ExtractGlimpse)
-
- /**
- *@brief Convert one or more images from HSV to RGB.
-
- *@par Inputs:
- *Last dimension of input x must be size 3. Inputs include: \n
- *images: 1-D or higher rank. HSV data to convert. Last dimension must be size 3.
-
- *@par Outputs:
- *y:images converted to RGB.
-
- *@attention Constraints: \n
- *Last dimension of input x must be size 3.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow HSVToRGB operator.
- */
-
- REG_OP(HSVToRGB)
- .INPUT(images, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE}))
- .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE}))
- .OP_END_FACTORY_REG(HSVToRGB)
-
- /**
- *@brief Resize quantized images to size using quantized bilinear interpolation.
-
- *@par Inputs:
- *Input images must be a 4-D tensor. Inputs include: \n
- *@li images: 4-D with shape [batch, height, width, channels].
- *@li size: A 1-D int32 Tensor of 2 elements: new_height, new_width. The new \n
- size for the images.
- *@li min: A Tensor of type float.
- *@li max: A Tensor of type float.
-
- *@par Attributes:
- *@li align_corners: An optional bool. Defaults to False. If true, the centers \n
- of the 4 corner pixels of the input and output tensors are aligned, preserving \n
- the values at the corner pixels. Defaults to false.
- *@li half_pixel_centers: indicates if the offset coordinates are normalized.
-
- *@par Outputs:
- *@li resized_images: 4-D with shape [batch, new_height, new_width, channels].
- *@li y_min: A Tensor of type float.
- *@li y_max: A Tensor of type float.
-
- *@attention Constraints: \n
- *Input images and output images must be quantized types.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow QuantizedResizeBilinear operator.
- */
-
- REG_OP(QuantizedResizeBilinear)
- .INPUT(images, TensorType({DT_QUINT8,DT_QINT32,DT_FLOAT}))
- .INPUT(size, TensorType({ DT_INT32 }))
- .INPUT(min, TensorType({ DT_FLOAT }))
- .INPUT(max, TensorType({ DT_FLOAT }))
- .OUTPUT(resized_images, TensorType({DT_QUINT8,DT_QINT32,DT_FLOAT }))
- .OUTPUT(y_min, TensorType({ DT_FLOAT }))
- .OUTPUT(y_max, TensorType({ DT_FLOAT }))
- .ATTR(align_corners, Bool, false)
- .ATTR(half_pixel_centers, Bool, false)
- .OP_END_FACTORY_REG(QuantizedResizeBilinear)
-
- /**
- *@brief Resize images to size using area interpolation.
-
- *@par Inputs:
- *Input images must be a 4-D tensor. Inputs include: \n
- *@li images: 4-D with shape [batch, height, width, channels].
- *@li size: A 1-D int32 Tensor of 2 elements: new_height, new_width. \n
- The new size for the images.
-
- *@par Attributes:
- *align_corners: If true, the centers of the 4 corner pixels of the input and \n
- output tensors are aligned, preserving the values at the corner pixels. \n
- Defaults to false.
-
- *@par Outputs:
- *y: 4-D with shape [batch, new_height, new_width, channels].
-
- *@attention Constraints: \n
- *Input images can be of different types but output images are always float.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow ResizeArea operator.
- */
-
- REG_OP(ResizeArea)
- .INPUT(images, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, \
- DT_INT32, DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .INPUT(size, TensorType({DT_INT32}))
- .OUTPUT(y, TensorType({DT_FLOAT}))
- .ATTR(align_corners, Bool, false)
- .OP_END_FACTORY_REG(ResizeArea)
-
- /**
- *@brief Computes the gradient of bicubic interpolation.
-
- *@par Inputs:
- *Input grads must be a 4-D tensor. Inputs include: \n
- *@li grads: A Tensor of type float. 4-D with shape [batch, height, width, \n
- channels].
- *@li original_image: A Tensor. Must be one of the following types: float, \n
- double. 4-D with shape [batch, orig_height, orig_width, channels], The image \n
- tensor that was resized.
-
- *@par Attributes:
- *@li align_corners: An optional bool. Defaults to False. If true, the centers \n
- of the 4 corner pixels of the input and grad tensors are aligned. Defaults to \n
- false.
- *@li half_pixel_centers: An optional bool. Defaults to False.
-
- *@par Outputs:
- *y: A Tensor. Has the same type as original_image.
-
- *@attention Constraints: \n
- *Input images can be of different types but output images are always float.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow ResizeBicubicGrad operator.
- */
-
- REG_OP(ResizeBicubicGrad)
- .INPUT(grads, TensorType({DT_FLOAT}))
- .INPUT(original_image, TensorType({DT_FLOAT, DT_DOUBLE}))
- .OUTPUT(y, TensorType({DT_FLOAT, DT_DOUBLE}))
- .ATTR(align_corners, Bool, false)
- .ATTR(half_pixel_centers, Bool, false)
- .OP_END_FACTORY_REG(ResizeBicubicGrad)
-
- /**
- *@brief Resize images to size using bicubic interpolation.
-
- *@par Inputs:
- *Input images must be a 4-D tensor. Inputs include: \n
- *@li images: 4-D with shape [batch, height, width, channels].
- *@li size: A 1-D int32 Tensor of 2 elements: new_height, new_width. The new \n
- size for the images.
-
- *@par Attributes:
- *@li align_corners: If true, the centers of the 4 corner pixels of the input \n
- and output tensors are aligned, preserving the values at the corner pixels. \n
- Defaults to false.
- *@li half_pixel_centers: An optional bool. Defaults to False.
-
- *@par Outputs:
- *y: 4-D with shape [batch, new_height, new_width, channels].
-
- *@attention Constraints: \n
- *Input images can be of different types but output images are always float.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow ResizeBicubic operator.
- */
-
- REG_OP(ResizeBicubic)
- .INPUT(images, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, \
- DT_INT32, DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .INPUT(size, TensorType({DT_INT32}))
- .OUTPUT(y, TensorType({DT_FLOAT}))
- .ATTR(align_corners, Bool, false)
- .ATTR(half_pixel_centers, Bool, false)
- .OP_END_FACTORY_REG(ResizeBicubic)
-
- /**
- *@brief Computes the gradient of nearest neighbor interpolation.
-
- *@par Inputs:
- *Input grads must be a 4-D tensor. Inputs include: \n
- *@li grads: A Tensor. Must be one of the following types: uint8, int8, int32, \n
- float16, float, double. 4-D with shape [batch, height, width, channels].
- *@li size: A 1-D int32 Tensor of 2 elements: orig_height, orig_width. \n
- The original input size.
-
- *@par Attributes:
- *@li align_corners: An optional bool. Defaults to False. If true, the centers \n
- of the 4 corner pixels of the input and grad tensors are aligned. Defaults to \n
- false.
- *@li half_pixel_centers: An optional bool. Defaults to False.
-
- *@par Outputs:
- *y: A Tensor. Has the same type as grads.
-
- *@attention Constraints: \n
- *Input grads must be a 4-D tensor.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow ResizeNearestNeighborV2Grad operator.
- */
-
- REG_OP(ResizeNearestNeighborV2Grad)
- .INPUT(grads, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, DT_INT32,
- DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .INPUT(size, TensorType({DT_INT32}))
- .OUTPUT(y, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, DT_INT32,
- DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .ATTR(align_corners, Bool, false)
- .ATTR(half_pixel_centers, Bool, false)
- .OP_END_FACTORY_REG(ResizeNearestNeighborV2Grad)
-
- /**
- *@brief Computes the gradient of nearest neighbor interpolation.
-
- *@par Inputs:
- *Input grads must be a 4-D tensor. Inputs include: \n
- *grads: A Tensor. 4-D with shape [batch, height, width, channels].
-
-
- *@par Attributes:
- *@li align_corners: An optional bool. Defaults to False. If true, the centers \n
- of the 4 corner pixels of the input and grad tensors are aligned. Defaults to \n
- false.
- *@li size: An list type. Specify the images size.
-
- *@par Outputs:
- *y: A Tensor. Has the same type as grads.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow ResizeNearestNeighborV2GradD operator.
- */
-
- REG_OP(ResizeNearestNeighborV2GradD)
- .INPUT(grads, TensorType({DT_FLOAT}))
- .OUTPUT(y, TensorType({DT_FLOAT}))
- .REQUIRED_ATTR(size, ListInt)
- .ATTR(align_corners, Bool, false)
- .ATTR(half_pixel_centers, Bool, false)
- .OP_END_FACTORY_REG(ResizeNearestNeighborV2GradD)
-
- /**
- *@brief Computes the gradient of bilinear interpolation.
-
- *@par Inputs:
- *Input grads must be a 4-D tensor. Inputs include: \n
- *@li grads: A Tensor of type float32. 4-D with shape [batch, height, width, \n
- channels].
- *@li original_image: A Tensor. 4-D with shape [batch, orig_height, orig_width, \n
- channels], The image tensor that was resized.
-
- *@par Attributes:
- *align_corners: An optional bool. Defaults to False. If true, the centers of \n
- the 4 corner pixels of the input and grad tensors are aligned. Defaults to \n
- false.
-
- *@par Outputs:
- *y: A Tensor. Has the same type as original_image.
-
- *@attention Constraints: \n
- *Input grads must be a 4-D tensor.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow ResizeBilinearV2Grad operator.
- */
-
- REG_OP(ResizeBilinearV2Grad)
- .INPUT(grads, TensorType({DT_FLOAT}))
- .INPUT(original_image, TensorType::FloatingDataType())
- .OUTPUT(y, TensorType({DT_FLOAT}))
- .ATTR(align_corners, Bool, false)
- .ATTR(half_pixel_centers, Bool, false)
- .OP_END_FACTORY_REG(ResizeBilinearV2Grad)
-
- /**
- *@brief Resize images to size using bilinear interpolation.
-
- *@par Inputs:
- *Input images must be a 4-D tensor. Inputs include: \n
- *@li x: 4-D with shape [batch, height, width, channels].
- *@li size: A 1-D int32 Tensor of 2 elements: new_height, new_width. The new \n
- size for the images.
-
- *@par Attributes:
- *align_corners: If true, the centers of the 4 corner pixels of the input and \n
- output tensors are aligned, preserving the values at the corner pixels. \n
- Defaults to false.
-
- *@par Outputs:
- *y: 4-D with shape [batch, new_height, new_width, channels].
-
- *@attention Constraints: \n
- *Input images can be of different types but output images are always float.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow ResizeBilinearV2 operator.
- */
-
- REG_OP(ResizeBilinearV2)
- .INPUT(x, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16,
- DT_INT32, DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .INPUT(size, TensorType({DT_INT32}))
- .OUTPUT(y, TensorType({DT_FLOAT}))
- .ATTR(align_corners, Bool, false)
- .ATTR(half_pixel_centers, Bool, false)
- .OP_END_FACTORY_REG(ResizeBilinearV2)
-
- /**
- *@brief Converts one or more images from RGB to HSV.
-
- *@par Inputs:
- *Last dimension of input images must be size 3. Inputs include: \n
- *images: A Tensor. Must be one of the following types: float, double. 1-D or \n
- higher rank. RGB data to convert. Last dimension must be size 3.
-
- *@par Outputs:
- *y: A Tensor. Has the same type as images.
-
- *@attention Constraints: \n
- *Outputs a tensor of the same shape as the images tensor, containing the HSV \n
- value of the pixels. The output is only well defined if the value in images \n
- are in [0,1].
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow RGBToHSV operator.
- */
-
- REG_OP(RGBToHSV)
- .INPUT(images, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE }))
- .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE }))
- .OP_END_FACTORY_REG(RGBToHSV)
-
- /**
- *@brief Generate a single randomly distorted bounding box for an image.
-
- *@par Inputs:
- *Input images must be a 4-D tensor. Inputs include: \n
- *@li image_size: 1-D, containing [height, width, channels].
- *@li bounding_boxes: 3-D with shape [batch, N, 4] describing the N bounding \n
- boxes associated with the image.
- *@li min_object_covered: The cropped area of the image must contain at least \n
- this fraction of any bounding box supplied. The value of this parameter should \n
- be non-negative. In the case of 0, the cropped area does not need to overlap \n
- any of the bounding boxes supplied.
-
- *@par Attributes:
- *@li seed: If either seed or seed2 are set to non-zero, the random number \n
- generator is seeded by the given seed. Otherwise, it is seeded by a random seed.
- *@li seed2: A second seed to avoid seed collision.
- *@li aspect_ratio_range: The cropped area of the image must have an aspect \n
- ratio = width / height within this range.
- *@li max_attempts: Number of attempts at generating a cropped region of the \n
- image of the specified constraints. After max_attempts failures, return the \n
- entire image.
- *@li use_image_if_no_bounding_boxes: Controls behavior if no bounding boxes \n
- supplied. If true, assume an implicit bounding box covering the whole input. \n
- If false, raise an error.
-
- *@par Outputs:
- *@li begin: 1-D, containing [offset_height, offset_width, 0].
- *@li size: 1-D, containing [target_height, target_width, -1].
- *@li bboxes: 3-D with shape [1, 1, 4] containing the distorted bounding box.
-
- *@attention Constraints: \n
- *Input images can be of different types but output images are always float.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow SampleDistortedBoundingBoxExt2 operator.
- */
-
- REG_OP(SampleDistortedBoundingBoxExt2)
- .INPUT(image_size, TensorType({ DT_UINT8, DT_INT8, DT_INT16, \
- DT_INT32, DT_INT64 }))
- .INPUT(bounding_boxes, TensorType({ DT_FLOAT }))
- .INPUT(min_object_covered, TensorType({ DT_FLOAT }))
- .OUTPUT(begin, TensorType({ DT_UINT8, DT_INT8, DT_INT16, \
- DT_INT32, DT_INT64 }))
- .OUTPUT(size, TensorType({ DT_UINT8, DT_INT8, DT_INT16, \
- DT_INT32, DT_INT64 }))
- .OUTPUT(bboxes, TensorType({ DT_FLOAT }))
- .ATTR(seed, Int, 0)
- .ATTR(seed2, Int, 0)
- .ATTR(aspect_ratio_range, ListFloat, { 0.75f, 1.33f })
- .ATTR(area_range, ListFloat, { 0.05f, 1.0f })
- .ATTR(max_attempts, Int, 100)
- .ATTR(use_image_if_no_bounding_boxes, Bool, false)
- .OP_END_FACTORY_REG(SampleDistortedBoundingBoxExt2)
-
- /**
- *@brief Resize images to size using nearest neighbor interpolation.
-
- *@par Inputs:
- *Input x must be a 4-D tensor. Inputs include: \n
- *@li x: 4-D with shape [batch, height, width, channels].
- *@li size: A 1-D int32 Tensor of 2 elements: new_height, new_width. \n
- The new size for the images.
-
- *@par Attributes:
- *align_corners: If true, the centers of the 4 corner pixels of the input and \n
- output tensors are aligned, preserving the values at the corner pixels. \n
- Defaults to false.
-
- *@par Outputs:
- *y: 4-D with shape [batch, new_height, new_width, channels].
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow ResizeNearestNeighborV2 operator.
- */
-
- REG_OP(ResizeNearestNeighborV2)
- .INPUT(x, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, DT_INT32,
- DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .INPUT(size, TensorType({DT_INT32}))
- .OUTPUT(y, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, DT_INT32,
- DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .ATTR(align_corners, Bool, false)
- .ATTR(half_pixel_centers, Bool, false)
- .OP_END_FACTORY_REG(ResizeNearestNeighborV2)
-
- /**
- *@brief Draw bounding boxes on a batch of images.
-
- *@par Inputs:
- *Input images must be a 4-D tensor. Inputs include: \n
- *@li images: A Tensor. Must be one of the following types: float. 4-D with \n
- shape [batch, height, width, depth]. A batch of images.
- *@li boxes: A Tensor of type float32. 3-D with shape [batch, \n
- num_bounding_boxes, 4] containing bounding boxes.
-
- *@par Outputs:
- *A Tensor. Has the same type as images.
-
- *@attention Constraints: \n
- *Input images must be a 4-D tensor.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow DrawBoundingBoxes operator.
- */
-
- REG_OP(DrawBoundingBoxes)
- .INPUT(images, TensorType({DT_FLOAT}))
- .INPUT(boxes, TensorType({DT_FLOAT}))
- .OUTPUT(y, TensorType({DT_FLOAT}))
- .OP_END_FACTORY_REG(DrawBoundingBoxes)
-
- /**
- *@brief Greedily selects a subset of bounding boxes in descending order of \n
- score.
-
- *@par Inputs:
- *Input boxes and scores must be float type. Inputs include: \n
- *@li boxes: A 2-D float tensor of shape [num_boxes, 4].
- *@li scores: A 1-D float tensor of shape [num_boxes] representing a single \n
- score corresponding to each box (each row of boxes).
- *@li max_output_size: A scalar integer tensor representing the maximum number \n
- of boxes to be selected by non max suppression.
-
- *@par Attributes:
- *iou_threshold: A float representing the threshold for deciding whether boxes \n
- overlap too much with respect to IOU.
-
- *@par Outputs:
- *selected_indices: A 1-D integer tensor of shape [M] representing the selected \n
- indices from the boxes tensor, where M <= max_output_size.
-
- *@attention Constraints: \n
- *Input boxes and scores must be float type.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow NonMaxSuppression operator.
- */
-
- REG_OP(NonMaxSuppression)
- .INPUT(boxes, TensorType({DT_FLOAT}))
- .INPUT(scores, TensorType({DT_FLOAT}))
- .INPUT(max_output_size, TensorType({DT_INT32}))
- .OUTPUT(selected_indices, TensorType({DT_INT32}))
- .ATTR(iou_threshold, Float, 0.5f)
- .OP_END_FACTORY_REG(NonMaxSuppression)
-
- /**
- *@brief Greedily selects a subset of bounding boxes in descending order of \n
- score.
-
- *@par Inputs:
- *Input boxes and scores must be float type. Inputs include: \n
- *@li boxes: A 2-D float tensor of shape [num_boxes, 4].
- *@li scores: A 1-D float tensor of shape [num_boxes] representing a single \n
- score corresponding to each box (each row of boxes).
- *@li max_output_size: A scalar integer tensor representing the maximum number \n
- of boxes to be selected by non max suppression.
- *@li iou_threshold: A 0-D float tensor representing the threshold for deciding \n
- whether boxes overlap too much with respect to IOU.
-
- *@par Outputs:
- *selected_indices: A 1-D integer tensor of shape [M] representing the selected \n
- indices from the boxes tensor, where M <= max_output_size.
-
- *@attention Constraints: \n
- *Input boxes and scores must be float type.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow NonMaxSuppressionV2 operator.
- */
-
- REG_OP(NonMaxSuppressionV2)
- .INPUT(boxes, TensorType({DT_FLOAT16, DT_FLOAT}))
- .INPUT(scores, TensorType({DT_FLOAT16, DT_FLOAT}))
- .INPUT(max_output_size, TensorType({DT_INT32}))
- .INPUT(iou_threshold, TensorType({DT_FLOAT16,DT_FLOAT}))
- .OUTPUT(selected_indices, TensorType({DT_INT32}))
- .OP_END_FACTORY_REG(NonMaxSuppressionV2)
-
- /**
- *@brief Greedily selects a subset of bounding boxes in descending order of \n
- score.
-
- *@par Inputs:
- *Input boxes and scores must be float type. Inputs include: \n
- *@li boxes: A 2-D float tensor of shape [num_boxes, 4].
- *@li scores: A 1-D float tensor of shape [num_boxes] representing a single \n
- score corresponding to each box (each row of boxes).
- *@li max_output_size: A scalar integer tensor representing the maximum number \n
- of boxes to be selected by non max suppression.
- *@li iou_threshold: A 0-D float tensor representing the threshold for deciding \n
- whether boxes overlap too much with respect to IOU.
- *@li score_threshold: A 0-D float tensor representing the threshold for \n
- deciding when to remove boxes based on score.
-
- *@par Outputs:
- *selected_indices: A 1-D integer tensor of shape [M] representing the selected \n
- indices from the boxes tensor, where M <= max_output_size.
-
- *@attention Constraints: \n
- *Input boxes and scores must be float type.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow NonMaxSuppressionV3 operator.
- */
-
- REG_OP(NonMaxSuppressionV3)
- .INPUT(boxes, TensorType({DT_FLOAT16, DT_FLOAT}))
- .INPUT(scores, TensorType({DT_FLOAT16, DT_FLOAT}))
- .INPUT(max_output_size, TensorType({DT_INT32}))
- .INPUT(iou_threshold, TensorType({DT_FLOAT16,DT_FLOAT}))
- .INPUT(score_threshold, TensorType({DT_FLOAT16,DT_FLOAT}))
- .OUTPUT(selected_indices, TensorType({DT_INT32}))
- .OP_END_FACTORY_REG(NonMaxSuppressionV3)
-
- /**
- *@brief Greedily selects a subset of bounding boxes in descending order of \n
- score.
-
- *@par Inputs:
- *Input boxes and scores must be float type. Inputs include: \n
- *@li boxes: A 2-D float tensor of shape [num_boxes, 4].
- *@li scores: A 1-D float tensor of shape [num_boxes] representing a single \n
- score corresponding to each box (each row of boxes).
- *@li max_output_size: A scalar integer tensor representing the maximum number \n
- of boxes to be selected by non max suppression.
- *@li iou_threshold: A 0-D float tensor representing the threshold for deciding \n
- whether boxes overlap too much with respect to IOU.
- *@li score_threshold: A 0-D float tensor representing the threshold for \n
- deciding when to remove boxes based on score.
-
- *@par Attributes:
- *pad_to_max_output_size: If true, the output selected_indices is padded \n
- to be of length max_output_size. Defaults to false.
-
- *@par Outputs:
- *@li selected_indices: A 1-D integer tensor of shape [M] representing the \n
- selected indices from the boxes tensor, where M <= max_output_size.
- *@li valid_outputs: A 0-D integer tensor representing the number of valid \n
- elements in selected_indices, with the valid elements appearing first.
-
- *@attention Constraints: \n
- *Input boxes and scores must be float type.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow NonMaxSuppressionV4 operator.
- */
-
- REG_OP(NonMaxSuppressionV4)
- .INPUT(boxes, TensorType({DT_FLOAT16, DT_FLOAT}))
- .INPUT(scores, TensorType({DT_FLOAT16, DT_FLOAT}))
- .INPUT(max_output_size, TensorType({DT_INT32}))
- .INPUT(iou_threshold, TensorType({DT_FLOAT16,DT_FLOAT}))
- .INPUT(score_threshold, TensorType({DT_FLOAT16,DT_FLOAT}))
- .OUTPUT(selected_indices, TensorType({DT_INT32}))
- .OUTPUT(valid_outputs, TensorType({DT_INT32}))
- .ATTR(pad_to_max_output_size, Bool, false)
- .OP_END_FACTORY_REG(NonMaxSuppressionV4)
-
- /**
- *@brief Greedily selects a subset of bounding boxes in descending order of \n
- score.
-
- *@par Inputs:
- *Input overlaps and scores must be float type. Inputs include: \n
- *@li overlaps: A 2-D float tensor of shape [num_boxes, num_boxes] \n
- representing the n-by-n box overlap values.
- *@li scores: A 1-D float tensor of shape [num_boxes] representing a single \n
- score corresponding to each box (each row of boxes).
- *@li max_output_size: A scalar integer tensor representing the maximum number \n
- of boxes to be selected by non max suppression.
- *@li overlap_threshold: A 0-D float tensor representing the threshold for \n
- deciding whether boxes overlap too.
- *@li score_threshold: A 0-D float tensor representing the threshold for \n
- deciding when to remove boxes based on score.
-
- *@par Attributes:
- *pad_to_max_output_size: If true, the output selected_indices is padded \n
- to be of length max_output_size. Defaults to false.
-
- *@par Outputs:
- *selected_indices: A 1-D integer tensor of shape [M] representing the \n
- selected indices from the boxes tensor, where M <= max_output_size.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow NonMaxSuppressionWithOverlaps operator.
- */
-
- REG_OP(NonMaxSuppressionWithOverlaps)
- .INPUT(overlaps, TensorType({DT_FLOAT}))
- .INPUT(scores, TensorType({DT_FLOAT}))
- .INPUT(max_output_size, TensorType({DT_INT32}))
- .INPUT(overlap_threshold, TensorType({DT_FLOAT}))
- .INPUT(score_threshold, TensorType({DT_FLOAT}))
- .OUTPUT(selected_indices, TensorType({DT_INT32}))
- .OP_END_FACTORY_REG(NonMaxSuppressionWithOverlaps)
-
- /**
- *@brief JPEG-encode an image.
-
- *@par Inputs:
- *Input image must be unit8 type. Inputs include: \n
- *image: A 3-D uint8 Tensor of shape [height, width, channels].
-
- *@par Attributes:
- *@li format: Per pixel image format.
- *@li quality: Quality of the compression from 0 to 100 (higher is better \n
- and slower).
- *@li progressive: If True, create a JPEG that loads progressively (coarse \n
- to fine).
- *@li optimize_size: If True, spend CPU/RAM to reduce size with no quality \n
- change.
- *@li chroma_downsampling: A boolean, default is true.
- *@li density_unit: Unit used to specify x_density and y_density: pixels per \n
- inch ('in') or centimeter ('cm').
- *@li x_density: Horizontal pixels per density unit.
- *@li y_density: Vertical pixels per density unit.
- *@li xmp_metadata: If not empty, embed this XMP metadata in the image header.
-
- *@par Outputs:
- *contents: 0-D. JPEG-encoded image.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow EncodeJpeg operator.
- */
-
- REG_OP(EncodeJpeg)
- .INPUT(image, TensorType({DT_UINT8}))
- .OUTPUT(contents, TensorType({DT_STRING}))
- .ATTR(format, String, "")
- .ATTR(quality, Int, 95)
- .ATTR(progressive, Bool, false)
- .ATTR(optimize_size, Bool, false)
- .ATTR(chroma_downsampling, Bool, true)
- .ATTR(density_unit, String, "in")
- .ATTR(x_density, Int, 300)
- .ATTR(y_density, Int, 300)
- .ATTR(xmp_metadata, String, "")
- .OP_END_FACTORY_REG(EncodeJpeg)
-
- /**
- *@brief PNG-encode an image.
- *@par Inputs:
- *Input image must be unit8 or uint16 type. Inputs include: \n
- *image: is a 3-D uint8 or uint16 Tensor of shape [height, width, channels] \n
- where channels is: 1: for grayscale; 2: for grayscale + alpha; 3: for RGB; \n
- 4: for RGBA.
-
- *@par Attributes:
- *compression: Compression level.
-
- *@par Outputs:
- *contents: 0-D. PNG-encoded image.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow EncodePng operator.
- */
-
- REG_OP(EncodePng)
- .INPUT(image, TensorType({DT_UINT8, DT_UINT16}))
- .OUTPUT(contents, TensorType({DT_STRING}))
- .ATTR(compression, Int, -1)
- .OP_END_FACTORY_REG(EncodePng)
-
- /**
- *@brief Resizes "images" to "size" using bilinear interpolation.
-
- *@par Inputs:
- * One input:
- *x: An NC1HWC0 Tensor. \n
- * Must be one of the following types: float16, float32.
-
- *@par Attributes:
- *@li size: A required int32 Tensor specifying the new size for the images. \n
- No default value.
- *@li align_corners: An optional bool. If "true", the centers of the corner \n
- pixels of the input and output tensors are aligned. Defaults to "false".
-
- *@par Outputs:
- *y: A Tensor with type float32 and the same format as input "images".
-
- *@attention Constraints:
- *@li The input "size" must be a tensor of 2 elements: size[0] <= 2048, \n
- size[1] <= 2048.
- *@li The input "images" must be a tensor of 5 elements: images[2] <= 2048, \n
- images[3] <= 2048.
-
- *@par Third-party framework compatibility
- * Compatible with TensorFlow operator ResizeBilinearV2D.
- */
- REG_OP(ResizeBilinearV2D)
- .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT}))
- .OUTPUT(y, TensorType({DT_FLOAT}))
- .ATTR(align_corners, Bool, false)
- .ATTR(half_pixel_centers, Bool, false)
- .REQUIRED_ATTR(size, ListInt)
- .OP_END_FACTORY_REG(ResizeBilinearV2D)
-
- /**
- *@brief Resizes "images" to "size" using bilinear interpolation and keep ration at the time.
-
- *@par Inputs:
- * One input:
- *images: An NC1HWC0 Tensor. \n
- * Must be one of the following types: float16, float32.
-
- *@par Attributes:
- *@li min_dimension: A required int32 attribute for the min dimension for the images.
- * No default value.
- *@li max_dimension: A required int32 attribute for the max dimension for the images.
- * No default value.
- *@li align_corners: An optional bool. If "true", the centers of the corner
- * pixels of the input and output tensors are aligned. Defaults to "false".
- *@li half_pixel_centers: indicates if the offset coordinates are normalized
- * Defaults to "false".
-
- *@par Outputs:
- *y: A Tensor with type float32 and the same format as input "images".
-
- *@attention Constraints:
- * The input "images" must be a tensor of 5 elements: images[2] <= 2048, \n
- images[3] <= 2048.
- */
- REG_OP(KeepRationResizeBilinear)
- .INPUT(images, TensorType({DT_FLOAT16, DT_FLOAT}))
- .OUTPUT(y, TensorType({DT_FLOAT}))
- .REQUIRED_ATTR(min_dimension, Int)
- .REQUIRED_ATTR(max_dimension, Int)
- .ATTR(align_corners, Bool, false)
- .ATTR(half_pixel_centers, Bool, false)
- .OP_END_FACTORY_REG(KeepRationResizeBilinear)
-
- /**
- *@brief Resizes "images" to "size" using nearest neighbor interpolation.
-
- *@par Inputs:
- * One input:
- *x: An NC1HWC0 Tensor. \n
- * Must be one of the following types: float16, float32, int32, int8, uint8
-
- *@par Attributes:
- *@li size: A required int32 Tensor specifying the new size for the images. \n
- No default value.
- *@li align_corners: An optional bool. If "true", the centers of the corner \n
- pixels of the input and output tensors are aligned. Defaults to "false".
-
- *@par Outputs:
- *y: A Tensor with the same type and format as input "images".
-
- *@attention Constraints:
- * The input "size" must be a tensor of 2 elements: size[0] <= 7680, \n
- size[1] <= 4320
-
- *@par Third-party framework compatibility
- * Compatible with TensorFlow operator ResizeNearestNeighborV2.
- */
- REG_OP(ResizeNearestNeighborV2D)
- .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8}))
- .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8}))
- .REQUIRED_ATTR(size, ListInt)
- .ATTR(align_corners, Bool, false)
- .ATTR(half_pixel_centers, Bool, false)
- .OP_END_FACTORY_REG(ResizeNearestNeighborV2D)
-
- /**
- *@brief Extract the shape information of a JPEG-encoded image.
-
- *@par Inputs:
- *Input contents must be 0-D. Inputs include: \n
- *contents: 0-D. The JPEG-encoded image.
-
- *@par Attributes:
- *output_type: The output type of the operation (int32 or int64). Defaults \n
- to int32.
-
- *@par Outputs:
- *image_shape: 1-D. The image shape with format [height, width, channels].
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow ExtractJpegShape operator.
- */
-
- REG_OP(ExtractJpegShape)
- .INPUT(contents, TensorType({DT_STRING}))
- .OUTPUT(image_shape, TensorType({DT_INT32, DT_INT64}))
- .REQUIRED_ATTR(output_type, Type)
- .OP_END_FACTORY_REG(ExtractJpegShape)
-
- /**
- *@brief Draw bounding boxes on a batch of images.
-
- *@par Inputs:
- *@li images: 4-D with shape `[batch, height, width, depth]`. \n
- A batch of images.
- *@li boxes: 3-D with shape `[batch, num_bounding_boxes, 4]` \n
- containing bounding boxes.
- *@li colors: 2-D. A list of RGBA colors to cycle through for the boxes.
-
- *@par Outputs:
- *y: Returns 4-D with the same shape as `images`. \n
- The batch of input images with bounding boxes drawn on the images.
-
- *@par Third-party framework compatibility
- * Compatible with tensorflow DrawBoundingBoxesV2 operator.
- */
-
- REG_OP(DrawBoundingBoxesV2)
- .INPUT(images, TensorType({DT_FLOAT}))
- .INPUT(boxes, TensorType({DT_FLOAT}))
- .INPUT(colors, TensorType({DT_FLOAT}))
- .OUTPUT(y, TensorType({DT_FLOAT}))
- .OP_END_FACTORY_REG(DrawBoundingBoxesV2)
-
- /**
- *@brief Greedily selects a subset of bounding boxes in descending order of score, \n
- pruning away boxes that have high intersection-over-union (IOU) overlap \n
- with previously selected boxes.
-
- *@par Inputs:
- *@li boxes: A 2-D float tensor of shape `[num_boxes, 4]`.
- *@li scores: A 1-D float tensor of shape `[num_boxes]` representing a single \n
- score corresponding to each box (each row of boxes).
- *@li max_output_size: A scalar integer tensor representing the maximum number of \n
- boxes to be selected by non max suppression.
- *@li iou_threshold: A 0-D float tensor representing the threshold for deciding whether \n
- boxes overlap too much with respect to IOU.
- *@li score_threshold: A 0-D float tensor representing the threshold for deciding when to \n
- remove boxes based on score.
- *@li soft_nms_sigma: A 0-D float tensor representing the sigma parameter for Soft NMS.
-
- *@par Attributes:
- pad_to_max_output_size: If true, the output `selected_indices` is padded to be of length \n
- `max_output_size`. Defaults to false. If not specified, defaults to false.
-
- *@par Outputs:
- *@li selected_indices: A 1-D integer tensor of shape [M] representing the \n
- selected indices from the boxes tensor, where M <= max_output_size.
- *@li selected_scores: A 1-D float tensor of shape `[M]` representing the corresponding \n
- scores for each selected box, where `M <= max_output_size`.
- *@li valid_outputs: A 0-D integer tensor representing the number of valid \n
- elements in selected_indices, with the valid elements appearing first.
-
- *@par Third-party framework compatibility
- * Compatible with tensorflow NonMaxSuppressionV5 operator.
- */
-
- REG_OP(NonMaxSuppressionV5)
- .INPUT(boxes, TensorType({DT_FLOAT16, DT_FLOAT}))
- .INPUT(scores, TensorType({DT_FLOAT16, DT_FLOAT}))
- .INPUT(max_output_size, TensorType({DT_INT32}))
- .INPUT(iou_threshold, TensorType({DT_FLOAT16, DT_FLOAT}))
- .INPUT(score_threshold, TensorType({DT_FLOAT16, DT_FLOAT}))
- .INPUT(soft_nms_sigma, TensorType({DT_FLOAT16, DT_FLOAT}))
- .OUTPUT(selected_indices, TensorType({DT_INT32}))
- .OUTPUT(selected_scores, TensorType({DT_FLOAT16, DT_FLOAT}))
- .OUTPUT(valid_outputs, TensorType({DT_INT32}))
- .ATTR(pad_to_max_output_size, Bool, false)
- .REQUIRED_ATTR(T, Type)
- .OP_END_FACTORY_REG(NonMaxSuppressionV5)
-
- /**
- *@brief Resizes "images" to "size" by scale and translate.
-
- *@par Inputs:
- *@li images: A `Tensor`. Must be one of the following types: `int8`, `uint8`, \n
- `int16`, `uint16`, `int32`, `int64`, `bfloat16`, `half`, `float32`, `float64`.
- *@li size: A `Tensor` of type `int32`.
- *@li scale: A `Tensor` of type `float32`.
- *@li translation: A `Tensor` of type `float32`.
-
- *@par Outputs:
- *y: A Tensor with type float32.
-
- *@par Third-party framework compatibility
- * Compatible with TensorFlow ScaleAndTranslate operator.
- */
-
- REG_OP(ScaleAndTranslate)
- .INPUT(images, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16,
- DT_INT32, DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .INPUT(size, TensorType({DT_INT32}))
- .INPUT(scale, TensorType({DT_FLOAT}))
- .INPUT(translation, TensorType({DT_FLOAT}))
- .OUTPUT(y, TensorType({DT_FLOAT}))
- .ATTR(kernel_type, String, "lanczos3")
- .ATTR(antialias, Bool, true)
- .OP_END_FACTORY_REG(ScaleAndTranslate)
-
- /**
- *@brief Computes the gradient by scale and translate.
-
- *@par Inputs:
- *@li grads: A `Tensor`. Must be one of the following types: `float32`.
- *@li original_image: A `Tensor`. Must have the same type as `grads`.
- *@li scale: A `Tensor` of type `float32`.
- *@li translation: A `Tensor` of type `float32`.
-
- *@par Outputs:
- *y: A `Tensor`. Has the same type as `grads`.
-
- *@par Third-party framework compatibility
- * Compatible with TensorFlow ScaleAndTranslateGrad operator.
- */
-
- REG_OP(ScaleAndTranslateGrad)
- .INPUT(grads, TensorType({DT_FLOAT}))
- .INPUT(original_image, TensorType({DT_FLOAT}))
- .INPUT(scale, TensorType({DT_FLOAT}))
- .INPUT(translation, TensorType({DT_FLOAT}))
- .OUTPUT(y, TensorType({DT_FLOAT}))
- .ATTR(kernel_type, String, "lanczos3")
- .ATTR(antialias, Bool, true)
- .OP_END_FACTORY_REG(ScaleAndTranslateGrad)
-
- /**
- *@brief Greedily selects a subset of bounding boxes in descending order of score, \n
- This operation performs non_max_suppression on the inputs per batch, across all classes.
-
- *@par Inputs:
- *@li boxes: A 4-D float tensor of shape `[batch_size, num_boxes, q, 4]`. If `q` is 1 then \n
- same boxes are used for all classes otherwise, if `q` is equal to number of \n
- classes, class-specific boxes are used.
- *@li scores: A 3-D float tensor of shape `[batch_size, num_boxes, num_classes]` \n
- representing a single score corresponding to each box (each row of boxes).
- *@li max_output_size_per_class: A scalar integer tensor representing the maximum number of \n
- boxes to be selected by non max suppression per class.
- *@li max_total_size: A scalar representing maximum number of boxes retained over all classes. \n
- *@li iou_threshold: A 0-D float tensor representing the threshold for deciding whether \n
- boxes overlap too much with respect to IOU.
- *@li score_threshold: A 0-D float tensor representing the threshold for deciding when to remove \n
- boxes based on score.
-
- *@par Attributes:
- *@li pad_per_class: If false, the output nmsed boxes, scores and classes \n
- are padded/clipped to `max_total_size`. If true, the \n
- output nmsed boxes, scores and classes are padded to be of length \n
- `max_size_per_class`*`num_classes`, unless it exceeds `max_total_size` in \n
- which case it is clipped to `max_total_size`. Defaults to false.
- *@li clip_boxes: If true, assume the box coordinates are between [0, 1] and clip the output boxes \n
- if they fall beyond [0, 1]. If false, do not do clipping and output the box \n
- coordinates as it is. If not specified, defaults to true.
-
- *@par Outputs:
- *y: A 1-D integer tensor of shape `[M]` representing the selected \n
- indices from the boxes tensor, where `M <= max_output_size`.
-
- *@par Third-party framework compatibility
- * Compatible with tensorflow CombinedNonMaxSuppression operator.
- */
-
- REG_OP(CombinedNonMaxSuppression)
- .INPUT(boxes, TensorType({DT_FLOAT}))
- .INPUT(scores, TensorType({DT_FLOAT}))
- .INPUT(max_output_size_per_class, TensorType({DT_INT32}))
- .INPUT(max_total_size, TensorType({DT_INT32}))
- .INPUT(iou_threshold, TensorType({DT_FLOAT}))
- .INPUT(score_threshold, TensorType({DT_FLOAT}))
- .OUTPUT(nmsed_boxes, TensorType({DT_FLOAT}))
- .OUTPUT(nmsed_scores, TensorType({DT_FLOAT}))
- .OUTPUT(nmsed_classes, TensorType({DT_FLOAT}))
- .OUTPUT(valid_detections, TensorType({DT_INT32}))
- .ATTR(pad_per_class, Bool, false)
- .ATTR(clip_boxes, Bool, true)
- .OP_END_FACTORY_REG(CombinedNonMaxSuppression)
-
- REG_OP(SpatialTransformerD)
- .INPUT(x, TensorType({DT_FLOAT,DT_FLOAT16}))
- .OPTIONAL_INPUT(theta, TensorType({DT_FLOAT,DT_FLOAT16}))
- .OUTPUT(y, TensorType({DT_FLOAT,DT_FLOAT16}))
- .ATTR(output_size, ListInt, {-1, -1})
- .ATTR(default_theta, ListFloat, {})
- .ATTR(align_corners, Bool, false)
- .ATTR(use_default_theta, ListBool, {})
- .OP_END_FACTORY_REG(SpatialTransformerD)
-
- } // namespace ge
-
- #endif // GE_OP_MAGE_OPS_H_
|