-
Notifications
You must be signed in to change notification settings - Fork 38
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
refactor: gdino and gsam as agents #501
base: development
Are you sure you want to change the base?
Conversation
This test takes about 10 sec to run on my pc with only agent2 commented out. from rai.communication.ros2 import ROS2ARIConnector, ROS2ARIMessage
from rai.utils import ROS2Context
from rai_interfaces.srv import RAIGroundingDino
import cv2
import cv_bridge
from rai.tools.ros2.utils import ros2_message_to_dict
@ROS2Context()
def test_grounding_dino_agent():
connector = ROS2ARIConnector()
bridge = cv_bridge.CvBridge()
image = bridge.cv2_to_imgmsg(cv2.imread("docs/imgs/o3deSimulation.png"))
msg = RAIGroundingDino.Request()
msg.source_img = image
msg.classes = ["chair"]
msg.box_threshold = 0.5
msg.text_threshold = 0.5
ari_msg = ROS2ARIMessage(payload=ros2_message_to_dict(msg))
response = connector.service_call(target="/grounding_dino_classify", message=ari_msg, msg_type="rai_interfaces/srv/RAIGroundingDino")
print(response.payload) Similarly, with only one agent running it takes about 10 seconds to run the test @ROS2Context()
def test_grounded_sam_agent():
connector = ROS2ARIConnector()
bridge = cv_bridge.CvBridge()
image = bridge.cv2_to_imgmsg(cv2.imread("docs/imgs/o3deSimulation.png"), encoding="rgb8")
msg = RAIGroundedSam.Request()
msg.source_img = image
msg.detections = {}
ari_msg = ROS2ARIMessage(payload=ros2_message_to_dict(msg))
response = connector.service_call(target="/grounded_sam_segment", message=ari_msg, msg_type="rai_interfaces/srv/RAIGroundedSam", timeout_sec=10)
print(response.payload) With two agents it takes Edit: When i sent sigint to the pytest, Grounded sam immediately logged
Not sure if coincidence. |
For some reason it takes a very long time to load on my setup compared to previous implementation
|
Well, turns out using MultiThreadedExecutor in ROS2ARIConnector slow things down 100 times. Both weight initialization as well as inference. |
acea09b
to
382d914
Compare
Purpose
Change the GDino and GSam to run using Agent based architecture
Proposed Changes
Refactor of GSam and GDino to run through an agent
Issues
Testing
Run manipulation demo, with this script instead of launching the gdino and gsam node: