Skip to content

Commit

Permalink
Merge pull request #528 from roboflow/iuri/error-on-supervision-warnings
Browse files Browse the repository at this point in the history
Fail tests on supervision warnings
  • Loading branch information
iurisilvio authored Jul 15, 2024
2 parents 614c813 + f4048ee commit af21da6
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
8 changes: 4 additions & 4 deletions inference/core/interfaces/stream/sinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from inference.core.utils.drawing import create_tiles
from inference.core.utils.preprocess import letterbox_image

DEFAULT_BBOX_ANNOTATOR = sv.BoundingBoxAnnotator()
DEFAULT_BBOX_ANNOTATOR = sv.BoxAnnotator()
DEFAULT_LABEL_ANNOTATOR = sv.LabelAnnotator()
DEFAULT_FPS_MONITOR = sv.FPSMonitor()

Expand Down Expand Up @@ -50,7 +50,7 @@ def render_boxes(
"""
Helper tool to render object detection predictions on top of video frame. It is designed
to be used with `InferencePipeline`, as sink for predictions. By default it uses
standard `sv.BoundingBoxAnnotator()` chained with `sv.LabelAnnotator()`
standard `sv.BoxAnnotator()` chained with `sv.LabelAnnotator()`
to draw bounding boxes and resizes prediction to 1280x720 (keeping aspect ratio and adding black padding).
One may configure default behaviour, for instance to display latency and throughput statistics.
In batch mode it will display tiles of frames and overlay predictions.
Expand All @@ -69,7 +69,7 @@ def render_boxes(
by `VideoSource` or list of frames from (it is possible for empty batch frames at corresponding positions
to `predictions` list). Order is expected to match with `predictions`
annotator (Union[BaseAnnotator, List[BaseAnnotator]]): instance of class inheriting from supervision BaseAnnotator
or list of such instances. If nothing is passed chain of `sv.BoundingBoxAnnotator()` and `sv.LabelAnnotator()` is used.
or list of such instances. If nothing is passed chain of `sv.BoxAnnotator()` and `sv.LabelAnnotator()` is used.
display_size (Tuple[int, int]): tuple in format (width, height) to resize visualisation output
fps_monitor (Optional[sv.FPSMonitor]): FPS monitor used to monitor throughput
display_statistics (bool): Flag to decide if throughput and latency can be displayed in the result image,
Expand Down Expand Up @@ -419,7 +419,7 @@ def init(
Args:
video_file_name (str): name of the video file to save predictions
annotator (Union[BaseAnnotator, List[BaseAnnotator]]): instance of class inheriting from supervision BaseAnnotator
or list of such instances. If nothing is passed chain of `sv.BoundingBoxAnnotator()` and `sv.LabelAnnotator()` is used.
or list of such instances. If nothing is passed chain of `sv.BoxAnnotator()` and `sv.LabelAnnotator()` is used.
display_size (Tuple[int, int]): tuple in format (width, height) to resize visualisation output. Should
be set to the same value as `display_size` for InferencePipeline with single video source, otherwise
it represents the size of single visualisation tile (whole tiles mosaic will be scaled to
Expand Down
6 changes: 3 additions & 3 deletions inference_cli/lib/infer_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import numpy as np
from supervision import (
BlurAnnotator,
BoundingBoxAnnotator,
BoxAnnotator,
BoxCornerAnnotator,
ByteTrack,
CircleAnnotator,
Expand Down Expand Up @@ -46,7 +46,7 @@
)

ANNOTATOR_TYPE2CLASS = {
"bounding_box": BoundingBoxAnnotator,
"bounding_box": BoxAnnotator,
"mask": MaskAnnotator,
"polygon": PolygonAnnotator,
"color": ColorAnnotator,
Expand Down Expand Up @@ -313,7 +313,7 @@ def is_something_to_do(
def build_visualisation_callback(
visualisation_config: Optional[str],
) -> Callable[[np.ndarray, dict], Optional[np.ndarray]]:
annotators = [BoundingBoxAnnotator()]
annotators = [BoxAnnotator()]
byte_tracker = None
if visualisation_config is not None:
raw_configuration = retrieve_visualisation_config(
Expand Down
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[pytest]
markers =
slow: marks tests as slow (deselect with '-m "not slow"')
filterwarnings =
error::supervision.utils.internal.SupervisionWarnings
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ async def run(
images_crops: Batch[Batch[WorkflowImageData]],
crops_predictions: Batch[Batch[sv.Detections]],
) -> BlockResult:
annotator = sv.BoundingBoxAnnotator()
annotator = sv.BoxAnnotator()
visualisations = []
for image_crops, crop_predictions in zip(images_crops, crops_predictions):
visualisations_batch_element = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async def run(
crops: Batch[WorkflowImageData],
crops_predictions: Batch[sv.Detections],
) -> BlockResult:
annotator = sv.BoundingBoxAnnotator()
annotator = sv.BoxAnnotator()
visualisations = []
for image, prediction in zip(crops, crops_predictions):
annotated_image = annotator.annotate(
Expand Down

0 comments on commit af21da6

Please sign in to comment.