neulab/docprompting-conala huggingface dataset:
tf.keras.applications.inception_v3.preprocess_input     View source on GitHub    Preprocesses a tensor or Numpy array encoding a batch of images.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.applications.inception_v3.preprocess_input  
tf.keras.applications.inception_v3.preprocess_input(
    x, data_format=None
)
 Usage example with applications.MobileNet: i = tf.keras.layers.Input([None, None, 3], dtype = tf.uint8)
x = tf.cast(i, tf.float32)
x = tf.keras.applications.mobilenet.preprocess_input(x)
core = tf.keras.applications.MobileNet()
x = core(x)
model = tf.keras.Model(inputs=[i], outputs=[x])

image = tf.image.decode_png(tf.io.read_file('file.png'))
result = model(image)

 


 Arguments
  x   A floating point numpy.array or a tf.Tensor, 3D or 4D with 3 color channels, with values in the range [0, 255]. The preprocessed data are written over the input data if the data types are compatible. To avoid this behaviour, numpy.copy(x) can be used.  
  data_format   Optional data format of the image tensor/array. Defaults to None, in which case the global setting tf.keras.backend.image_data_format() is used (unless you changed it, it defaults to "channels_last").   
 


 Returns   Preprocessed numpy.array or a tf.Tensor with type float32. The inputs pixel values are scaled between -1 and 1, sample-wise. 
 

 


 Raises
  ValueError   In case of unknown data_format argument.
Module: tf.keras.applications.mobilenet MobileNet v1 models for Keras. MobileNet is a general architecture and can be used for multiple use cases. Depending on the use case, it can use different input layer size and different width factors. This allows different width models to reduce the number of multiply-adds and thereby reduce inference cost on mobile devices. MobileNets support any input size greater than 32 x 32, with larger image sizes offering better performance. The number of parameters and number of multiply-adds can be modified by using the alpha parameter, which increases/decreases the number of filters in each layer. By altering the image size and alpha parameter, all 16 models from the paper can be built, with ImageNet weights provided. The paper demonstrates the performance of MobileNets using alpha values of 1.0 (also called 100 % MobileNet), 0.75, 0.5 and 0.25. For each of these alpha values, weights for 4 different input image sizes are provided (224, 192, 160, 128). The following table describes the size and accuracy of the 100% MobileNet on size 224 x 224: Width Multiplier (alpha) | ImageNet Acc | Multiply-Adds (M) | Params (M) | 1.0 MobileNet-224 | 70.6 % | 529 | 4.2 | | 0.75 MobileNet-224 | 68.4 % | 325 | 2.6 | | 0.50 MobileNet-224 | 63.7 % | 149 | 1.3 | | 0.25 MobileNet-224 | 50.6 % | 41 | 0.5 | The following table describes the performance of the 100 % MobileNet on various input sizes: Resolution      | ImageNet Acc | Multiply-Adds (M) | Params (M)
 | 1.0 MobileNet-224 | 70.6 % | 529 | 4.2 | | 1.0 MobileNet-192 | 69.1 % | 529 | 4.2 | | 1.0 MobileNet-160 | 67.2 % | 529 | 4.2 | | 1.0 MobileNet-128 | 64.4 % | 529 | 4.2 | Reference:  MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications  Functions MobileNet(...): Instantiates the MobileNet architecture. decode_predictions(...): Decodes the prediction of an ImageNet model. preprocess_input(...): Preprocesses a tensor or Numpy array encoding a batch of images.
tf.keras.applications.mobilenet.decode_predictions     View source on GitHub    Decodes the prediction of an ImageNet model.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.applications.mobilenet.decode_predictions  
tf.keras.applications.mobilenet.decode_predictions(
    preds, top=5
)

 


 Arguments
  preds   Numpy array encoding a batch of predictions.  
  top   Integer, how many top-guesses to return. Defaults to 5.   
 


 Returns   A list of lists of top class prediction tuples (class_name, class_description, score). One list of tuples per sample in batch input.  

 


 Raises
  ValueError   In case of invalid shape of the pred array (must be 2D).
