From dfb5383939ffc3b66df3f2aac40a3b06f5e952c5 Mon Sep 17 00:00:00 2001 From: Dan Huynh Date: Wed, 3 Jul 2024 09:11:22 -0400 Subject: [PATCH] linted --- .../camera_object_detection/yolov8_detection.py | 17 +++++++++++------ .../launch/eve.launch.py | 4 ++-- src/samples/python/aggregator/setup.py | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/perception/camera_object_detection/camera_object_detection/yolov8_detection.py b/src/perception/camera_object_detection/camera_object_detection/yolov8_detection.py index f255443d..67ddf741 100755 --- a/src/perception/camera_object_detection/camera_object_detection/yolov8_detection.py +++ b/src/perception/camera_object_detection/camera_object_detection/yolov8_detection.py @@ -23,6 +23,7 @@ import torch + class Model(): def __init__(self, model_path, device): self.model_path = model_path @@ -30,6 +31,7 @@ def __init__(self, model_path, device): self.names = self.model.module.names if hasattr(self.model, "module") else self.model.names self.stride = int(self.model.stride) + class CameraDetectionNode(Node): def __init__(self): @@ -41,9 +43,12 @@ def __init__(self): self.declare_parameter("camera_topic", "/camera/right/image_color") self.declare_parameter("publish_vis_topic", "/annotated_img") self.declare_parameter("publish_detection_topic", "/detections") - self.declare_parameter("models.traffic_signs.model_path", "/perception_models/traffic_signs.pt") - self.declare_parameter("models.traffic_light.model_path", "/perception_models/traffic_light.pt") - self.declare_parameter("models.pretrained_yolov8m.model_path", "/perception_models/yolov8m.pt") + self.declare_parameter("models.traffic_signs.model_path", + "/perception_models/traffic_signs.pt") + self.declare_parameter("models.traffic_light.model_path", + "/perception_models/traffic_light.pt") + self.declare_parameter("models.pretrained_yolov8m.model_path", + "/perception_models/yolov8m.pt") self.declare_parameter("image_size", 1024) self.declare_parameter("compressed", False) self.declare_parameter("crop_mode", "LetterBox") @@ -264,7 +269,7 @@ def image_callback(self, msg): except CvBridgeError as e: self.get_logger().error(str(e)) return - + detections = [] for model in self.models: # preprocess image and run through prediction @@ -299,8 +304,8 @@ def image_callback(self, msg): annotator = Annotator( cv_image, - line_width=self.line_thickness #, - #example=str(model.names), + line_width=self.line_thickness, + # example=str(model.names), ) (detections, annotated_img) = self.postprocess_detections(detections, annotator) diff --git a/src/perception/camera_object_detection/launch/eve.launch.py b/src/perception/camera_object_detection/launch/eve.launch.py index a4857dce..b840698b 100755 --- a/src/perception/camera_object_detection/launch/eve.launch.py +++ b/src/perception/camera_object_detection/launch/eve.launch.py @@ -10,8 +10,8 @@ def generate_launch_description(): config = os.path.join( - get_package_share_directory("camera_object_detection"), - "config", + get_package_share_directory("camera_object_detection"), + "config", "combined_config.yaml" ) diff --git a/src/samples/python/aggregator/setup.py b/src/samples/python/aggregator/setup.py index b0afb9f6..f77c1804 100755 --- a/src/samples/python/aggregator/setup.py +++ b/src/samples/python/aggregator/setup.py @@ -14,7 +14,7 @@ # Include our package.xml file (os.path.join('share', package_name), ['package.xml']), # Include all launch files. - (os.path.join('share', package_name, 'launch'), \ + (os.path.join('share', package_name, 'launch'), glob(os.path.join('launch', '*.launch.py'))), ], install_requires=['setuptools'],