neulab/docprompting-conala huggingface dataset:
tf.image.adjust_brightness     View source on GitHub    Adjust the brightness of RGB or Grayscale images.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.image.adjust_brightness  
tf.image.adjust_brightness(
    image, delta
)
 This is a convenience method that converts RGB images to float representation, adjusts their brightness, and then converts them back to the original data type. If several adjustments are chained, it is advisable to minimize the number of redundant conversions. The value delta is added to all components of the tensor image. image is converted to float and scaled appropriately if it is in fixed-point representation, and delta is converted to the same data type. For regular images, delta should be in the range (-1,1), as it is added to the image in floating point representation, where pixel values are in the [0,1) range. Usage Example: 
x = [[[1.0, 2.0, 3.0],
      [4.0, 5.0, 6.0]],
    [[7.0, 8.0, 9.0],
      [10.0, 11.0, 12.0]]]
tf.image.adjust_brightness(x, delta=0.1)
<tf.Tensor: shape=(2, 2, 3), dtype=float32, numpy=
array([[[ 1.1,  2.1,  3.1],
        [ 4.1,  5.1,  6.1]],
       [[ 7.1,  8.1,  9.1],
        [10.1, 11.1, 12.1]]], dtype=float32)>

 


 Args
  image   RGB image or images to adjust.  
  delta   A scalar. Amount to add to the pixel values.   
 


 Returns   A brightness-adjusted tensor of the same shape and type as image.
tf.image.adjust_contrast     View source on GitHub    Adjust contrast of RGB or grayscale images.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.image.adjust_contrast  
tf.image.adjust_contrast(
    images, contrast_factor
)
 This is a convenience method that converts RGB images to float representation, adjusts their contrast, and then converts them back to the original data type. If several adjustments are chained, it is advisable to minimize the number of redundant conversions. images is a tensor of at least 3 dimensions. The last 3 dimensions are interpreted as [height, width, channels]. The other dimensions only represent a collection of images, such as [batch, height, width, channels]. Contrast is adjusted independently for each channel of each image. For each channel, this Op computes the mean of the image pixels in the channel and then adjusts each component x of each pixel to (x - mean) * contrast_factor + mean. Usage Example: 
x = [[[1.0, 2.0, 3.0],
      [4.0, 5.0, 6.0]],
    [[7.0, 8.0, 9.0],
      [10.0, 11.0, 12.0]]]
tf.image.adjust_contrast(x, 2)
<tf.Tensor: shape=(2, 2, 3), dtype=float32, numpy=
array([[[-3.5, -2.5, -1.5],
        [ 2.5,  3.5,  4.5]],
       [[ 8.5,  9.5, 10.5],
        [14.5, 15.5, 16.5]]], dtype=float32)>

 


 Args
  images   Images to adjust. At least 3-D.  
  contrast_factor   A float multiplier for adjusting contrast.   
 


 Returns   The contrast-adjusted image or images.
tf.image.adjust_gamma     View source on GitHub    Performs Gamma Correction.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.image.adjust_gamma  
tf.image.adjust_gamma(
    image, gamma=1, gain=1
)
 on the input image. Also known as Power Law Transform. This function converts the input images at first to float representation, then transforms them pixelwise according to the equation Out = gain * In**gamma, and then converts the back to the original data type. Usage Example: 
x = [[[1.0, 2.0, 3.0],
      [4.0, 5.0, 6.0]],
    [[7.0, 8.0, 9.0],
      [10.0, 11.0, 12.0]]]