tf.keras.applications.mobilenet.preprocess_input     View source on GitHub    Preprocesses a tensor or Numpy array encoding a batch of images.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.applications.mobilenet.preprocess_input  
tf.keras.applications.mobilenet.preprocess_input(
    x, data_format=None
)
 Usage example with applications.MobileNet: i = tf.keras.layers.Input([None, None, 3], dtype = tf.uint8)
x = tf.cast(i, tf.float32)
x = tf.keras.applications.mobilenet.preprocess_input(x)
core = tf.keras.applications.MobileNet()
x = core(x)
model = tf.keras.Model(inputs=[i], outputs=[x])

image = tf.image.decode_png(tf.io.read_file('file.png'))
result = model(image)

 


 Arguments
  x   A floating point numpy.array or a tf.Tensor, 3D or 4D with 3 color channels, with values in the range [0, 255]. The preprocessed data are written over the input data if the data types are compatible. To avoid this behaviour, numpy.copy(x) can be used.  
  data_format   Optional data format of the image tensor/array. Defaults to None, in which case the global setting tf.keras.backend.image_data_format() is used (unless you changed it, it defaults to "channels_last").   
 


 Returns   Preprocessed numpy.array or a tf.Tensor with type float32. The inputs pixel values are scaled between -1 and 1, sample-wise. 
 

 


 Raises
  ValueError   In case of unknown data_format argument.
Module: tf.keras.applications.mobilenet_v2 MobileNet v2 models for Keras. MobileNetV2 is a general architecture and can be used for multiple use cases. Depending on the use case, it can use different input layer size and different width factors. This allows different width models to reduce the number of multiply-adds and thereby reduce inference cost on mobile devices. MobileNetV2 is very similar to the original MobileNet, except that it uses inverted residual blocks with bottlenecking features. It has a drastically lower parameter count than the original MobileNet. MobileNets support any input size greater than 32 x 32, with larger image sizes offering better performance. The number of parameters and number of multiply-adds can be modified by using the alpha parameter, which increases/decreases the number of filters in each layer. By altering the image size and alpha parameter, all 22 models from the paper can be built, with ImageNet weights provided. The paper demonstrates the performance of MobileNets using alpha values of 1.0 (also called 100 % MobileNet), 0.35, 0.5, 0.75, 1.0, 1.3, and 1.4 For each of these alpha values, weights for 5 different input image sizes are provided (224, 192, 160, 128, and 96). The following table describes the performance of MobileNet on various input sizes: MACs stands for Multiply Adds Classification Checkpoint|MACs (M)|Parameters (M)|Top 1 Accuracy|Top 5 Accuracy --------------------------|------------|---------------|---------|----|--------- | [mobilenet_v2_1.4_224] | 582 | 6.06 | 75.0 | 92.5 | | [mobilenet_v2_1.3_224] | 509 | 5.34 | 74.4 | 92.1 | | [mobilenet_v2_1.0_224] | 300 | 3.47 | 71.8 | 91.0 | | [mobilenet_v2_1.0_192] | 221 | 3.47 | 70.7 | 90.1 | | [mobilenet_v2_1.0_160] | 154 | 3.47 | 68.8 | 89.0 | | [mobilenet_v2_1.0_128] | 99 | 3.47 | 65.3 | 86.9 | | [mobilenet_v2_1.0_96] | 56 | 3.47 | 60.3 | 83.2 | | [mobilenet_v2_0.75_224] | 209 | 2.61 | 69.8 | 89.6 | | [mobilenet_v2_0.75_192] | 153 | 2.61 | 68.7 | 88.9 | | [mobilenet_v2_0.75_160] | 107 | 2.61 | 66.4 | 87.3 | | [mobilenet_v2_0.75_128] | 69 | 2.61 | 63.2 | 85.3 | | [mobilenet_v2_0.75_96] | 39 | 2.61 | 58.8 | 81.6 | | [mobilenet_v2_0.5_224] | 97 | 1.95 | 65.4 | 86.4 | | [mobilenet_v2_0.5_192] | 71 | 1.95 | 63.9 | 85.4 | | [mobilenet_v2_0.5_160] | 50 | 1.95 | 61.0 | 83.2 | | [mobilenet_v2_0.5_128] | 32 | 1.95 | 57.7 | 80.8 | | [mobilenet_v2_0.5_96] | 18 | 1.95 | 51.2 | 75.8 | | [mobilenet_v2_0.35_224] | 59 | 1.66 | 60.3 | 82.9 | | [mobilenet_v2_0.35_192] | 43 | 1.66 | 58.2 | 81.2 | | [mobilenet_v2_0.35_160] | 30 | 1.66 | 55.7 | 79.1 | | [mobilenet_v2_0.35_128] | 20 | 1.66 | 50.8 | 75.0 | | [mobilenet_v2_0.35_96] | 11 | 1.66 | 45.5 | 70.4 | Reference:  
MobileNetV2: Inverted Residuals and Linear Bottlenecks (CVPR 2018)  Functions MobileNetV2(...): Instantiates the MobileNetV2 architecture. decode_predictions(...): Decodes the prediction of an ImageNet model. preprocess_input(...): Preprocesses a tensor or Numpy array encoding a batch of images.
tf.keras.applications.mobilenet_v2.decode_predictions     View source on GitHub    Decodes the prediction of an ImageNet model.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.applications.mobilenet_v2.decode_predictions  
tf.keras.applications.mobilenet_v2.decode_predictions(
    preds, top=5
)

 


 Arguments
  preds   Numpy array encoding a batch of predictions.  
  top   Integer, how many top-guesses to return. Defaults to 5.   
 


 Returns   A list of lists of top class prediction tuples (class_name, class_description, score). One list of tuples per sample in batch input.  

 


 Raises
  ValueError   In case of invalid shape of the pred array (must be 2D).
tf.keras.applications.mobilenet_v2.preprocess_input     View source on GitHub    Preprocesses a tensor or Numpy array encoding a batch of images.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.applications.mobilenet_v2.preprocess_input  
tf.keras.applications.mobilenet_v2.preprocess_input(
    x, data_format=None
)
 Usage example with applications.MobileNet: i = tf.keras.layers.Input([None, None, 3], dtype = tf.uint8)
x = tf.cast(i, tf.float32)
x = tf.keras.applications.mobilenet.preprocess_input(x)
core = tf.keras.applications.MobileNet()
x = core(x)
model = tf.keras.Model(inputs=[i], outputs=[x])

image = tf.image.decode_png(tf.io.read_file('file.png'))
result = model(image)

 


 Arguments
  x   A floating point numpy.array or a tf.Tensor, 3D or 4D with 3 color channels, with values in the range [0, 255]. The preprocessed data are written over the input data if the data types are compatible. To avoid this behaviour, numpy.copy(x) can be used.  
  data_format   Optional data format of the image tensor/array. Defaults to None, in which case the global setting tf.keras.backend.image_data_format() is used (unless you changed it, it defaults to "channels_last").   
 


 Returns   Preprocessed numpy.array or a tf.Tensor with type float32. The inputs pixel values are scaled between -1 and 1, sample-wise. 
 

 


 Raises
  ValueError   In case of unknown data_format argument.
Module: tf.keras.applications.mobilenet_v3 MobileNet v3 models for Keras. Functions decode_predictions(...): Decodes the prediction of an ImageNet model. preprocess_input(...): Preprocesses a tensor or Numpy array encoding a batch of images.
tf.keras.applications.mobilenet_v3.decode_predictions Decodes the prediction of an ImageNet model.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.applications.mobilenet_v3.decode_predictions  
tf.keras.applications.mobilenet_v3.decode_predictions(
    preds, top=5
)

 


 Arguments
  preds   Numpy array encoding a batch of predictions.  
  top   Integer, how many top-guesses to return. Defaults to 5.   
 


 Returns   A list of lists of top class prediction tuples (class_name, class_description, score). One list of tuples per sample in batch input.  

 


 Raises
  ValueError   In case of invalid shape of the pred array (must be 2D).
