Skip to content

Commit

Permalink
linted
Browse files Browse the repository at this point in the history
  • Loading branch information
danielrhuynh committed Jul 3, 2024
1 parent 76330f2 commit dfb5383
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@

import torch


class Model():
def __init__(self, model_path, device):
self.model_path = model_path
self.model = AutoBackend(self.model_path, device=device, dnn=False, fp16=False)
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):
Expand All @@ -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")
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions src/perception/camera_object_detection/launch/eve.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
2 changes: 1 addition & 1 deletion src/samples/python/aggregator/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down

0 comments on commit dfb5383

Please sign in to comment.