tf.image.adjust_gamma(x, 0.2)
<tf.Tensor: shape=(2, 2, 3), dtype=float32, numpy=
array([[[1.       , 1.1486983, 1.2457309],
        [1.319508 , 1.3797297, 1.4309691]],
       [[1.4757731, 1.5157166, 1.5518456],
        [1.5848932, 1.6153942, 1.6437519]]], dtype=float32)>

 


 Args
  image   RGB image or images to adjust.  
  gamma   A scalar or tensor. Non-negative real number.  
  gain   A scalar or tensor. The constant multiplier.   
 


 Returns   A Tensor. A Gamma-adjusted tensor of the same shape and type as image.  

 


 Raises
  ValueError   If gamma is negative.    Notes: For gamma greater than 1, the histogram will shift towards left and the output image will be darker than the input image. For gamma less than 1, the histogram will shift towards right and the output image will be brighter than the input image. References: Wikipedia
tf.image.adjust_hue     View source on GitHub    Adjust hue of RGB images.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.image.adjust_hue  
tf.image.adjust_hue(
    image, delta, name=None
)
 This is a convenience method that converts an RGB image to float representation, converts it to HSV, adds an offset to the hue channel, converts back to RGB and then back to the original data type. If several adjustments are chained it is advisable to minimize the number of redundant conversions. image is an RGB image. The image hue is adjusted by converting the image(s) to HSV and rotating the hue channel (H) by delta. The image is then converted back to RGB. delta must be in the interval [-1, 1]. Usage Example: 
x = [[[1.0, 2.0, 3.0],
      [4.0, 5.0, 6.0]],
    [[7.0, 8.0, 9.0],
      [10.0, 11.0, 12.0]]]
tf.image.adjust_hue(x, 0.2)
<tf.Tensor: shape=(2, 2, 3), dtype=float32, numpy=
array([[[ 2.3999996,  1.       ,  3.       ],
        [ 5.3999996,  4.       ,  6.       ]],
      [[ 8.4      ,  7.       ,  9.       ],
        [11.4      , 10.       , 12.       ]]], dtype=float32)>

 


 Args
  image   RGB image or images. The size of the last dimension must be 3.  
  delta   float. How much to add to the hue channel.  
  name   A name for this operation (optional).   
 


 Returns   Adjusted image(s), same shape and DType as image.  
 Usage Example: 
image = [[[1, 2, 3], [4, 5, 6]],
         [[7, 8, 9], [10, 11, 12]],
         [[13, 14, 15], [16, 17, 18]]]
image = tf.constant(image)
tf.image.adjust_hue(image, 0.2)
<tf.Tensor: shape=(3, 2, 3), dtype=int32, numpy=
array([[[ 2,  1,  3],
      [ 5,  4,  6]],
     [[ 8,  7,  9],
      [11, 10, 12]],
     [[14, 13, 15],
      [17, 16, 18]]], dtype=int32)>
tf.image.adjust_jpeg_quality     View source on GitHub    Adjust jpeg encoding quality of an image.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.image.adjust_jpeg_quality  
tf.image.adjust_jpeg_quality(
    image, jpeg_quality, name=None
)
 This is a convenience method that converts an image to uint8 representation, encodes it to jpeg with jpeg_quality, decodes it, and then converts back to the original data type. jpeg_quality must be in the interval [0, 100]. Usage Example: 
x = [[[1.0, 2.0, 3.0],
      [4.0, 5.0, 6.0]],
    [[7.0, 8.0, 9.0],
      [10.0, 11.0, 12.0]]]
tf.image.adjust_jpeg_quality(x, 75)
<tf.Tensor: shape=(2, 2, 3), dtype=float32, numpy=
array([[[1., 1., 1.],
        [1., 1., 1.]],
       [[1., 1., 1.],
        [1., 1., 1.]]], dtype=float32)>

 


 Args
  image   3D image. The size of the last dimension must be None, 1 or 3.  
  jpeg_quality   Python int or Tensor of type int32. jpeg encoding quality.  
  name   A name for this operation (optional).   
 


 Returns   Adjusted image, same shape and DType as image.  

 


 Raises
  InvalidArgumentError   quality must be in [0,100]  
  InvalidArgumentError   image must have 1 or 3 channels
tf.image.adjust_saturation     View source on GitHub    Adjust saturation of RGB images.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.image.adjust_saturation  
tf.image.adjust_saturation(
    image, saturation_factor, name=None
)
 This is a convenience method that converts RGB images to float representation, converts them to HSV, adds an offset to the saturation channel, converts back to RGB and then back to the original data type. If several adjustments are chained it is advisable to minimize the number of redundant conversions. image is an RGB image or images. The image saturation is adjusted by converting the images to HSV and multiplying the saturation (S) channel by saturation_factor and clipping. The images are then converted back to RGB. Usage Example: 
x = [[[1.0, 2.0, 3.0],
      [4.0, 5.0, 6.0]],
    [[7.0, 8.0, 9.0],
      [10.0, 11.0, 12.0]]]
tf.image.adjust_saturation(x, 0.5)
<tf.Tensor: shape=(2, 2, 3), dtype=float32, numpy=
array([[[ 2. ,  2.5,  3. ],
        [ 5. ,  5.5,  6. ]],
       [[ 8. ,  8.5,  9. ],
        [11. , 11.5, 12. ]]], dtype=float32)>

 


 Args
  image   RGB image or images. The size of the last dimension must be 3.  
  saturation_factor   float. Factor to multiply the saturation by.  
  name   A name for this operation (optional).   
 


 Returns   Adjusted image(s), same shape and DType as image.  

 


 Raises
  InvalidArgumentError   input must have 3 channels
tf.image.central_crop     View source on GitHub    Crop the central region of the image(s).  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.image.central_crop  
tf.image.central_crop(
    image, central_fraction
)
 Remove the outer parts of an image but retain the central region of the image along each dimension. If we specify central_fraction = 0.5, this function returns the region marked with "X" in the below diagram.  --------
|        |
|  XXXX  |
|  XXXX  |
|        |   where "X" is the central 50% of the image.
 --------
 This function works on either a single image (image is a 3-D Tensor), or a batch of images (image is a 4-D Tensor). Usage Example: 
x = [[[1.0, 2.0, 3.0],
      [4.0, 5.0, 6.0],
      [7.0, 8.0, 9.0],
      [10.0, 11.0, 12.0]],
    [[13.0, 14.0, 15.0],
      [16.0, 17.0, 18.0],
      [19.0, 20.0, 21.0],
      [22.0, 23.0, 24.0]],
    [[25.0, 26.0, 27.0],
      [28.0, 29.0, 30.0],
      [31.0, 32.0, 33.0],
      [34.0, 35.0, 36.0]],
    [[37.0, 38.0, 39.0],
      [40.0, 41.0, 42.0],
      [43.0, 44.0, 45.0],
      [46.0, 47.0, 48.0]]]
tf.image.central_crop(x, 0.5)
<tf.Tensor: shape=(2, 2, 3), dtype=float32, numpy=
array([[[16., 17., 18.],
        [19., 20., 21.]],
       [[28., 29., 30.],
        [31., 32., 33.]]], dtype=float32)>

 


 Args
  image   Either a 3-D float Tensor of shape [height, width, depth], or a 4-D Tensor of shape [batch_size, height, width, depth].  
  central_fraction   float (0, 1], fraction of size to crop   
 


 Raises
  ValueError   if central_crop_fraction is not within (0, 1].   
 


 Returns   3-D / 4-D float Tensor, as per the input.
tf.image.convert_image_dtype     View source on GitHub    Convert image to dtype, scaling its values if needed.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.image.convert_image_dtype  
tf.image.convert_image_dtype(
    image, dtype, saturate=False, name=None
)
 Images that are represented using floating point values are expected to have values in the range [0,1). Image data stored in integer data types are expected to have values in the range [0,MAX], where MAX is the largest positive representable number for the data type. This op converts between data types, scaling the values appropriately before casting. Note that converting from floating point inputs to integer types may lead to over/underflow problems. Set saturate to True to avoid such problem in problematic conversions. If enabled, saturation will clip the output into the allowed range before performing a potentially dangerous cast (and only before performing such a cast, i.e., when casting from a floating point to an integer type, and when casting from a signed to an unsigned type; saturate has no effect on casts between floats, or on casts that increase the type's range). Usage Example: 
x = [[[1.0, 2.0, 3.0],
      [4.0, 5.0, 6.0]],
    [[7.0, 8.0, 9.0],
      [10.0, 11.0, 12.0]]]
tf.image.convert_image_dtype(x, dtype=tf.float16, saturate=False)
<tf.Tensor: shape=(2, 2, 3), dtype=float16, numpy=
array([[[ 1.,  2.,  3.],
        [ 4.,  5.,  6.]],
       [[ 7.,  8.,  9.],
        [10., 11., 12.]]], dtype=float16)>

 


 Args
  image   An image.  
  dtype   A DType to convert image to.  
  saturate   If True, clip the input before casting (if necessary).  
  name   A name for this operation (optional).   
 


 Returns   image, converted to dtype.  

 


 Raises
  AttributeError   Raises an attribute error when dtype is neither float nor integer
tf.image.crop_to_bounding_box     View source on GitHub    Crops an image to a specified bounding box.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.image.crop_to_bounding_box  
tf.image.crop_to_bounding_box(
    image, offset_height, offset_width, target_height, target_width
)
 This op cuts a rectangular part out of image. The top-left corner of the returned image is at offset_height, offset_width in image, and its lower-right corner is at offset_height + target_height, offset_width + target_width.
 


 Args
  image   4-D Tensor of shape [batch, height, width, channels] or 3-D Tensor of shape [height, width, channels].  
  offset_height   Vertical coordinate of the top-left corner of the result in the input.  
  offset_width   Horizontal coordinate of the top-left corner of the result in the input.  
  target_height   Height of the result.  
  target_width   Width of the result.   
 


 Returns   If image was 4-D, a 4-D float Tensor of shape [batch, target_height, target_width, channels] If image was 3-D, a 3-D float Tensor of shape [target_height, target_width, channels]  

 


 Raises
  ValueError   If the shape of image is incompatible with the offset_* or target_* arguments, or either offset_height or offset_width is negative, or either target_height or target_width is not positive.
tf.image.draw_bounding_boxes     View source on GitHub    Draw bounding boxes on a batch of images. 
tf.image.draw_bounding_boxes(
    images, boxes, colors, name=None
)
 Outputs a copy of images but draws on top of the pixels zero or more bounding boxes specified by the locations in boxes. The coordinates of the each bounding box in boxes are encoded as [y_min, x_min, y_max, x_max]. The bounding box coordinates are floats in [0.0, 1.0] relative to the width and the height of the underlying image. For example, if an image is 100 x 200 pixels (height x width) and the bounding box is [0.1, 0.2, 0.5, 0.9], the upper-left and bottom-right coordinates of the bounding box will be (40, 10) to (180, 50) (in (x,y) coordinates). Parts of the bounding box may fall outside the image.
 


 Args
  images   A Tensor. Must be one of the following types: float32, half. 4-D with shape [batch, height, width, depth]. A batch of images.  
  boxes   A Tensor of type float32. 3-D with shape [batch, num_bounding_boxes, 4] containing bounding boxes.  
  colors   A Tensor of type float32. 2-D. A list of RGBA colors to cycle through for the boxes.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor. Has the same type as images.  
 Usage Example: 
# create an empty image
img = tf.zeros([1, 3, 3, 3])
# draw a box around the image
box = np.array([0, 0, 1, 1])
boxes = box.reshape([1, 1, 4])
# alternate between red and blue
colors = np.array([[1.0, 0.0, 0.0], [0.0, 0.0, 1.0]])
tf.image.draw_bounding_boxes(img, boxes, colors)
<tf.Tensor: shape=(1, 3, 3, 3), dtype=float32, numpy=
array([[[[1., 0., 0.],
        [1., 0., 0.],
        [1., 0., 0.]],
        [[1., 0., 0.],
        [0., 0., 0.],
        [1., 0., 0.]],
        [[1., 0., 0.],
        [1., 0., 0.],
        [1., 0., 0.]]]], dtype=float32)>
tf.image.extract_glimpse     View source on GitHub    Extracts a glimpse from the input tensor. 
tf.image.extract_glimpse(
    input, size, offsets, centered=True, normalized=True, noise='uniform',
    name=None
)
 Returns a set of windows called glimpses extracted at location offsets from the input tensor. If the windows only partially overlaps the inputs, the non-overlapping areas will be filled with random noise. The result is a 4-D tensor of shape [batch_size, glimpse_height, glimpse_width, channels]. The channels and batch dimensions are the same as that of the input tensor. The height and width of the output windows are specified in the size parameter. The argument normalized and centered controls how the windows are built:  If the coordinates are normalized but not centered, 0.0 and 1.0 correspond to the minimum and maximum of each height and width dimension. If the coordinates are both normalized and centered, they range from -1.0 to 1.0. The coordinates (-1.0, -1.0) correspond to the upper left corner, the lower right corner is located at (1.0, 1.0) and the center is at (0, 0). If the coordinates are not normalized they are interpreted as numbers of pixels.  Usage Example: 
x = [[[[0.0],
          [1.0],
          [2.0]],
         [[3.0],
          [4.0],
          [5.0]],
         [[6.0],
          [7.0],
          [8.0]]]]
tf.image.extract_glimpse(x, size=(2, 2), offsets=[[1, 1]],
                        centered=False, normalized=False)
<tf.Tensor: shape=(1, 2, 2, 1), dtype=float32, numpy=
array([[[[4.],
         [5.]],
        [[7.],
         [8.]]]], dtype=float32)>

 


 Args
  input   A Tensor of type float32. A 4-D float tensor of shape [batch_size, height, width, channels].  
  size   A Tensor of type int32. A 1-D tensor of 2 elements containing the size of the glimpses to extract. The glimpse height must be specified first, following by the glimpse width.  
  offsets   A Tensor of type float32. A 2-D integer tensor of shape [batch_size, 2] containing the y, x locations of the center of each window.  
  centered   An optional bool. Defaults to True. indicates if the offset coordinates are centered relative to the image, in which case the (0, 0) offset is relative to the center of the input images. If false, the (0,0) offset corresponds to the upper left corner of the input images.  
  normalized   An optional bool. Defaults to True. indicates if the offset coordinates are normalized.  
  noise   An optional string. Defaults to uniform. indicates if the noise should be uniform (uniform distribution), gaussian (gaussian distribution), or zero (zero padding).  
  name   A name for the operation (optional).   
 


 Returns   A Tensor of type float32.
tf.image.flip_left_right     View source on GitHub    Flip an image horizontally (left to right).  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.image.flip_left_right  
tf.image.flip_left_right(
    image
)
 Outputs the contents of image flipped along the width dimension. See also tf.reverse. Usage Example: 
x = [[[1.0, 2.0, 3.0],
      [4.0, 5.0, 6.0]],
    [[7.0, 8.0, 9.0],
      [10.0, 11.0, 12.0]]]
tf.image.flip_left_right(x)
<tf.Tensor: shape=(2, 2, 3), dtype=float32, numpy=
array([[[ 4.,  5.,  6.],
        [ 1.,  2.,  3.]],
       [[10., 11., 12.],
        [ 7.,  8.,  9.]]], dtype=float32)>

 


 Args
  image   4-D Tensor of shape [batch, height, width, channels] or 3-D Tensor of shape [height, width, channels].   
 


 Returns   A tensor of the same type and shape as image.  

 


 Raises
  ValueError   if the shape of image not supported.
tf.image.flip_up_down     View source on GitHub    Flip an image vertically (upside down).  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.image.flip_up_down  
tf.image.flip_up_down(
    image
)
 Outputs the contents of image flipped along the height dimension. See also reverse(). Usage Example: 
x = [[[1.0, 2.0, 3.0],
      [4.0, 5.0, 6.0]],
    [[7.0, 8.0, 9.0],
      [10.0, 11.0, 12.0]]]
tf.image.flip_up_down(x)
<tf.Tensor: shape=(2, 2, 3), dtype=float32, numpy=
array([[[ 7.,  8.,  9.],
        [10., 11., 12.]],
       [[ 1.,  2.,  3.],
        [ 4.,  5.,  6.]]], dtype=float32)>

 


 Args
  image   4-D Tensor of shape [batch, height, width, channels] or 3-D Tensor of shape [height, width, channels].   
 


 Returns   A Tensor of the same type and shape as image.  

 


 Raises
  ValueError   if the shape of image not supported.
tf.image.generate_bounding_box_proposals Generate bounding box proposals from encoded bounding boxes.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.image.generate_bounding_box_proposals  
tf.image.generate_bounding_box_proposals(
    scores, bbox_deltas, image_info, anchors, nms_threshold=0.7, pre_nms_topn=6000,
    min_size=16, post_nms_topn=300, name=None
)

 


 Args
  scores   A 4-D float Tensor of shape [num_images, height, width, num_achors] containing scores of the boxes for given anchors, can be unsorted.  
  bbox_deltas   A 4-D float Tensor of shape [num_images, height, width, 4 x num_anchors] encoding boxes with respect to each anchor. Coordinates are given in the form [dy, dx, dh, dw].  
  image_info   A 2-D float Tensor of shape [num_images, 5] containing image information Height, Width, Scale.  
  anchors   A 2-D float Tensor of shape [num_anchors, 4] describing the anchor boxes. Boxes are formatted in the form [y1, x1, y2, x2].  
  nms_threshold   A scalar float Tensor for non-maximal-suppression threshold. Defaults to 0.7.  
  pre_nms_topn   A scalar int Tensor for the number of top scoring boxes to be used as input. Defaults to 6000.  
  min_size   A scalar float Tensor. Any box that has a smaller size than min_size will be discarded. Defaults to 16.  
  post_nms_topn   An integer. Maximum number of rois in the output.  
  name   A name for this operation (optional).   
 


 Returns
  rois   Region of interest boxes sorted by their scores.  
  roi_probabilities   scores of the ROI boxes in the ROIs' Tensor.
tf.image.grayscale_to_rgb     View source on GitHub    Converts one or more images from Grayscale to RGB.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.image.grayscale_to_rgb  
tf.image.grayscale_to_rgb(
    images, name=None
)
 Outputs a tensor of the same DType and rank as images. The size of the last dimension of the output is 3, containing the RGB value of the pixels. The input images' last dimension must be size 1. 
original = tf.constant([[[1.0], [2.0], [3.0]]])
converted = tf.image.grayscale_to_rgb(original)
print(converted.numpy())
[[[1. 1. 1.]
  [2. 2. 2.]
  [3. 3. 3.]]]

 


 Args
  images   The Grayscale tensor to convert. The last dimension must be size 1.  
  name   A name for the operation (optional).   
 


 Returns   The converted grayscale image(s).
tf.image.hsv_to_rgb Convert one or more images from HSV to RGB.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.image.hsv_to_rgb  
tf.image.hsv_to_rgb(
    images, name=None
)
 Outputs a tensor of the same shape as the images tensor, containing the RGB value of the pixels. The output is only well defined if the value in images are in [0,1]. See rgb_to_hsv for a description of the HSV encoding.
 


 Args
  images   A Tensor. Must be one of the following types: half, bfloat16, float32, float64. 1-D or higher rank. HSV data to convert. Last dimension must be size 3.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor. Has the same type as images.