diff --git a/.gitmodules b/.gitmodules index 74f0ceae1..d5bd0a6c4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/SubjuGator/perception/subjugator_perception/nodes/vision_stack_test.py b/SubjuGator/perception/subjugator_perception/nodes/vision_stack_test.py new file mode 100755 index 000000000..833fdf3e1 --- /dev/null +++ b/SubjuGator/perception/subjugator_perception/nodes/vision_stack_test.py @@ -0,0 +1,36 @@ +#!/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") + self.vs = VisionStack( + layers=[ + ResizeLayer(960, 608), + UnderWaterImageEnhancementLayer(), + ], + ) + + 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() diff --git a/mil_common/perception/vision_stack b/mil_common/perception/vision_stack new file mode 160000 index 000000000..c0465411b --- /dev/null +++ b/mil_common/perception/vision_stack @@ -0,0 +1 @@ +Subproject commit c0465411b257a947b06c7be07e8a36b270956d6d diff --git a/requirements.txt b/requirements.txt index 93cf473b8..0b170cc2e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,7 @@ uvloop==0.16.0 # Data Science pandas==1.4.1 -numpy==1.22.3 +numpy==1.24.4 # Machine Learning scipy==1.10.0 @@ -54,3 +54,4 @@ opencv-python==4.6.0.66 seaborn==0.11.2 thop==0.1.1.post2207130030 requests==2.31.0 +tensorflow==2.13.1 diff --git a/ruff.toml b/ruff.toml index 56794e48d..dbbbbc597 100644 --- a/ruff.toml +++ b/ruff.toml @@ -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 diff --git a/scripts/setup.bash b/scripts/setup.bash index f2f1f05a7..524faa1d5 100755 --- a/scripts/setup.bash +++ b/scripts/setup.bash @@ -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:${HOME}/catkin_ws/src/mil/mil_common/axros/axros/src:${PYTHONPATH}"