Release details
Version
0.1.0
Released
June 27, 2026
License
MIT
Requires
Python 3.10+
Interfaces
Python library and command-line interface (CLI)
Contents
Abstract
Prompt-conditioned object localization with Gemini, exposed through a Python library and CLI. Prompt2Box converts structured model responses into image-space detections for inspection, export, and evaluation.
Problem formulation
Given an image I with width W and height H, and a text query q, the task is to return a variable-length set of detections D = {(ℓᵢ, bᵢ)}. Each label ℓᵢ names an object, and each bᵢ is an axis-aligned bounding box in the original image’s pixel coordinates.
Prompt2Box delegates visual inference to Gemini and implements the surrounding image, response, and coordinate adapters. The library does not train or fine-tune a detector. Its contribution is an explicit interface between a prompt-conditioned model response and objects that can be inspected, cropped, serialized, and evaluated.
1234Input: image I, original dimensions (W, H), text query qOutput: D = {(label_i, box_i)} for i = 1,…,Nbox_i = (x_min, y_min, x_max, y_max), in image pixelsN varies with the model response and the supplied query
Figure 1. Example image with manually placed bounding boxes for a text query. The boxes explain the output format and are not model predictions or measured results.
System architecture and methods
Implementation reviewed November 24, 2026 against the repository’s mutable main branch. The mechanisms and examples below describe that inspected implementation, not a pinned contract for release 0.1.0. The request combines image bytes, the query, and a response schema containing label and box_2d fields. The inspected implementation requests JSON output and sets temperature to zero. These settings constrain the request and response format; they do not establish semantic correctness or identical outputs across runs.
The response adapter prefers the SDK’s parsed result and falls back to parsing response text. It skips candidates with malformed box shape or non-numeric coordinates, then scales valid coordinates, rounds them, clamps them to image bounds, and orders the endpoints. The architecture separates this local processing from the external model service.
Figure 2. One request sends image bytes, a text query, and a response schema to Gemini. Prompt2Box then parses normalized boxes and maps them to the source-image dimensions using the retained original width and height. Rendering, JSON export, cropping, and optional refinement run locally and make no further model request.
Preparing the model input
The upload size and the source-image size serve different purposes. The image adapter retains the original width and height, then reduces images whose longest edge exceeds max_image_size. The default limit is 1536 pixels; a value of zero disables this resizing.
When resizing, PNG inputs remain PNG, including an existing alpha channel. Other resized inputs are encoded as JPEG. Images below the size limit are sent as their original bytes, and format detection uses the decoded image where available.
Valid structure and correct objects
A response schema specifies a label and four box coordinates, while the instruction specifies what to look for. The parser can recover a JSON array from response text when a parsed SDK result is unavailable. A candidate must contain four numeric coordinates before it can be converted into a Detection.
These checks establish a usable representation. They cannot establish that an object exists, that the label is appropriate, or that the box encloses the intended object. Those questions require reference annotations or human inspection.
Installation and model access
Use Python 3.10 or newer. The repository documents installation from source and authentication with a Gemini API key. Keep the key in an environment variable rather than including it in application source.
123456git clone https://github.com/hebula-labs/Prompt2Boxcd Prompt2Boxpython -m pip install .export GEMINI_API_KEY="YOUR_GEMINI_API_KEY"prompt2box desk.jpg
Detection makes a request to Gemini and requires network access and valid credentials. The repository also documents a Vertex AI authentication path. API access, quotas, and usage costs are separate from the MIT license for the library.
Runtime dependencies and image support
The package uses google-genai for model requests, Pillow for image operations, and Pydantic for the response schema. HEIC and HEIF decoding requires the optional heic extra. Install only the extras needed for the images in your workflow.
Image bytes and the query are sent to the configured Gemini service for inference. JSON export, rendering, cropping, and refinement operate locally after detection. Review the selected provider’s data-handling terms before supplying sensitive images.
Programmatic interfaces
The detect function maps a local image and query specification to a DetectionResult. Supply classes for an explicit label set or prompt for a free-form instruction. When both are supplied, the implementation gives prompt precedence. Each returned Detection exposes a label and a pixel-space box.
123456789101112from prompt2box import detectresult = detect("desk.jpg",classes=["laptop", "camera", "book"],)for detection in result:print(detection.label, detection.box)result.save_annotated("desk_annotated.jpg")print(result.to_json())
The CLI exposes the same detection workflow as a process boundary. It can write an annotated image and a JSON artifact, making the output inspectable without requiring downstream code to parse free-form model text.
123prompt2box desk.jpg -c laptop camera bookprompt2box desk.jpg -p "only the plants"prompt2box desk.jpg -o desk_annotated.jpg -j detections.json
Inspecting and cropping regions
A Detection exposes its pixel-space box, width, height, area, and center. DetectionResult supports iteration, indexing, slicing, and label filtering. Its filter method performs a case-insensitive substring match rather than enforcing a separate class taxonomy.
Use Detection.crop with the original image path to extract a region. A crop contains every pixel inside the rectangle, including background and other objects. Keep the label and coordinates with the crop so a later reviewer can recover its context.
Figure 3. Manually selected camera and book regions from the example photograph. Crops retain source pixels and surrounding background; they do not confirm an object label.
12345678910from prompt2box import detectresult = detect("desk.jpg", classes=["camera"])for index, detection in enumerate(result):detection.crop("desk.jpg", f"crops/region_{index}.jpg")print(detection.label, detection.box, detection.area)# The exported coordinates remain in the source-image frame.print(result.to_json())
Spatial representation and numerical conventions
The model contract uses box_2d = [ymin, xmin, ymax, xmax] on a normalized 0–1000 grid with a top-left origin. The Python geometry contract uses box = (x_min, y_min, x_max, y_max) in source-image pixels. The axis order changes as well as the coordinate scale.
Conversion uses x_px = round(W × x_norm / 1000) and y_px = round(H × y_norm / 1000). Endpoints are clamped to the image dimensions and ordered along each axis. Retaining W and H from the original image is therefore part of the data contract, even when the uploaded image is resized.
Figure 4. Response fields and coordinate conventions used by Prompt2Box. The model returns normalized coordinates in y, x order; the local adapter maps them to source-image pixels in x, y order. A structured response constrains the format, not localization accuracy.
Figure 5. Worked example for a 1600 × 900 image: normalized [200, 250, 700, 750] becomes pixel box (400, 180, 1200, 630). These are illustrative values, not a detector response.
DetectionResult preserves the collection of detections and provides JSON, rendering, and crop operations. The inspected Detection representation contains labels and geometry, rather than a calibrated confidence score. The illustrative JSON below makes the coordinate conventions explicit.
12345678910[{"label": "example object","x_min": 400,"y_min": 180,"x_max": 1200,"y_max": 630,"box_normalized": [200, 250, 700, 750]}]
Resize settings and coordinate granularity
Changing the upload resolution does not change which dimensions the adapter uses for the returned box: it scales normalized coordinates with the original W and H. It can change the information available to the model, particularly for small or occluded objects. Compare resize settings empirically instead of inferring unchanged accuracy from normalized coordinates.
Before rounding, one step on the normalized grid corresponds to W/1000 pixels horizontally and H/1000 vertically. For a 1600 × 900 image, those steps are 1.6 and 0.9 pixels. This describes coordinate granularity, not a bound on the model’s localization error.
Figure 6. For an illustrative 1600 × 900 image, x = 1.6u and y = 0.9v before rounding and clamping; u and v are the corresponding normalized coordinates. These are exact geometric mappings, not measured localization results. No model uncertainty is estimated.
Figure 7. Illustrative 1600 × 900 source and an 800 × 450 upload produced with max_image_size = 800; the default limit of 1536 would send 1536 × 864. The coordinate adapter uses the original dimensions when reconstructing boxes. The figure does not claim unchanged model predictions after resizing.
Post-processing contract
Refinement is a deterministic local operation over detections and the original image dimensions. Its configurable criteria include area limits, label exclusions, and duplicate overlap. It does not issue another model request.
The operation returns a new DetectionResult and leaves the original result unchanged. Removed detections are retained in dropped with a reason. This gives downstream evaluation access to both the retained output and the removal decisions, without interpreting a geometric filter as a confidence estimate.
123456789from prompt2box import detectresult = detect("scene.jpg")clean = result.refine()for detection, reason in clean.dropped:print(detection.label, reason)clean.save_annotated("scene_refined.jpg")
Area limits and related-label duplicates
The RefineConfig defaults are min_area_frac=0.0, max_area_frac=0.92, dedup_iou=0.90, and an empty drop_labels tuple. Area fractions divide box area by image area. A zero minimum disables the small-box rule, while a box covering more than 92% of the image exceeds the default maximum.
After label and area filtering, survivors are considered from largest to smallest. A related label is identified by a case-insensitive substring comparison in either direction. When overlap reaches the duplicate threshold, the larger box remains and the smaller box receives a removal reason.
These are geometric and text-matching heuristics. Nearby objects with related labels can still need separate boxes, and a whole-image box may be meaningful for some tasks. Set the policy for the task, inspect dropped detections, and evaluate raw and refined outputs separately.
Figure 8. Two authored boxes with related labels have an IoU of approximately 0.93. With the default 0.90 duplicate threshold, the larger box is retained and the smaller box is recorded in dropped with a reason. This illustrates the rule, not a model output.
12345678910111213from prompt2box import RefineConfig, detectraw = detect("desk.jpg")policy = RefineConfig(min_area_frac=0.0,max_area_frac=0.92,dedup_iou=0.90,drop_labels=(),)clean = raw.refine(policy)for detection, reason in clean.dropped:print(detection.label, reason)
Concurrency and failure isolation
The batch interface uses a thread pool. With library-managed connections, workers use their own SDK clients. Results are returned in input order, and a failed image occupies a None slot rather than aborting the entire batch. Check this state explicitly before exporting or aggregating results.
12345678910111213141516from prompt2box import Detectorimages = ["street_01.jpg", "street_02.jpg"]with Detector() as detector:results = detector.detect_batch(images,classes=["car", "truck", "bus"],max_workers=4,)for path, result in zip(images, results):if result is None:print("Detection failed:", path)continueprint(path, result.labels)
Request failures and detection errors have different meanings from an empty but successful detection set. The implementation applies bounded exponential backoff to retryable request failures; terminal failures propagate in a single-image call and are isolated to the corresponding slot in a batch.
Keep failure states separate
A None entry in batch output records a failed image. A successful result with zero detections is a different state and should remain distinguishable in stored records. Preserve the input path, request settings, and failure state when aggregating a run.
The reusable Detector owns and closes clients it creates. If an application supplies its own SDK client, the application retains responsibility for that client’s lifecycle and thread safety. Increasing worker count changes request concurrency; it is not a guarantee of higher throughput under provider quotas.
Evaluation protocol and reproducibility
Evaluate prompt-conditioned localization on a versioned set of images and reference annotations representative of the intended task. Fix the label policy, query construction, and matching rules before collecting results. Separate localization quality from response-format validity and operational reliability.
Intersection over Union measures the spatial overlap of a predicted and reference box. A detection metric also requires an explicit overlap threshold, label-matching policy, and assignment rule. Report missed objects and duplicate predictions as well as matched boxes, and compare raw and refined outputs under the same protocol.
Figure 9. Intersection over Union is the shared area of two boxes divided by the area of their union, which counts the shared area once. This illustration explains the metric and does not report project performance.
For a reproducible comparison, define the following before collecting results:
Data and labels. Version the image set and reference annotations. Declare which labels count as matches, and stratify errors by relevant scene conditions such as object size and occlusion.
Controlled settings. Record the exact software version, model identifier, input-image hash, query, resize setting, and refinement configuration. Repeat calls when measuring response variability.
Localization and detection. Declare the IoU threshold and one-to-one assignment policy. Report precision and recall under that policy, and evaluate raw and refined detections separately.
Operational observations. Measure request latency, observed usage cost, retry counts, and failed calls separately from localization metrics. Preserve failures in the evaluation record instead of silently excluding them.
Matching rules and reported metrics
The repository harness uses greedy, one-to-one matching. For each reference box, it selects the highest-IoU unused prediction whose label passes a case-insensitive substring comparison. A match must reach the configured IoU threshold, which defaults to 0.5.
Matched pairs count as true positives, unused predictions as false positives, and unmatched reference objects as false negatives. Precision is TP/(TP+FP), recall is TP/(TP+FN), and mean IoU is calculated over matched pairs. Mean IoU alone therefore does not describe missed objects.
The bundled example manifest contains approximate placeholder annotations. Its sample output is illustrative and should not be presented as a Hebula benchmark. Replace those annotations with reviewed reference boxes before reporting an evaluation result.
12345# Supply a manifest with reviewed reference annotations.python eval/iou_eval.py eval/manifest.json --iou 0.5# Alternatively, use the documented Vertex AI backend.python eval/iou_eval.py eval/manifest.json --vertex --iou 0.5
Limits of the current interface
Prompt2Box returns labeled, axis-aligned rectangles. It does not provide instance masks, calibrated confidence values, or a task-specific accuracy guarantee. Treat ambiguous labels, duplicate regions, small objects, and occlusion as separate error categories during review.
Detection depends on a remote model, so latency, failures, usage cost, and variation between calls belong in the evaluation record. The geometric examples on this page explain the interface. They are not substitutes for measurements on a reviewed dataset.
Source, release, and research context
Prompt2Box 0.1.0 was released June 27, 2026 under the MIT license. It is independent open-source software that uses Gemini, not a Google product.
Hebula studies how models interpret visual information and how agents make decisions under risk and uncertainty. We use Prompt2Box to study how precisely a model can locate an object described in words.
Explore the project
Explore the source code on GitHub or read how Prompt2Box locates objects from a text prompt.
Release details
Version
0.1.0
Released
June 27, 2026
License
MIT
Requires
Python 3.10+
Interfaces
Python library and command-line interface (CLI)
Contents
Abstract
Prompt-conditioned object localization with Gemini, exposed through a Python library and CLI. Prompt2Box converts structured model responses into image-space detections for inspection, export, and evaluation.
Problem formulation
Given an image I with width W and height H, and a text query q, the task is to return a variable-length set of detections D = {(ℓᵢ, bᵢ)}. Each label ℓᵢ names an object, and each bᵢ is an axis-aligned bounding box in the original image’s pixel coordinates.
Prompt2Box delegates visual inference to Gemini and implements the surrounding image, response, and coordinate adapters. The library does not train or fine-tune a detector. Its contribution is an explicit interface between a prompt-conditioned model response and objects that can be inspected, cropped, serialized, and evaluated.
1234Input: image I, original dimensions (W, H), text query qOutput: D = {(label_i, box_i)} for i = 1,…,Nbox_i = (x_min, y_min, x_max, y_max), in image pixelsN varies with the model response and the supplied query
Swipe to view the full figure.
Figure 1. Example image with manually placed bounding boxes for a text query. The boxes explain the output format and are not model predictions or measured results.
System architecture and methods
Implementation reviewed November 24, 2026 against the repository’s mutable main branch. The mechanisms and examples below describe that inspected implementation, not a pinned contract for release 0.1.0. The request combines image bytes, the query, and a response schema containing label and box_2d fields. The inspected implementation requests JSON output and sets temperature to zero. These settings constrain the request and response format; they do not establish semantic correctness or identical outputs across runs.
The response adapter prefers the SDK’s parsed result and falls back to parsing response text. It skips candidates with malformed box shape or non-numeric coordinates, then scales valid coordinates, rounds them, clamps them to image bounds, and orders the endpoints. The architecture separates this local processing from the external model service.
Swipe to view the full figure.
Figure 2. One request sends image bytes, a text query, and a response schema to Gemini. Prompt2Box then parses normalized boxes and maps them to the source-image dimensions using the retained original width and height. Rendering, JSON export, cropping, and optional refinement run locally and make no further model request.
Preparing the model input
The upload size and the source-image size serve different purposes. The image adapter retains the original width and height, then reduces images whose longest edge exceeds max_image_size. The default limit is 1536 pixels; a value of zero disables this resizing.
When resizing, PNG inputs remain PNG, including an existing alpha channel. Other resized inputs are encoded as JPEG. Images below the size limit are sent as their original bytes, and format detection uses the decoded image where available.
Valid structure and correct objects
A response schema specifies a label and four box coordinates, while the instruction specifies what to look for. The parser can recover a JSON array from response text when a parsed SDK result is unavailable. A candidate must contain four numeric coordinates before it can be converted into a Detection.
These checks establish a usable representation. They cannot establish that an object exists, that the label is appropriate, or that the box encloses the intended object. Those questions require reference annotations or human inspection.
Installation and model access
Use Python 3.10 or newer. The repository documents installation from source and authentication with a Gemini API key. Keep the key in an environment variable rather than including it in application source.
123456git clone https://github.com/hebula-labs/Prompt2Boxcd Prompt2Boxpython -m pip install .export GEMINI_API_KEY="YOUR_GEMINI_API_KEY"prompt2box desk.jpg
Detection makes a request to Gemini and requires network access and valid credentials. The repository also documents a Vertex AI authentication path. API access, quotas, and usage costs are separate from the MIT license for the library.
Runtime dependencies and image support
The package uses google-genai for model requests, Pillow for image operations, and Pydantic for the response schema. HEIC and HEIF decoding requires the optional heic extra. Install only the extras needed for the images in your workflow.
Image bytes and the query are sent to the configured Gemini service for inference. JSON export, rendering, cropping, and refinement operate locally after detection. Review the selected provider’s data-handling terms before supplying sensitive images.
Programmatic interfaces
The detect function maps a local image and query specification to a DetectionResult. Supply classes for an explicit label set or prompt for a free-form instruction. When both are supplied, the implementation gives prompt precedence. Each returned Detection exposes a label and a pixel-space box.
123456789101112from prompt2box import detectresult = detect("desk.jpg",classes=["laptop", "camera", "book"],)for detection in result:print(detection.label, detection.box)result.save_annotated("desk_annotated.jpg")print(result.to_json())
The CLI exposes the same detection workflow as a process boundary. It can write an annotated image and a JSON artifact, making the output inspectable without requiring downstream code to parse free-form model text.
123prompt2box desk.jpg -c laptop camera bookprompt2box desk.jpg -p "only the plants"prompt2box desk.jpg -o desk_annotated.jpg -j detections.json
Inspecting and cropping regions
A Detection exposes its pixel-space box, width, height, area, and center. DetectionResult supports iteration, indexing, slicing, and label filtering. Its filter method performs a case-insensitive substring match rather than enforcing a separate class taxonomy.
Use Detection.crop with the original image path to extract a region. A crop contains every pixel inside the rectangle, including background and other objects. Keep the label and coordinates with the crop so a later reviewer can recover its context.
Swipe to view the full figure.
Figure 3. Manually selected camera and book regions from the example photograph. Crops retain source pixels and surrounding background; they do not confirm an object label.
12345678910from prompt2box import detectresult = detect("desk.jpg", classes=["camera"])for index, detection in enumerate(result):detection.crop("desk.jpg", f"crops/region_{index}.jpg")print(detection.label, detection.box, detection.area)# The exported coordinates remain in the source-image frame.print(result.to_json())
Spatial representation and numerical conventions
The model contract uses box_2d = [ymin, xmin, ymax, xmax] on a normalized 0–1000 grid with a top-left origin. The Python geometry contract uses box = (x_min, y_min, x_max, y_max) in source-image pixels. The axis order changes as well as the coordinate scale.
Conversion uses x_px = round(W × x_norm / 1000) and y_px = round(H × y_norm / 1000). Endpoints are clamped to the image dimensions and ordered along each axis. Retaining W and H from the original image is therefore part of the data contract, even when the uploaded image is resized.
Swipe to view the full figure.
Figure 4. Response fields and coordinate conventions used by Prompt2Box. The model returns normalized coordinates in y, x order; the local adapter maps them to source-image pixels in x, y order. A structured response constrains the format, not localization accuracy.
Swipe to view the full figure.
Figure 5. Worked example for a 1600 × 900 image: normalized [200, 250, 700, 750] becomes pixel box (400, 180, 1200, 630). These are illustrative values, not a detector response.
DetectionResult preserves the collection of detections and provides JSON, rendering, and crop operations. The inspected Detection representation contains labels and geometry, rather than a calibrated confidence score. The illustrative JSON below makes the coordinate conventions explicit.
12345678910[{"label": "example object","x_min": 400,"y_min": 180,"x_max": 1200,"y_max": 630,"box_normalized": [200, 250, 700, 750]}]
Resize settings and coordinate granularity
Changing the upload resolution does not change which dimensions the adapter uses for the returned box: it scales normalized coordinates with the original W and H. It can change the information available to the model, particularly for small or occluded objects. Compare resize settings empirically instead of inferring unchanged accuracy from normalized coordinates.
Before rounding, one step on the normalized grid corresponds to W/1000 pixels horizontally and H/1000 vertically. For a 1600 × 900 image, those steps are 1.6 and 0.9 pixels. This describes coordinate granularity, not a bound on the model’s localization error.
Swipe to view the full figure.
Figure 6. For an illustrative 1600 × 900 image, x = 1.6u and y = 0.9v before rounding and clamping; u and v are the corresponding normalized coordinates. These are exact geometric mappings, not measured localization results. No model uncertainty is estimated.
Swipe to view the full figure.
Figure 7. Illustrative 1600 × 900 source and an 800 × 450 upload produced with max_image_size = 800; the default limit of 1536 would send 1536 × 864. The coordinate adapter uses the original dimensions when reconstructing boxes. The figure does not claim unchanged model predictions after resizing.
Post-processing contract
Refinement is a deterministic local operation over detections and the original image dimensions. Its configurable criteria include area limits, label exclusions, and duplicate overlap. It does not issue another model request.
The operation returns a new DetectionResult and leaves the original result unchanged. Removed detections are retained in dropped with a reason. This gives downstream evaluation access to both the retained output and the removal decisions, without interpreting a geometric filter as a confidence estimate.
123456789from prompt2box import detectresult = detect("scene.jpg")clean = result.refine()for detection, reason in clean.dropped:print(detection.label, reason)clean.save_annotated("scene_refined.jpg")
Area limits and related-label duplicates
The RefineConfig defaults are min_area_frac=0.0, max_area_frac=0.92, dedup_iou=0.90, and an empty drop_labels tuple. Area fractions divide box area by image area. A zero minimum disables the small-box rule, while a box covering more than 92% of the image exceeds the default maximum.
After label and area filtering, survivors are considered from largest to smallest. A related label is identified by a case-insensitive substring comparison in either direction. When overlap reaches the duplicate threshold, the larger box remains and the smaller box receives a removal reason.
These are geometric and text-matching heuristics. Nearby objects with related labels can still need separate boxes, and a whole-image box may be meaningful for some tasks. Set the policy for the task, inspect dropped detections, and evaluate raw and refined outputs separately.
Swipe to view the full figure.
Figure 8. Two authored boxes with related labels have an IoU of approximately 0.93. With the default 0.90 duplicate threshold, the larger box is retained and the smaller box is recorded in dropped with a reason. This illustrates the rule, not a model output.
12345678910111213from prompt2box import RefineConfig, detectraw = detect("desk.jpg")policy = RefineConfig(min_area_frac=0.0,max_area_frac=0.92,dedup_iou=0.90,drop_labels=(),)clean = raw.refine(policy)for detection, reason in clean.dropped:print(detection.label, reason)
Concurrency and failure isolation
The batch interface uses a thread pool. With library-managed connections, workers use their own SDK clients. Results are returned in input order, and a failed image occupies a None slot rather than aborting the entire batch. Check this state explicitly before exporting or aggregating results.
12345678910111213141516from prompt2box import Detectorimages = ["street_01.jpg", "street_02.jpg"]with Detector() as detector:results = detector.detect_batch(images,classes=["car", "truck", "bus"],max_workers=4,)for path, result in zip(images, results):if result is None:print("Detection failed:", path)continueprint(path, result.labels)
Request failures and detection errors have different meanings from an empty but successful detection set. The implementation applies bounded exponential backoff to retryable request failures; terminal failures propagate in a single-image call and are isolated to the corresponding slot in a batch.
Keep failure states separate
A None entry in batch output records a failed image. A successful result with zero detections is a different state and should remain distinguishable in stored records. Preserve the input path, request settings, and failure state when aggregating a run.
The reusable Detector owns and closes clients it creates. If an application supplies its own SDK client, the application retains responsibility for that client’s lifecycle and thread safety. Increasing worker count changes request concurrency; it is not a guarantee of higher throughput under provider quotas.
Evaluation protocol and reproducibility
Evaluate prompt-conditioned localization on a versioned set of images and reference annotations representative of the intended task. Fix the label policy, query construction, and matching rules before collecting results. Separate localization quality from response-format validity and operational reliability.
Intersection over Union measures the spatial overlap of a predicted and reference box. A detection metric also requires an explicit overlap threshold, label-matching policy, and assignment rule. Report missed objects and duplicate predictions as well as matched boxes, and compare raw and refined outputs under the same protocol.
Swipe to view the full figure.
Figure 9. Intersection over Union is the shared area of two boxes divided by the area of their union, which counts the shared area once. This illustration explains the metric and does not report project performance.
For a reproducible comparison, define the following before collecting results:
Data and labels. Version the image set and reference annotations. Declare which labels count as matches, and stratify errors by relevant scene conditions such as object size and occlusion.
Controlled settings. Record the exact software version, model identifier, input-image hash, query, resize setting, and refinement configuration. Repeat calls when measuring response variability.
Localization and detection. Declare the IoU threshold and one-to-one assignment policy. Report precision and recall under that policy, and evaluate raw and refined detections separately.
Operational observations. Measure request latency, observed usage cost, retry counts, and failed calls separately from localization metrics. Preserve failures in the evaluation record instead of silently excluding them.
Matching rules and reported metrics
The repository harness uses greedy, one-to-one matching. For each reference box, it selects the highest-IoU unused prediction whose label passes a case-insensitive substring comparison. A match must reach the configured IoU threshold, which defaults to 0.5.
Matched pairs count as true positives, unused predictions as false positives, and unmatched reference objects as false negatives. Precision is TP/(TP+FP), recall is TP/(TP+FN), and mean IoU is calculated over matched pairs. Mean IoU alone therefore does not describe missed objects.
The bundled example manifest contains approximate placeholder annotations. Its sample output is illustrative and should not be presented as a Hebula benchmark. Replace those annotations with reviewed reference boxes before reporting an evaluation result.
12345# Supply a manifest with reviewed reference annotations.python eval/iou_eval.py eval/manifest.json --iou 0.5# Alternatively, use the documented Vertex AI backend.python eval/iou_eval.py eval/manifest.json --vertex --iou 0.5
Limits of the current interface
Prompt2Box returns labeled, axis-aligned rectangles. It does not provide instance masks, calibrated confidence values, or a task-specific accuracy guarantee. Treat ambiguous labels, duplicate regions, small objects, and occlusion as separate error categories during review.
Detection depends on a remote model, so latency, failures, usage cost, and variation between calls belong in the evaluation record. The geometric examples on this page explain the interface. They are not substitutes for measurements on a reviewed dataset.
Source, release, and research context
Prompt2Box 0.1.0 was released June 27, 2026 under the MIT license. It is independent open-source software that uses Gemini, not a Google product.
Hebula studies how models interpret visual information and how agents make decisions under risk and uncertainty. We use Prompt2Box to study how precisely a model can locate an object described in words.
Explore the project
Explore the source code on GitHub or read how Prompt2Box locates objects from a text prompt.
More from Hebula
//
[#hebula]
&
[#research]
//
[#hebula]
&
[#research]
//
[#hebula]
&
[#research]
//
[#hebula]
&
[#research]
Research and collaboration
Have a research question?
Tell us what you’d like to test.
//
[#hebula]
&
[#research]
//
[#hebula]
&
[#research]
//
[#hebula]
&
[#research]
//
[#hebula]
&
[#research]
//
[#hebula]
&
[#research]
//
[#hebula]
&
[#research]
//
[#hebula]
&
[#research]
//
[#hebula]
&
[#research]
//
[#hebula]
&
[#research]
Research and collaboration
Have a research question?
Tell us what you’d like to test.
//
[#hebula]
&
[#research]
//
[#hebula]
&
[#research]
//
[#hebula]
&
[#research]
//
[#hebula]
&
[#research]
//
[#hebula]
&
[#research]
//
[#hebula]
&
[#research]
//
[#hebula]
&
[#research]
//
[#hebula]
&
[#research]
//
[#hebula]
&
[#research]
Research and collaboration
Have a research question?
Tell us what you’d like to test.
//
[#hebula]
&
[#research]
//
[#hebula]
&
[#research]
//
[#hebula]
&
[#research]
//
[#hebula]
&
[#research]
//
[#hebula]
&
[#research]




