Skip to content

[Feature Request] Target Transforms for keypoints in Image #523

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

Open
Naman-ntc opened this issue Jun 3, 2018 · 8 comments
Open

[Feature Request] Target Transforms for keypoints in Image #523

Naman-ntc opened this issue Jun 3, 2018 · 8 comments

Comments

@Naman-ntc
Copy link

Torchvision's functional API allows user to explicitly specify angles to rotate the image or points to crop the image. Thus one can apply sane augmentation on target masks or bounding boxes.
But in cases where we have the output as keypoints in the image, for example say human body joint coordinates in given image, if I rotate the image I'll have to find corresponding joint locations in image (via elementary geometry). I felt that this effort off applying corresponding keypoints in augmented image could be handled in pytorch backend and would be very helpful.
Do you think it's worth it to add in torchvision package?
This could come handy in object detection, human joint annotations and maybe even more place

@fmassa
Copy link
Member

fmassa commented Jun 6, 2018

Yes, this is useful will be included in torchvision in the next release.
If you have any code examples, it would be great if you could share.

@Naman-ntc
Copy link
Author

Hi

def padTarget(input,padding):
     	"""
	input is a np array of size Nx2 (N is the number of keypoints you want to transform)
	padding is a int or tuple of size 2 or 4 
	(for this code I assumed it to be tuple of size 4 as per link below code	"""

     return input - np.asarray([padding[0],padding[1]])

Function Padding Transforms Link
)
This is a rough code made for padding (pretty trivial I guess) need to work through all cases though. Similarly for crop as well as resize and rotate can be done
(PS : Did the simplest one :P others are also trivial but easy to get wrong so did this )

@fmassa
Copy link
Member

fmassa commented Jun 7, 2018

Thanks!
I'll keep this issue open while we work on adding proper keypoint support in torchvision

@Naman-ntc
Copy link
Author

Great! Would have loved to contribute but have some major commitments right now!
Thanks !

@Ridhwanluthra
Copy link

Hi, I would like to work on this if someone is not working.
from what I understand basically, we want to create a way to apply a particular transform to multiple points?

@fmassa
Copy link
Member

fmassa commented Jun 19, 2018

I think it might be better to hold on a bit on this for the moment.
I believe the key point here will be to have a nice representation for the keypoints, which enables us to perform the transformations easily and efficiently.
I have such representations for bounding boxes and segmentation masks, and next I'll be looking at keypoints.

@Ridhwanluthra
Copy link

@fmassa I can help with building that representation as well. Please let me know if that is something I can contribute to

@fmassa
Copy link
Member

fmassa commented Jun 21, 2018

@Ridhwanluthra thanks for the offer!
I've just started working on keypoints, I'll keep you posted!

rajveerb pushed a commit to rajveerb/vision that referenced this issue Nov 30, 2023
* Update readme

* Unet3d update (pytorch#1)

* enable multi-gpu training

* enable multi-gpu training

* enable multi-gpu training

* enable multi-gpu training

* enable multi-gpu training

* test grad acc

* test grad acc

* test grad acc

* fix number of samples logging

* test

* Add divergence detection

* Add divergence detection

* Remove debug prints

* Remove debug prints

* Remove debug prints

* Remove debug prints

* Remove debug prints

* Remove debug prints
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants