-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Making transformation
an optional parameter in FasterRCNN
#2263
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
Comments
Furthermore, this transformation class does not handle cases when targets are empty, leading to this error.
|
Hi, Thanks for opening the PR! Exposing a But it means that it would be conflicting with the following arguments vision/torchvision/models/detection/faster_rcnn.py Lines 145 to 146 in 3e69462
I think it could be fine if we do proper error checking. This means we would need to change the default values to be if transform is not None:
if min_size is not None:
raise ValueError(...)
if max_size is not None:
raise ValueError(...)
else:
transform = ... That being said, after the model is instantiated, it is fairly easy to change the transform by doing something like model = fasterrcnn_resnet50_rpn()
model.transform = MyTransform() but I'm not against exposing this to the user. About the error message, I believe this is an issue with the targets being passed to the model, and we have added some informative error message in #2207 Let us know if this isn't the case, IIRC we are still missing error checks for masks and keypoints |
Hi Francisco, Thank you for your response. Why would we need the
Edit : (continuation) I think this type of parametrisation would be compatible with Visions'/Albumentation's transformation as well. Please let me know what you think Regards, |
@Sentient07 we already support passing model fasterrcnn_resnet50_fpn(transform=MyTransform(), min_size=500) as you can see, now |
Hi @fmassa ,
If they want to specify Thanks! |
@Sentient07 I've answered in the PR, let me know what you think |
I wonder if it's still interesting to someone, I can give it a try, should I open new PR or continue #2288? |
I believe yes, FASTER-RCNN's job should only be learning and inference, while resizing and others should be other object's responsibilit, I'm having a hard time training and inferencing since with the current implementation everything feels so flimsy and what if I want to inference diference sized images? https://discuss.pytorch.org/t/faster-rcnn-image-size-and-weird-transform-behaviour/121414 |
ok, so I will try to fix it. For now I am using messy but working workaround (@qornifmlx, maybe this will help you):
Normalize was just ripped from
because it is called in line 99 in generalized RCNN |
Uh oh!
There was an error while loading. Please reload this page.
Hello,
🚀 Feature
I think it would be more generic to have
transform
(vision/torchvision/models/detection/faster_rcnn.py
Line 231 in 3d65fc6
Motivation
I am applying transformations separately as a part of data augmentation, which includes cropping and resizing. Hence I would prefer to not do the twice while retraining
FasterRCNN
.Pitch
I would like to have a fixed size input to be fed into the network for variable-sized images. At present, I do this by resizing the images separately as a part of DataLoader and adjust the parameters of
GeneralizedRCNNTransform
accordingly.Alternatives
My present way of using
FasterRCNN
is an alternative. Since my set of transformations are pre-defined, I have to apply hacks such as setting mean to 0., std to 1. and altering min and max sizes to my default value(this would mean thatscale=1
and interpolation would return the same image.Additional context
While the input to the network is fixed size, I apply many other augmentations such as mirror, random cropping etc, inspired by SSD based networks. Hence I would prefer to do all augmentation in a separate place once instead of twice.
Thank you!
Edit : If you think this would be a meaningful change, I will be happy to send a Pull Request.
The text was updated successfully, but these errors were encountered: