GithubHelp home page GithubHelp logo

Comments (7)

johnnv1 avatar johnnv1 commented on September 25, 2024

Not all augmentations have support for keypoints yet (see #941), contributions are welcomed. @shijianjian do we have somewhere a list with what augmentations support each case?

from kornia.

shijianjian avatar shijianjian commented on September 25, 2024

In theory, all the augmentations inherits from the GeometricAugmentation class should be properly supported. It should work for the demo code you provided. It worth checking where went wrong if you got some time. @alexanderswerdlow

from kornia.

alexanderswerdlow avatar alexanderswerdlow commented on September 25, 2024

Upon digging a little deeper, I think I figured out the issue which is pretty simple albeit unintuitive for an end-user. Keypoints can be transformed to be moved out of the image but then moved back into the image by subsequent transformations [e.g., Translate] with zeros for padding. The end result of this is that keypoints become detached from their original content as seen below.

If you have a series of augmentations as is common, it doesn't seem like there's a simple way to determine if a keypoint is no longer a valid one; perhaps returning a mask to denote which ones are valid or setting invalid keypoints to a special value [-1, NaN] would be a solution.

The example below is with RandomResizedCrop -> RandomTranslate.

transform

from kornia.

shijianjian avatar shijianjian commented on September 25, 2024

Ah. Yes, I remember the design now. Since we use the same point transformation for bounding boxes, we do not remove those invalid keypoints. Those need to be kept otherwise the boxes will not have four corners.

I would vote for having a visibility field in the keypoint data structure. probably 0 for invisible and 1 for visible. Do you think it is easy to add @alexanderswerdlow ?

from kornia.

edgarriba avatar edgarriba commented on September 25, 2024

geometrically speaking the keyword visibility can be a bit too image specific. To follow the recent generic geometry data structures I would considervalid/is_valid that will become also more idiomatic so that we can have something like.

pts = [....]
pts_filtered = [p for pts if p.valid]

besidesi, i'd also consider expanding the Keypoint data structure possibly based or inspired by Vector2

class Vector2(TensorWrapper):

from kornia.

alexanderswerdlow avatar alexanderswerdlow commented on September 25, 2024

I don't think it should be very difficult but I'm not very familiar with Kornia (this is my first time using it actually).

I added a basic implementation but I'm not sure how robust it is and whether it works for all geometric augmentations. The few I tested (Shear, Translate, Crop, Rotate, Flip) seem to work though. It's a little hacky as it checks the output_size field, specifically for cropping, so a more general implementation (maybe that can apply to 3D) would be better, but unfortunately I don't have the capacity for that atm.

I think a mask is preferable to making each point into an object with a field, at least for my use-case with a very dense grid of key points.

It also might make sense to set the masked out key points to some special value so it's clear to the user that they need to ignore these values, unless there's a use case for them. On the surface, key points are ostensibly used for correspondence so it's hard to see why someone would want this broken.

from kornia.

shijianjian avatar shijianjian commented on September 25, 2024

link to #2689

from kornia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.