Skip to main content

Create topology map for image segments

Project description

Create topology map for image segments

GraphVision

A library fascilitating generation of topological representation fpr the image segments. The topological graph is created based on the segments and visual embeddings as nodes. The segment topology, doesn't only keep the spatial but semantic infromation as well, this is very helpful for various tasks in visual robotics[1] and localization.

GraphVision provides such graphical representations that let us perform visual query, and communicate with our segmentation graph, this would generally require a lot of preprocessing hassle. VisonGraph does it all itself, and also provides functionalities to visualize the segment topology and perfom visual query on the graph leveraging dijkstras` algorithm for localization.

Usage

The library requirements are flexible but still its suggested to use a virtual environment.

pip install graphvision

Read an image as rgb, import the Generator and SegmentGraph. Initialize the generator, call the segmentation model, generate the masks and that is it, you are ready create the topological graph for your segments.

from graphvision import Generator, SegmentGraph
gen = Generator()
mask_gen = gen.SAM()
segments = gen.generate_masks(mask_gen, image_rgb)

You can use visualize or plot it using gen.plot_segments(segments)

Create the topological graph

sg = SegmentGraph(segments, image_rgb)
G, centroids = sg.get_topology(dist_thres=150) # Other Optional Parameters: area_percent, add_to_bbox

Two graph G can be returned as a 'networkx' (default) or as a PyTorch geormetric object. This graphical representation can now be leveraged in various vision tasks such as object localization, environment mapping in robotics based on both spatial and semantic features.

Query the segment graph

You can also perform visual queries on the graph, to locate objects dependent on other nodes (neighbouring objects), This a naive implementation, please kindly go through the colab notebook to understand to understand it in greateer detail.

result = sg.query_segment_graph(G, query_pair=("Girl", "plant"), show_legend=True)

Reference

  1. RoboHop: Segment-based Topological Map Representation for Open-World Visual Navigation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

graphvision-0.1.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

graphvision-0.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file graphvision-0.1.tar.gz.

File metadata

  • Download URL: graphvision-0.1.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for graphvision-0.1.tar.gz
Algorithm Hash digest
SHA256 580e065c82daace379a9d6e2dc1a8b4ab31ee40bccb8c78383afbeba8ca85969
MD5 1fa444aa879787b453c831b1fe5b194c
BLAKE2b-256 866a2563f91820e2cecca26ac6cfea3f8c2ca2d3e5774927e85167d05f3b7a98

See more details on using hashes here.

File details

Details for the file graphvision-0.1-py3-none-any.whl.

File metadata

  • Download URL: graphvision-0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for graphvision-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e9688a6ddc7f419f2ee92bbfd1d3019547dbaa35ac5535df4959945d8310f5f7
MD5 0a77065dfc59a7281877e820e3ffb509
BLAKE2b-256 97d22f44298766f0d560616637e7963a4c574c89912aeaaa718fc4793e60a87e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page