frameworks.grounding_dino.services.predictor¶
predictor
¶
Classes:
| Name | Description |
|---|---|
GroundingDinoDetectionModelPredictor |
A predictor class to run GroundingDINO inference for object detection. |
GroundingDinoDetectionModelPredictor(model, label_names, box_threshold=0.5, text_threshold=0.5)
¶
Bases: ModelPredictor
A predictor class to run GroundingDINO inference for object detection. Converts results into PicselliaRectanglePrediction objects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
GroundingDinoModel
|
Loaded GroundingDINO model. |
required |
|
list[str]
|
list of class names to detect. |
required |
Methods:
| Name | Description |
|---|---|
run_inference_on_batches |
|
post_process_batches |
|
pre_process_dataset |
Extracts all image paths from the dataset's image directory. |
prepare_batches |
|
get_picsellia_label |
Get or create a PicselliaLabel from a dataset category name. |
get_picsellia_confidence |
Wrap a confidence score in a PicselliaConfidence object. |
get_picsellia_rectangle |
Create a PicselliaRectangle from bounding box coordinates. |
Attributes:
| Name | Type | Description |
|---|---|---|
model |
|
|
label_names |
|
|
box_threshold |
|
|
text_threshold |
|
model = model
instance-attribute
¶
label_names = label_names
instance-attribute
¶
box_threshold = box_threshold
instance-attribute
¶
text_threshold = text_threshold
instance-attribute
¶
run_inference_on_batches(image_batches)
¶
post_process_batches(image_batches, batch_results, dataset)
¶
pre_process_dataset(dataset)
¶
Extracts all image paths from the dataset's image directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
TBaseDataset
|
The dataset object containing the image directory. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
list[str]: A list of file paths to the dataset images. |
prepare_batches(image_paths, batch_size)
¶
get_picsellia_label(category_name, dataset)
¶
Get or create a PicselliaLabel from a dataset category name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
The name of the label category. |
required |
|
TBaseDataset
|
Dataset that provides label access. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
PicselliaLabel |
PicselliaLabel
|
Wrapped label object. |
get_picsellia_confidence(confidence)
¶
Wrap a confidence score in a PicselliaConfidence object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
float
|
Prediction confidence score. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
PicselliaConfidence |
PicselliaConfidence
|
Wrapped confidence object. |
get_picsellia_rectangle(x, y, w, h)
¶
Create a PicselliaRectangle from bounding box coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
int
|
Top-left x-coordinate. |
required |
|
int
|
Top-left y-coordinate. |
required |
|
int
|
Width of the box. |
required |
|
int
|
Height of the box. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
PicselliaRectangle |
PicselliaRectangle
|
Rectangle wrapper for object detection. |