A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-convert-image-type below:

The ML.CONVERT_IMAGE_TYPE function | BigQuery

Stay organized with collections Save and categorize content based on your preferences.

The ML.CONVERT_IMAGE_TYPE function

This document describes the ML.CONVERT_IMAGE_TYPE scalar function, which lets you convert the data type of pixel values in an image to INT64 with a range of [0, 255). You can use ML.CONVERT_IMAGE_TYPE with the ML.PREDICT function or chain it with other functions or subqueries.

Syntax
ML.CONVERT_IMAGE_TYPE(image)
Arguments

ML.CONVERT_IMAGE_TYPE takes the following argument:

Output

ML.CONVERT_IMAGE_TYPE returns a STRUCT<ARRAY<INT64>, ARRAY<INT64>> value that represents the image.

The first array in the struct represents the dimensions of the image, and the second array in the struct contains the image data, similar to the image input argument. Each value in the second array is between [0, 255).

Note: If you reference ML.CONVERT_IMAGE_TYPE in SQL statements in the BigQuery editor, it is possible for the function output to be too large to display. If this occurs, write the output to a table instead. Example

The SSD Mobilenet V2 Object detection model model requires input to be in tf.uint8. The following example changes the pixel values for the input images from floating point numbers to integers so that they work with this model:

CREATE OR REPLACE TABLE mydataset.detections
AS (
  SELECT uri, detection_scores
  FROM
    ML.PREDICT(
      MODEL `mydataset.mobilenet`,
      SELECT
        ML.CONVERT_IMAGE_TYPE(ML.DECODE_IMAGE(data))
          AS image,
        uri
      FROM `mydataset.images`)
);
What's next

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["`ML.CONVERT_IMAGE_TYPE` is a scalar function that converts the data type of pixel values in an image to `INT64`, within the range of `[0, 255)`."],["The function takes a `STRUCT` as input, representing an image with dimensions and pixel data as arrays."],["The output of `ML.CONVERT_IMAGE_TYPE` is also a `STRUCT`, mirroring the input format, with pixel values converted to `INT64` and scaled to the `[0, 255)` range."],["The function is often used with the `ML.PREDICT` function or other functions/subqueries to preprocess image data, and it has a size limit of 60 MB for its input."],["The provided example showcases how to use `ML.CONVERT_IMAGE_TYPE` to change pixel values to work with a SSD Mobilenet V2 Object detection model."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4