Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vision stack implementation #1185

Merged
merged 15 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@
[submodule "mil_common/perception/yolov7-ros"]
path = mil_common/perception/yolov7-ros
url = https://github.com/uf-mil/yolov7-ros.git
[submodule "mil_common/perception/vision_stack"]
path = mil_common/perception/vision_stack
url = https://github.com/uf-mil/vision_stack.git
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env python3
import rospy
from image_geometry import PinholeCameraModel
from mil_ros_tools import (
Image_Subscriber,
)
from vision_stack import ResizeLayer, UnderWaterImageEnhancementLayer, VisionStack

__author__ = "Daniel Parra"


class ObjectDetectionTest:
def __init__(self):
camera = rospy.get_param("~image_topic", "/camera/front/right/image_rect_color")
SIZE = (960, 608)
self.vs = VisionStack(
layers=[
ResizeLayer((0, 0), 960, 608),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be

ResizeLayer((0, 0), SIZE[0], SIZE[1])

right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first argument is the initial size, and the next parameters are the new width and new heights. However, the initial size of the image is not being used in any of the layers...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ill change that rn

UnderWaterImageEnhancementLayer(SIZE),
],
input_size=SIZE,
)

self.image_sub = Image_Subscriber(camera, self.detection_callback)
self.camera_info = self.image_sub.wait_for_camera_info()
assert self.camera_info is not None
self.cam = PinholeCameraModel()
self.cam.fromCameraInfo(self.camera_info)

def detection_callback(self, msg):
# Create Image from array
self.vs.run(msg, True)


if __name__ == "__main__":
rospy.init_node("vision_pipeline_test")
ObjectDetectionTest()
rospy.spin()
1 change: 1 addition & 0 deletions mil_common/perception/vision_stack
Submodule vision_stack added at b021d1
1 change: 1 addition & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ extend-exclude = [
"NaviGator/simulation/VRX/vrx",
"NaviGator/simulation/VRX/vrx-docker",
"mil_common/perception/yolov7-ros",
"mil_common/perception/vision_stack",
# sub simulation
"SubjuGator/simulation",
# docker contents
Expand Down
2 changes: 1 addition & 1 deletion scripts/setup.bash
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,4 @@ cmonly() {
alias xbox=startxbox

# PYTHONPATH modifications
export PYTHONPATH="${HOME}/catkin_ws/src/mil/mil_common/axros/axros/src:${PYTHONPATH}"
export PYTHONPATH="${HOME}/catkin_ws/src/mil/mil_common/perception/vision_stack/src/vision_stack:${HOME}/catkin_ws/src/mil/mil_common/axros/axros/src:${PYTHONPATH}"
Loading