Virtual Columns
  • 23 Mar 2024
  • 2 Minutes to read
  • Dark
    Light
  • PDF

Virtual Columns

  • Dark
    Light
  • PDF

Article Summary

A virtual column is a column whose values are computed during query execution using a chosen function applied over real columns in the catalog table.  

The video below shows creating a view with virtual columns. The catalog table has a bounding box as a JSON string with 4 corner co-ordinates in the form of {"x_left":<>, "x_right":<>, "y_top":<>, "y_bottom":<>}.

  • The bounding box area is defined on a column of type bounding box.
  • The bounding box type required for the above definition is defined on the column that contains the bounding box coordinates as a JSON string.


Once the view is saved, the virtual column acts like any real column and is available as a column that can be used in query filter conditions like any other real column. For example, the gt_area column created in the above video can be used in query conditions like (gt_area > 0.5) to filter out rows with a bounding box that occupies more than 50% of the image.

Virtual column types for 2D object detection

Type nameOutputInput
AKD_2DBoundingBox
AKD_2DBoundinBoxAbs
AKD_2DBoundingBoxCOCOJSON
AKD_2DBoundingBoxJSON

A 2D bounding box defined by return type boundingbox2d
  • AKD_2DBoundingBox - Takes four individual coordinate columns with coordinate values normalized between 0 and 1.
  • AKD_2DBoundinBoxAbs - Takes four individual coordinate columns with absolute pixel values and an image height and width column.
  • AKD_2DBoundingBoxCOCOJSON - Takes a single column that holds bounding box in COCO bounding box format([x_left, y_top, box_width, box_height]) and image height and width columns.
  • AKD_2DBoundingBoxJSON - Takes a single column with a JSON string formatted bounding box coordinates normalized between 0 and 1. The JSON is in the {x_left:<>, x_right:<>, y_top:<>, y_bottom:<>} format.
AKD_2DBoundingBoxGTA 2D object detection ground truth with class and bounding box.
  • 2D Bounding box of type boundingbox2d specified using any supported input types described above.
  • A class label of type string or a mapped class type classlabelgt.
AKD_2DBoundingBoxPredA 2D object detection prediction with class, bounding box, and prediction confidence.
  • Input set 1
    • 2D Bounding box of type boundingbox2d specified using any supported input types described above.
    • A class label of type string or a mapped class type classlabelpred.
    • Prediction confidence of type float or double.
  • Input set 2
    • 2D Bounding box of type boundingbox2d specified using any supported input types described above.
    • A column that is defined using classlabelwithconfidence type that combines class label and prediction confidence.
AKD_2DBoundingBoxAreaArea of a 2D bounding box
  • 2D Bounding box of type boundingbox2d specified using any supported input types described above.

Virtual column types for segmentation

Type nameOutputInput
AKD_SegmentJsonAn instance segment represented by the type 'segment'.
  • A column with JSON that represents the segment in polygon format as [x1, y1, x2, y2,...] with (x1, y1), (x2, y2) etc being the vertex coordinates for polygon making up the segment.
  • mask_width and mask_height columns that represent the width and height of the image used to define the segment coordinates.
AKD_SegmentGtAn instance segment with a ground truth.
  • A column of type 'segment'. Currently, AKD_SegmentJson above should be used to define a segment.
  • A column with a ground truth label.
AKD_SegmentPredAn instance segment with a prediction.
  • Input set 1
    • A column of type 'segment'. Currently, AKD_SegmentJson above should be used to define a segment.
    • A class label of type string or a mapped class type classlabelpred.
    • Prediction confidence of type float or double.
  • Input set 2
    • A column of type 'segment'. Currently, AKD_SegmentJson above should be used to define a segment.
    • A column that is defined using classlabelwithconfidence type that combines class label and prediction confidence.



Was this article helpful?