- 21 Dec 2024
- 3 Minutes to read
- Print
- DarkLight
- PDF
Execute query
- Updated on 21 Dec 2024
- 3 Minutes to read
- Print
- DarkLight
- PDF
Editing an image query based on specific requirements can be crucial when finding images relevant to your dataset.
To familiarize yourself with the various catalog options and controls, refer to the Catalog article.
To open the Edit Query window, on the catalog page, click the highlighted button that displays the current view/table in context. In the below example image, all_pipelines_tables is the view that is currently in context.
The Edit Query window opens.
Query editor
The default query condition will fetch all the frames from the table/view that is in context.
The Query editor has two primary options: Conditions(for basic conditions) and Advanced. The Max frame limits the number of frames fetched by the query.
Conditions
Add Conditions: Click this option to expand the panel and add query conditions, as shown below.
Specify the query conditions by selecting the relevant options from the Column and Operation drop-down menus.
Fill in the Values field as appropriate for the condition; for example, the above screenshot shows a condition to fetch frames with dinop1_0_file_id column value greater than 100.
Click the + (plus) button to combine multiple conditions, as needed, using OR and AND as the operator.
Add Custom Conditions: If the query condition to be specified is not present as an operation in the drop-down, you can specify a custom SQL WHERE condition.
Click the down arrowhead besides the Add Conditions option, and click Add Custom Condition.
The Custom Condition field appears with an And condition, by default.
Enter the required SQL WHERE condition (as shown in the example below).
You can add a custom condition independently or along with the existing conditions.
Order by: No order is applied to the output results by default. You can specific the ordering as required.
Click the down arrowhead besides the Add Conditions option, and click Order By.
Select the required option from the Order By drop-down menu
Select Sort Order as Ascending or Descending, as needed.
Max frame limit: Once you have specified the conditions, you can use the Max frames option to select the maximum number of frames whose rows should be returned. This limit is capped to the number of frames defined in the plan limits corresponding to the subscription plan that is currently active.
Advanced conditions
Add Post Conditions: When an image has multiple rows of attributes, the default behavior on pipeline tables and views is to return all the rows corresponding to that image. For example, an image with two bounding boxes with the categories 'person' and 'car' in two rows will return both rows even if a filter condition 'category = person' matches only one row. This default behavior can be overridden using the post conditions where an additional filter on the rows of an image will be applied as per the post conditions. With 'category=person' specified as a post condition, only the row with the 'person' bounding box will be returned.
Select Resultset: Use this option to select a resultset in which the query result is restricted to the frames in the resultset. This can be used to create a visualization job on frames in a resultset.
Sequence query: For video datasets, the catalog query can be specified to return a representative frame from a sequence of frames. This result can be used to create a 'Sequence Explore' job where sequences are visualized and searched instead of individual images. The 'Sequence query' has the following additional parameters.
Length: Length of the sequence in seconds.
Stride: Gap between successive sequences. The frames in the catalog are divided into chunks, each covering 'Stride' seconds, and only one frame matching the query conditions is chosen from a stride.
Offset: Consider an event with frame X with 'category=person' ground truth. However, the sequence of interest is a 'traffic light turning green while a person is about to walk into a crosswalk. This event starts a few seconds before the frame that has 'traffic_light=green'. To support this use case, the offset specifies the number of seconds before the frame that matches the query conditions from where the sequence should be considered to start.
Run the query
To run the query according to the selected conditions, click the Query button.
To initiate a Global search for the query output, click the drop-down arrowhead besides the Query option and select Query(Global Search).