Text Prompt Detection

Description

This operator uses a text-prompt detection model to achieve open-vocabulary object detection. It does not require pre-training on specific object categories. As long as an object can be described in text, it can potentially be detected. Based on the English text prompts (words or sentences) entered by the user, it detects objects corresponding to the text description in the image and outputs their bounding boxes, categories, and confidence scores.

Overview

Locates objects in color images from English text prompts and outputs detection boxes.

Scenarios

  • Open-Vocabulary Detection: Detects new categories of objects not included in the training set, as long as they can be described in English. For example, "the red apple on the table" or "person wearing a hat".

  • Fine-Grained Detection: Distinguishes objects based on more specific descriptions. For example, distinguishing "cat" from "dog", or "sedan" from "truck".

  • Attribute-Specific Detection: Detects objects with specific attributes. For example, "the open door" or "a blue chair".

Inputs and Outputs

Inputs

Image: The color image to be detected (requires RGB format). Currently, only single image input is supported.

Outputs

Detection Results: A list containing detection results. Each result represents a detected instance, containing its bounding box (usually a horizontal box), confidence score, assigned category ID (based on the category mapping parameter), and corresponding polygon contour (same as the bounding box).

Parameters

Initialization Parameters

Weight File

Description

Selects the weight file used for text-prompt detection.

Tuning Instructions

The weight file must be compatible with the current operator version. Select an appropriate file based on detection quality, runtime, and available device resources.

Download Links

Parameter Range

Options: .pth

Parameter Range

Values/Range:

  • .pth

Enable GPU Acceleration

Description

Controls whether model inference runs on a GPU or CPU.

Tuning Instructions

When enabled, CUDA is preferred; inference falls back to CPU if CUDA is unavailable.

Parameter Range

Default: False

Use FP16

Description

Controls whether CUDA AMP FP16 half precision is used for inference computation; this only takes effect when GPU is enabled. CPU inference always uses FP32 and is not affected by this parameter.

Tuning Instructions

Enabling it can reduce GPU memory usage and improve inference speed, but it only provides an actual speedup on graphics cards with Tensor Cores. If the GPU is detected to lack Tensor Core support (e.g., some entry-level or older models), the program automatically falls back to FP32 inference and shows a notice, so there is no need to manually disable this parameter.

Parameter Range

Default: True

Language Model Path

Description

Specifies the local language-model directory required for text-prompt detection.

Tuning Instructions

This path is used when the built-in resource directory is unavailable. If the path is empty or invalid, the operator attempts to download the required resources.

Parameter Range

Default: None

Run Parameters

Text Prompts

Description

Provides English words or phrases used to find objects.

Tuning Instructions

Content is required; separate multiple targets with English periods or commas.

Parameter Range

Default:

Category Mapping

Description

Assigns output class numbers in prompt order.

Tuning Instructions

Separate numbers with English periods or commas; if too few are provided, zero-based numbers are assigned in prompt order.

Parameter Range

Default:

Box Confidence Threshold

Description

Sets the minimum score for retaining candidate detection boxes.

Tuning Instructions

Only candidate boxes scoring above this value proceed to text-phrase matching.

Parameter Range

[0.0, 1.0], Default: 0.3

Parameter Range

Values/Range: [0.0, 1.0]

Default: 0.3

Category Confidence Threshold

Description

Sets the matching threshold used to extract text phrases from candidates.

Tuning Instructions

After a box passes filtering, tokens scoring above this value are used to form its phrase.

Parameter Range

[0.0, 1.0], Default: 0.25

Parameter Range

Values/Range: [0.0, 1.0]

Default: 0.25