From a97bb410084522dd818ac9ed75bd69d355a3323b Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Wed, 19 Jun 2024 02:15:27 +0200 Subject: [PATCH] Update Ruff formatting actions (#13787) Signed-off-by: Glenn Jocher Co-authored-by: UltralyticsAssistant --- docs/en/guides/ros-quickstart.md | 7 ++++--- pyproject.toml | 1 - ultralytics/utils/callbacks/mlflow.py | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/en/guides/ros-quickstart.md b/docs/en/guides/ros-quickstart.md index 5ee58990..dd0abd17 100644 --- a/docs/en/guides/ros-quickstart.md +++ b/docs/en/guides/ros-quickstart.md @@ -105,17 +105,18 @@ The `sensor_msgs/Image` [message type](https://docs.ros.org/en/api/sensor_msgs/h ```python def callback(data): - """Callback function to process image and publish annotated images.""" + """Callback function to process image and publish annotated images.""" array = ros_numpy.numpify(data) if det_image_pub.get_num_connections(): det_result = detection_model(array) det_annotated = det_result[0].plot(show=False) - det_image_pub.publish(ros_numpy.msgify(Image, det_annotated, encoding='rgb8')) + det_image_pub.publish(ros_numpy.msgify(Image, det_annotated, encoding="rgb8")) if seg_image_pub.get_num_connections(): seg_result = segmentation_model(array) seg_annotated = seg_result[0].plot(show=False) - seg_image_pub.publish(ros_numpy.msgify(Image, seg_annotated, encoding='rgb8')) + seg_image_pub.publish(ros_numpy.msgify(Image, seg_annotated, encoding="rgb8")) + rospy.Subscriber("/camera/color/image_raw", Image, callback) diff --git a/pyproject.toml b/pyproject.toml index a4ee2403..9b130e0b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -149,7 +149,6 @@ markers = [ ] norecursedirs = [".git", "dist", "build"] - [tool.coverage.run] source = ["ultralytics/"] data_file = "tests/.coverage" diff --git a/ultralytics/utils/callbacks/mlflow.py b/ultralytics/utils/callbacks/mlflow.py index bbae4cc0..ef449b66 100644 --- a/ultralytics/utils/callbacks/mlflow.py +++ b/ultralytics/utils/callbacks/mlflow.py @@ -38,10 +38,12 @@ try: except (ImportError, AssertionError): mlflow = None + def sanitize_dict(x): """Sanitize dictionary keys by removing parentheses and converting values to floats.""" return {k.replace("(", "").replace(")", ""): float(v) for k, v in x.items()} + def on_pretrain_routine_end(trainer): """ Log training parameters to MLflow at the end of the pretraining routine.