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

How to build a graph using yolo output #3289

Open
samahwaleed opened this issue Oct 4, 2021 · 1 comment
Open

How to build a graph using yolo output #3289

samahwaleed opened this issue Oct 4, 2021 · 1 comment

Comments

@samahwaleed
Copy link

I have done object detection using yolo v5 on my custom dataset and I saved the results in txt files. The txt file has label, bbox coordinator and the score and I want to know how to build a graph using those results.

Thanks.

@rusty1s
Copy link
Member

rusty1s commented Oct 5, 2021

You can represent each bounding box as a node, and assign features to it, e.g.,

  1. The (normalized) width and height of the bounding box
  2. The scores
  3. Some image features of each bounding box as given by your pre-trained model,

and save them to a Data object data = Data(x=x, pos=pos) where x denotes a matrix of shape [num_nodes, num_features], and pos denotes the center of each bounding box as a [num_nodes, 2] matrix.
You can then create a graph from it using k-nearest neighbors, e.g.:

from torch_geometric.transforms import KNNGraph
transform = KNNGraph(6)
data = transform(data)

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

No branches or pull requests

2 participants