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

feat: add tool for open-set detection using grounding dino #215

Merged
merged 13 commits into from
Sep 24, 2024

Conversation

rachwalk
Copy link
Contributor

@rachwalk rachwalk commented Sep 9, 2024

Purpose

Adds Grounding Dino Tooling for distance estimation. Grounding Dino is used to extract the regions of the camera POV classified as certain objects. These regions can then be extracted from the depth channel, and after calibration, used to estimate distance from camera to them.

Proposed Changes

  • Adds two tools: GetDetectionTool, GetDistanceToObjectsTool.
  • Defines API for the grounding_dino extension

Issues

#194

Testing

Tested using following script:

import rclpy
from rai_grounding_dino.tools import GetDetectionTool

from rai.node import RaiBaseNode

if __name__ == "__main__":
    rclpy.init()
    node=RaiBaseNode(node_name="unique_node")
    x = GetDetectionTool(node)._run(
        camera_topic="/camera/camera/color/image_raw",
        object_names=["chair"],
    )
    print(f"Detected: {x}")
    x = GetDistanceToObjectsTool(node)._run(
        camera_topic="/camera/camera/color/image_raw",
        depth_topic="/camera/camera/depth/image_raw_rect",
        object_names=["chair"],
    )
    print(f"Detected: {x}")

In second terminal run:

ros2 launch rai_grounding_dino gdino_launch.xml

Camera topics must be available and of the same resolution. The detection went through correctly.

@adamdbrw
Copy link
Member

Could you include the test in the commit, and document the new tool as well for users and developers? Does it require additional dependencies?

@rachwalk rachwalk marked this pull request as draft September 10, 2024 09:31
@rachwalk rachwalk force-pushed the kr/distance-estimation branch 4 times, most recently from 5e7ccf8 to 37d715d Compare September 24, 2024 09:11
@rachwalk rachwalk marked this pull request as ready for review September 24, 2024 09:23
Copy link
Member

@maciejmajek maciejmajek left a comment

Choose a reason for hiding this comment

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

Thanks. I can confirm that the feature works as expected. Please take a look at the comments.
Regarding the {... or 'Nothing'}, decide yourself whether handling it that way or using if measurements[] is better

@maciejmajek maciejmajek merged commit ea213aa into development Sep 24, 2024
4 checks passed
@maciejmajek maciejmajek deleted the kr/distance-estimation branch September 24, 2024 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants