Improve graph feature extraction and add utilities for visualization and embedding search#8
Open
swagat-mishra28 wants to merge 4 commits intohumanai-foundation:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi,
While exploring the graph construction and embedding pipeline, I made a few small improvements that may help with inspecting the graph representations and working with the generated embeddings.
Main changes include:
• extended the node feature extraction in extract_node() (in utils/build_graph.py) to include additional region statistics and a simple texture descriptor derived from gradient magnitude
• added a small utility visualize_segments() in utils/build_graph.py to visualize the SLIC superpixel segmentation used for graph construction
• added find_similar_embeddings() in embedding.py to perform cosine-similarity search over the generated embeddings, along with a helper to retrieve similar images from the embedding space
• added save_overlay() in utils/visualization.py to optionally save heatmap overlays when inspecting hidden-art visualizations
• added a small dataset integrity check using Image.open(path).verify() to skip corrupted images during dataset construction
• included a few minor stability improvements in the embedding pipeline (handling NaNs, saving embedding metadata, and small usability tweaks)
These additions are mainly intended to make it easier to inspect graph construction, debug segmentation, and experiment with the embeddings produced by the encoder when analyzing paintings.
Please let me know if any of these utilities should be structured differently or integrated elsewhere in the workflow.