Skip to main content

Create topology map for image segments

Project description

Create topology map for image segments

PyPI Open In Colab

GraphVision

A library facilitating the generation of topological representations for image segments. The topological graph is created based on segments and visual embeddings as nodes. This segment topology retains not only spatial but also semantic information, making it very useful for various tasks in visual robotics[1] and localization.

GraphVision provides graphical representations that enable us to perform visual queries and interact with our segmentation graph without the usual preprocessing hassle. VisionGraph handles everything and also offers functionalities to visualize the segment topology and perform visual queries on the graph, leveraging Dijkstra's 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

The graph G can be returned as a networkx (default) or as a PyTorch geometric object. This graphical representation can now be leveraged in various vision tasks such as object localization and 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, so please 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.2.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

graphvision-0.1.2-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: graphvision-0.1.2.tar.gz
  • Upload date:
  • Size: 7.0 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.2.tar.gz
Algorithm Hash digest
SHA256 e1148bacadd1341cc26cafefbd5b19aa0ee401596689277931e2fed2ad258fd9
MD5 ac12ce1fe7c44c8922e0243762961eae
BLAKE2b-256 732a5cada78342c4872e24544153ddc497f92b7b2d5f11170c0b942edac98bbb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: graphvision-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.3 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 65219f0c22e71203eb56652348394e7207188269d89151ce10501f82c210dc0d
MD5 91972ae16cdae838d7745855318df5c7
BLAKE2b-256 86f6af1ef57bcf250bc5dff7a539c0f876566c7a99fc0d732e468edc0035e6b6

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