tf.keras.applications.mobilenet_v3.preprocess_input Preprocesses a tensor or Numpy array encoding a batch of images.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.applications.mobilenet_v3.preprocess_input  
tf.keras.applications.mobilenet_v3.preprocess_input(
    x, data_format=None
)
 Usage example with applications.MobileNet: i = tf.keras.layers.Input([None, None, 3], dtype = tf.uint8)
x = tf.cast(i, tf.float32)
x = tf.keras.applications.mobilenet.preprocess_input(x)
core = tf.keras.applications.MobileNet()
x = core(x)
model = tf.keras.Model(inputs=[i], outputs=[x])

image = tf.image.decode_png(tf.io.read_file('file.png'))
result = model(image)

 


 Arguments
  x   A floating point numpy.array or a tf.Tensor, 3D or 4D with 3 color channels, with values in the range [0, 255]. The preprocessed data are written over the input data if the data types are compatible. To avoid this behaviour, numpy.copy(x) can be used.  
  data_format   Optional data format of the image tensor/array. Defaults to None, in which case the global setting tf.keras.backend.image_data_format() is used (unless you changed it, it defaults to "channels_last").   
 


 Returns   Preprocessed numpy.array or a tf.Tensor with type float32. The inputs pixel values are scaled between -1 and 1, sample-wise. 
 

 


 Raises
  ValueError   In case of unknown data_format argument.
Module: tf.keras.applications.nasnet NASNet-A models for Keras. NASNet refers to Neural Architecture Search Network, a family of models that were designed automatically by learning the model architectures directly on the dataset of interest. Here we consider NASNet-A, the highest performance model that was found for the CIFAR-10 dataset, and then extended to ImageNet 2012 dataset, obtaining state of the art performance on CIFAR-10 and ImageNet 2012. Only the NASNet-A models, and their respective weights, which are suited for ImageNet 2012 are provided. The below table describes the performance on ImageNet 2012: Architecture       | Top-1 Acc | Top-5 Acc |  Multiply-Adds |  Params (M)
 | NASNet-A (4 @ 1056) | 74.0 % | 91.6 % | 564 M | 5.3 | | NASNet-A (6 @ 4032) | 82.7 % | 96.2 % | 23.8 B | 88.9 | Reference:  
Learning Transferable Architectures for Scalable Image Recognition (CVPR 2018)  Functions NASNetLarge(...): Instantiates a NASNet model in ImageNet mode. NASNetMobile(...): Instantiates a Mobile NASNet model in ImageNet mode. decode_predictions(...): Decodes the prediction of an ImageNet model. preprocess_input(...): Preprocesses a tensor or Numpy array encoding a batch of images.
tf.keras.applications.nasnet.decode_predictions     View source on GitHub    Decodes the prediction of an ImageNet model.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.applications.nasnet.decode_predictions  
tf.keras.applications.nasnet.decode_predictions(
    preds, top=5
)

 


 Arguments
  preds   Numpy array encoding a batch of predictions.  
  top   Integer, how many top-guesses to return. Defaults to 5.   
 


 Returns   A list of lists of top class prediction tuples (class_name, class_description, score). One list of tuples per sample in batch input.  

 


 Raises
  ValueError   In case of invalid shape of the pred array (must be 2D).
tf.keras.applications.nasnet.preprocess_input     View source on GitHub    Preprocesses a tensor or Numpy array encoding a batch of images.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.applications.nasnet.preprocess_input  
tf.keras.applications.nasnet.preprocess_input(
    x, data_format=None
)
 Usage example with applications.MobileNet: i = tf.keras.layers.Input([None, None, 3], dtype = tf.uint8)
x = tf.cast(i, tf.float32)
x = tf.keras.applications.mobilenet.preprocess_input(x)
core = tf.keras.applications.MobileNet()
x = core(x)
model = tf.keras.Model(inputs=[i], outputs=[x])

image = tf.image.decode_png(tf.io.read_file('file.png'))
result = model(image)

 


 Arguments
  x   A floating point numpy.array or a tf.Tensor, 3D or 4D with 3 color channels, with values in the range [0, 255]. The preprocessed data are written over the input data if the data types are compatible. To avoid this behaviour, numpy.copy(x) can be used.  
  data_format   Optional data format of the image tensor/array. Defaults to None, in which case the global setting tf.keras.backend.image_data_format() is used (unless you changed it, it defaults to "channels_last").   
 


 Returns   Preprocessed numpy.array or a tf.Tensor with type float32. The inputs pixel values are scaled between -1 and 1, sample-wise. 
 

 


 Raises
  ValueError   In case of unknown data_format argument.
tf.keras.applications.NASNetLarge     View source on GitHub    Instantiates a NASNet model in ImageNet mode.  View aliases  Main aliases 
tf.keras.applications.nasnet.NASNetLarge Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.applications.NASNetLarge, tf.compat.v1.keras.applications.nasnet.NASNetLarge  
tf.keras.applications.NASNetLarge(
    input_shape=None, include_top=True, weights='imagenet',
    input_tensor=None, pooling=None, classes=1000
)
 Reference:  
