|
| 1 | +# Copyright 2024 The TensorFlow Authors. All Rights Reserved. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +"""Stores big query table schema.""" |
| 16 | + |
| 17 | +from google.cloud import bigquery |
| 18 | + |
| 19 | +# Create the table within the dataset |
| 20 | +SCHEMA_1 = [ |
| 21 | + bigquery.SchemaField("detection_scores", "FLOAT", mode="REQUIRED"), |
| 22 | + bigquery.SchemaField("detection_classes_names", "STRING", mode="REQUIRED"), |
| 23 | + bigquery.SchemaField("detection_classes", "INTEGER", mode="REQUIRED"), |
| 24 | + bigquery.SchemaField("area", "INTEGER", mode="REQUIRED"), |
| 25 | + bigquery.SchemaField("bbox_0", "INTEGER", mode="REQUIRED"), |
| 26 | + bigquery.SchemaField("bbox_1", "INTEGER", mode="REQUIRED"), |
| 27 | + bigquery.SchemaField("bbox_2", "INTEGER", mode="REQUIRED"), |
| 28 | + bigquery.SchemaField("bbox_3", "INTEGER", mode="REQUIRED"), |
| 29 | + bigquery.SchemaField("convex_area", "INTEGER", mode="REQUIRED"), |
| 30 | + bigquery.SchemaField("bbox_area", "INTEGER", mode="REQUIRED"), |
| 31 | + bigquery.SchemaField("major_axis_length", "FLOAT", mode="REQUIRED"), |
| 32 | + bigquery.SchemaField("minor_axis_length", "FLOAT", mode="REQUIRED"), |
| 33 | + bigquery.SchemaField("eccentricity", "FLOAT", mode="REQUIRED"), |
| 34 | + bigquery.SchemaField("y", "FLOAT", mode="REQUIRED"), |
| 35 | + bigquery.SchemaField("x", "FLOAT", mode="REQUIRED"), |
| 36 | + bigquery.SchemaField("image_name", "STRING", mode="REQUIRED"), |
| 37 | + bigquery.SchemaField("color", "STRING", mode="REQUIRED"), |
| 38 | + bigquery.SchemaField("creation_timestamp", "STRING", mode="REQUIRED"), |
| 39 | + bigquery.SchemaField("video_name", "STRING", mode="REQUIRED"), |
| 40 | +] |
| 41 | + |
| 42 | +# Create the table for object count grouped by object class and color |
| 43 | +SCHEMA_2 = [ |
| 44 | + bigquery.SchemaField("colors_group", "STRING", mode="REQUIRED"), |
| 45 | + bigquery.SchemaField("particle", "INTEGER", mode="REQUIRED"), |
| 46 | + bigquery.SchemaField("detection_classes_group", "INTEGER", mode="REQUIRED"), |
| 47 | + bigquery.SchemaField("material", "STRING", mode="REQUIRED"), |
| 48 | + bigquery.SchemaField("material_form", "STRING", mode="REQUIRED"), |
| 49 | + bigquery.SchemaField("creation_timestamp", "STRING", mode="REQUIRED"), |
| 50 | + bigquery.SchemaField("video_name", "STRING", mode="REQUIRED"), |
| 51 | +] |
0 commit comments