diff --git a/docs/examples/_server.py b/docs/examples/_server.py index 4902ab5d1..ed408604a 100644 --- a/docs/examples/_server.py +++ b/docs/examples/_server.py @@ -295,7 +295,7 @@ async def TagsByFilter(self, stream: Stream[TagsByFilterRequest, TagsByFilterRes async def AddBoundingBoxToImageByID(self, stream: Stream[AddBoundingBoxToImageByIDRequest, AddBoundingBoxToImageByIDResponse]) -> None: pass - async def UpdateBoundingBoxToImageByID(self, stream: Stream[UpdateBoundingBoxRequest, UpdateBoundingBoxResponse]) -> None: + async def UpdateBoundingBox(self, stream: Stream[UpdateBoundingBoxRequest, UpdateBoundingBoxResponse]) -> None: pass async def RemoveBoundingBoxFromImageByID( diff --git a/src/viam/app/data_client.py b/src/viam/app/data_client.py index 760f715aa..6927bd891 100644 --- a/src/viam/app/data_client.py +++ b/src/viam/app/data_client.py @@ -14,6 +14,7 @@ AddBinaryDataToDatasetByIDsRequest, AddBoundingBoxToImageByIDRequest, AddBoundingBoxToImageByIDResponse, + UpdateBoundingBoxRequest, AddTagsToBinaryDataByFilterRequest, AddTagsToBinaryDataByIDsRequest, BinaryData, @@ -1144,6 +1145,7 @@ async def add_bounding_box_to_image_by_id( x_min_normalized=0, y_min_normalized=.1, x_max_normalized=.2, + y_max_normalized=.3, confidence_score=.95 ) @@ -1193,63 +1195,6 @@ async def add_bounding_box_to_image_by_id( response: AddBoundingBoxToImageByIDResponse = await self._data_client.AddBoundingBoxToImageByID(request, metadata=self._metadata) return response.bbox_id - async def update_bounding_box_to_image_by_id( - self, - binary_id: str, - bbox_id: str, - label: str, - x_min_normalized: float, - y_min_normalized: float, - x_max_normalized: float, - y_max_normalized: float, - confidence_score: Optional[float] = None, - ) -> None: - """Update a bounding box in an image. - - :: - - bbox_id = await data_client.update_bounding_box_to_image_by_id( - binary_id="", - bbox_id="2" - label="label", - x_min_normalized=0, - y_min_normalized=.1, - x_max_normalized=.2, - y_max_normalized=.3, - confidence_score=.95 - ) - - Args: - binary_id (str): The binary data ID of the image to add the bounding - box to. - bbox_id (str): The ID of the bounding box to be updated - label (str): A label for the bounding box. - x_min_normalized (float): Min X value of the bounding box normalized from 0 to 1. - y_min_normalized (float): Min Y value of the bounding box normalized from 0 to 1. - x_max_normalized (float): Max X value of the bounding box normalized from 0 to 1. - y_max_normalized (float): Max Y value of the bounding box normalized from 0 to 1. - confidence_score (float): Confidence level of the bounding box being correct. - - Raises: - GRPCError: If the X or Y values are outside of the [0, 1] range. - - Returns: - N/A - - For more information, see `Data Client API `_. - """ - request = UpdateBoundingBoxRequest( - binary_data_id=binary_id, - bbox_id=bbox_id, - label=label, - x_max_normalized=x_max_normalized, - x_min_normalized=x_min_normalized, - y_max_normalized=y_max_normalized, - y_min_normalized=y_min_normalized, - confidence=confidence_score, - ) - await self._data_client.UpdateBoundingBox(request, metadata=self._metadata) - async def remove_bounding_box_from_image_by_id(self, bbox_id: str, binary_id: Union[BinaryID, str]) -> None: """Removes a bounding box from an image. diff --git a/tests/mocks/services.py b/tests/mocks/services.py index 4069de3a4..af79bc3ec 100644 --- a/tests/mocks/services.py +++ b/tests/mocks/services.py @@ -201,6 +201,8 @@ AddBoundingBoxToImageByIDRequest, AddBoundingBoxToImageByIDResponse, AddTagsToBinaryDataByFilterRequest, + UpdateBoundingBoxRequest, + UpdateBoundingBoxResponse, AddTagsToBinaryDataByFilterResponse, AddTagsToBinaryDataByIDsRequest, AddTagsToBinaryDataByIDsResponse,