Learning Transferable Architectures for Scalable Image Recognition (CVPR 2018)  Optionally loads weights pre-trained on ImageNet. Note that the data format convention used by the model is the one specified in your Keras config at ~/.keras/keras.json. 
Note: each Keras Application expects a specific kind of input preprocessing. For NASNet, call tf.keras.applications.nasnet.preprocess_input on your inputs before passing them to the model.

 


 Arguments
  input_shape   Optional shape tuple, only to be specified if include_top is False (otherwise the input shape has to be (331, 331, 3) for NASNetLarge. It should have exactly 3 inputs channels, and width and height should be no smaller than 32. E.g. (224, 224, 3) would be one valid value.  
  include_top   Whether to include the fully-connected layer at the top of the network.  
  weights   None (random initialization) or imagenet (ImageNet weights) For loading imagenet weights, input_shape should be (331, 331, 3)  
  input_tensor   Optional Keras tensor (i.e. output of layers.Input()) to use as image input for the model.  
  pooling   Optional pooling mode for feature extraction when include_top is False.  
None means that the output of the model will be the 4D tensor output of the last convolutional layer. 
avg means that global average pooling will be applied to the output of the last convolutional layer, and thus the output of the model will be a 2D tensor. 
max means that global max pooling will be applied. 

 
  classes   Optional number of classes to classify images into, only to be specified if include_top is True, and if no weights argument is specified.   
 


 Returns   A Keras model instance.  

 


 Raises
  ValueError   in case of invalid argument for weights, or invalid input shape.  
  RuntimeError   If attempting to run this model with a backend that does not support separable convolutions.
tf.keras.applications.NASNetMobile     View source on GitHub    Instantiates a Mobile NASNet model in ImageNet mode.  View aliases  Main aliases 
tf.keras.applications.nasnet.NASNetMobile Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.applications.NASNetMobile, tf.compat.v1.keras.applications.nasnet.NASNetMobile  
tf.keras.applications.NASNetMobile(
    input_shape=None, include_top=True, weights='imagenet',
    input_tensor=None, pooling=None, classes=1000
)
 Reference:  
Learning Transferable Architectures for Scalable Image Recognition (CVPR 2018)  Optionally loads weights pre-trained on ImageNet. Note that the data format convention used by the model is the one specified in your Keras config at ~/.keras/keras.json. 
Note: each Keras Application expects a specific kind of input preprocessing. For NASNet, call tf.keras.applications.nasnet.preprocess_input on your inputs before passing them to the model.

 


 Arguments
  input_shape   Optional shape tuple, only to be specified if include_top is False (otherwise the input shape has to be (224, 224, 3) for NASNetMobile It should have exactly 3 inputs channels, and width and height should be no smaller than 32. E.g. (224, 224, 3) would be one valid value.  
  include_top   Whether to include the fully-connected layer at the top of the network.  
  weights   None (random initialization) or imagenet (ImageNet weights) For loading imagenet weights, input_shape should be (224, 224, 3)  
  input_tensor   Optional Keras tensor (i.e. output of layers.Input()) to use as image input for the model.  
  pooling   Optional pooling mode for feature extraction when include_top is False.  
None means that the output of the model will be the 4D tensor output of the last convolutional layer. 
avg means that global average pooling will be applied to the output of the last convolutional layer, and thus the output of the model will be a 2D tensor. 
max means that global max pooling will be applied. 

 
  classes   Optional number of classes to classify images into, only to be specified if include_top is True, and if no weights argument is specified.   
 


 Returns   A Keras model instance.  

 


 Raises
  ValueError   In case of invalid argument for weights, or invalid input shape.  
  RuntimeError   If attempting to run this model with a backend that does not support separable convolutions.
Module: tf.keras.applications.resnet ResNet models for Keras. Reference:  
Deep Residual Learning for Image Recognition (CVPR 2015)  Functions ResNet101(...): Instantiates the ResNet101 architecture. ResNet152(...): Instantiates the ResNet152 architecture. ResNet50(...): Instantiates the ResNet50 architecture. decode_predictions(...): Decodes the prediction of an ImageNet model. preprocess_input(...): Preprocesses a tensor or Numpy array encoding a batch of images.
tf.keras.applications.resnet.decode_predictions     View source on GitHub    Decodes the prediction of an ImageNet model.  View aliases  Main aliases 
tf.keras.applications.resnet50.decode_predictions Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.applications.resnet.decode_predictions, tf.compat.v1.keras.applications.resnet50.decode_predictions  
tf.keras.applications.resnet.decode_predictions(
    preds, top=5
)

 


 Arguments
  preds   Numpy array encoding a batch of predictions.  
  top   Integer, how many top-guesses to return. Defaults to 5.   
 


 Returns   A list of lists of top class prediction tuples (class_name, class_description, score). One list of tuples per sample in batch input.  

 


 Raises
  ValueError   In case of invalid shape of the pred array (must be 2D).
tf.keras.applications.resnet.preprocess_input     View source on GitHub    Preprocesses a tensor or Numpy array encoding a batch of images.  View aliases  Main aliases 
tf.keras.applications.resnet50.preprocess_input Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.applications.resnet.preprocess_input, tf.compat.v1.keras.applications.resnet50.preprocess_input  
tf.keras.applications.resnet.preprocess_input(
    x, data_format=None
)
 Usage example with applications.MobileNet: i = tf.keras.layers.Input([None, None, 3], dtype = tf.uint8)
x = tf.cast(i, tf.float32)
x = tf.keras.applications.mobilenet.preprocess_input(x)
core = tf.keras.applications.MobileNet()
x = core(x)
model = tf.keras.Model(inputs=[i], outputs=[x])

image = tf.image.decode_png(tf.io.read_file('file.png'))
result = model(image)

 


 Arguments
  x   A floating point numpy.array or a tf.Tensor, 3D or 4D with 3 color channels, with values in the range [0, 255]. The preprocessed data are written over the input data if the data types are compatible. To avoid this behaviour, numpy.copy(x) can be used.  
  data_format   Optional data format of the image tensor/array. Defaults to None, in which case the global setting tf.keras.backend.image_data_format() is used (unless you changed it, it defaults to "channels_last").   
 


 Returns   Preprocessed numpy.array or a tf.Tensor with type float32. The images are converted from RGB to BGR, then each color channel is zero-centered with respect to the ImageNet dataset, without scaling. 
 

 


 Raises
  ValueError   In case of unknown data_format argument.