Comments (7)
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.
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.
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
.
from kornia.
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.
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
kornia/kornia/geometry/vector.py
Line 95 in 40d07ec
from kornia.
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.
link to #2689
from kornia.
Related Issues (20)
- RandomMosaic not working with masks? HOT 2
- implement a deterministic two view scene
- kornia.geometry.transform.warp_image_tps() returning black image HOT 3
- how do u set kornia? HOT 2
- [CI] collector job failling HOT 3
- [CI/Testing] Ensure support to numpy >= 2.0
- Changing dtype of keypoints could cause them to shift HOT 1
- Unreasonable high GPU usage when using erosion HOT 2
- Understanding `kornia.geometry.homography_warp` coordinate system HOT 2
- Update CONTRIBUTING.md to improve setup process and documentation building
- Verify and Update Hugging Face Spaces in Kornia Documentation
- `utils.draw_convex_polygon` is not in-place update HOT 3
- depth_to_3d_v2 batching Bug HOT 2
- combine_tensor_patches produces shape error when recombining patches HOT 2
- DescriptorMatcher only requires desc1, desc2, not LAFs HOT 2
- Add docs for ImageModule
- Short description of difference to pytorch3d
- Add models weights to cache the test suite HOT 1
- Add metatags for into the pages docs
- Incorrect Translation Results with ImageRegistrator in Kornia HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kornia.