Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ lark = "~1.1.4"
h5py = "~3.13.0"
opencv-python-headless = "~4.12.0.88"
toml = "~0.10.2"
openfoodfacts = "3.3.0"
openfoodfacts = "3.4.0"
imagehash = "~4.3.1"
peewee-migrate = "~1.12.2"
diskcache = "~5.6.3"
Expand Down
3 changes: 2 additions & 1 deletion robotoff/app/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ def on_get(self, req: falcon.Request, resp: falcon.Response):
"nms_threshold", default=None
)
nms_eta: float | None = req.get_param_as_float("nms_eta", default=None)

nms: bool = req.get_param_as_bool("nms", default=True)
available_object_detection_models = list(
ObjectDetectionModel.__members__.keys()
)
Expand Down Expand Up @@ -868,6 +868,7 @@ def on_get(self, req: falcon.Request, resp: falcon.Response):
threshold=threshold,
nms_threshold=nms_threshold,
nms_eta=nms_eta,
nms=nms,
)

if output_image:
Expand Down
6 changes: 6 additions & 0 deletions robotoff/prediction/object_detection/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class ModelConfig(BaseModel):
triton_model_name="price_tag_detection",
image_size=960,
label_names=["price-tag"],
default_threshold=0.25,
),
}

Expand All @@ -110,6 +111,8 @@ def add_boxes_and_labels(image_array: np.ndarray, result: ObjectDetectionResult)
instance_masks=None,
use_normalized_coordinates=True,
line_thickness=5,
max_boxes_to_draw=len(result.detection_boxes),
min_score_thresh=0.0,
)
image_with_boxes = Image.fromarray(image_array)
result.boxed_image = image_with_boxes
Expand All @@ -127,6 +130,7 @@ def detect_from_image(
threshold: float | None = None,
nms_threshold: float | None = None,
nms_eta: float | None = None,
nms: bool = True,
) -> ObjectDetectionResult:
"""Run an object detection model on an image.

Expand All @@ -144,6 +148,7 @@ def detect_from_image(
defaults to None (0.7 will be used).
:param nms_eta: the NMS eta parameter to use, defaults to None (1.0 will be
used).
:param nms: whether to use NMS, defaults to True.
:return: the detection result
"""
threshold = threshold or self.config.default_threshold
Expand All @@ -158,6 +163,7 @@ def detect_from_image(
threshold=threshold,
nms_threshold=nms_threshold,
nms_eta=nms_eta,
nms=nms,
)
for metric_name, duration in result.metrics.items():
ml_metrics_logger.info(
Expand Down
1 change: 1 addition & 0 deletions tests/integration/insights/test_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def detect_from_image(
threshold: float | None = 0.5,
nms_threshold: float | None = None,
nms_eta: float | None = None,
nms: bool = True,
) -> ObjectDetectionResult:
return self.raw_result

Expand Down
Loading