Search streaming video warehouse data using the command line

After you have created a Vision Warehouse, added it to an app, and deployed the app, you can search the data stored in the streaming video warehouse.

Search streaming video metadata

To search the data (assets) in your warehouse (corpus), populate the SearchAssetsRequest with the content that you would like to find. This content comes in a few different formats:

  1. criteria - Text, number, or date content provided by the user.
  2. facet_selections - Text content returned by the server, and selected by the user.
  3. content_time_ranges - Date ranges that all returned content must fall in.

In the following example, consider a Warehouse that contains security camera footage from different types of stores across the country. To retrieve all assets for the years 2018 or 2020 tagged with the annotation "state": "California", or the annotation "state":"Pennsylvania", send the following request:

REST

To search assets, send a POST request by using the projects.locations.corpora.searchAssets method.

In this sample body the criteria field use textArray values to provide two txt_values: "California" and "Pennsylvania". You can also provide search criteria for other data types. You can only specify one type of search criteria in each request.

Additional search criteria options

Integer ranges (inclusive)

    "int_range_array" : {
      "int_ranges": { "start": "5", "end": "10" }
      "int_ranges": { "start": "20", "end": "30" }
    }
    

Float ranges (inclusive)

    "float_range_array" : {
      "float_ranges": { "start": "2.6", "end": "14.3" }
      "float_ranges": { "start": "205.3", "end": "205.8" }
    }
    

Geolocations (coordinate and radius)

    "geo_location_array": {
      "circle_areas": {
        "latitude": "37.4221",
        "longitude": "122.0841",
        "radius_meter": "500"
      },
      "circle_areas": {
        "latitude": "12.46523",
        "longitude": "-95.2146",
        "radius_meter": "100"
      }
    }
    

Booleans

    "bool_value" : {
      "value": "true"
    }
    

Before using any of the request data, make the following replacements:

  • REGIONALIZED_ENDPOINT: Endpoint might include a prefix matching the LOCATION_ID such as europe-west4-. See more about regionalized endpoints.
  • PROJECT_NUMBER: Your Google Cloud project number.
  • LOCATION_ID: The region where you are using Agent Platform Vision. For example: us-central1, europe-west4. See available regions.
  • CORPUS_ID: The ID of your target corpus.

HTTP method and URL:

POST https://warehouse-visionai.googleapis.com/v1/projects/PROJECT_NUMBER/locations/LOCATION_ID/corpora/CORPUS_ID:searchAssets

Request JSON body:

{
  "page_size": "2",
  "content_time_ranges": {
    "date_time_ranges": {
      "start": {
        "year":"2018",
        "month":"1",
        "day":"1",
      },
      "end": {
        "year":"2019",
        "month":"1",
        "day":"1",
      }
    },
    "date_time_ranges": {
      "start": {
        "year":"2020",
        "month":"1",
        "day":"1",
      },
      "end": {
        "year":"2021",
        "month":"1",
        "day":"1",
      }
    }
  },
  "criteria": {
    "field": "state",
    "text_array": {
      "txt_values": "California",
      "txt_values": "Pennsylvania"
    }
  }
}

To send your request, choose one of these options: