-
Notifications
You must be signed in to change notification settings - Fork 2
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
Problem with val.py. missing argument in val.py #4
Comments
This sounds like something @ingin97 knows more about, but I'll have a look too. 👀 |
As far as I can see, we never augmented our IR images in the To fix this, I think you will need to augment both the RGB and IR images (exactly in the same manner). Something like this might work. I have not tested this. Feel free to add a PR for this if you make it work! 😄 def _forward_augment(self, x_rgb, x_ir):
img_size = x_rgb.shape[-2:] # height, width
s = [1, 0.83, 0.67] # scales
f = [None, 3, None] # flips (2-ud, 3-lr)
y = [] # outputs
for si, fi in zip(s, f):
xi_rgb = scale_img(x_rgb.flip(fi) if fi else x_rgb, si, gs=int(self.stride.max()))
xi_ir = scale_img(x_ir.flip(fi) if fi else x_ir, si, gs=int(self.stride.max()))
yi = self._forward_once(xi_rgb, xi_ir)[0] # forward
# cv2.imwrite(f'img_{si}.jpg', 255 * xi_rgb[0].cpu().numpy().transpose((1, 2, 0))[:, :, ::-1]) # save
yi = self._descale_pred(yi, fi, si, img_size)
y.append(yi)
return torch.cat(y, 1), None # augmented inference, train |
yes, the file in question is yolo_four_input.py. I have just renamed it. Rgb Images should be augmented but I want to keep depth images as it is. update: I have tried passing x_ir to the forward_augment function RuntimeError: The size of tensor a (108) must match the size of tensor b (84) at non-singleton dimension 3 |
@snowbrood I think this is the option to do augmentation on inference/validation, which we did not have the time to do while we were working on this. Though if you think Test-Time Augmentation is worth the implementation effort, we are welcoming a PR. Augmentation is added to the training script Conclusion: If you did not want to add TTA I think you just need to turn of augmentation while running the validation for it to work. |
Why do you not want this? The augmentation is (among other thing) a process of cutting the images into pieces, so it's imperative that the depth images and the rgb images are cut into exactly the same pieces, otherwise it doesn't make much sense. So it should be an all-or-nothing choice. Either with or without augmentation. |
you are right. I confused it with sth else |
I'm not exactly sure what's gone wrong here, but I'm assuming the error is raised when running the |
Interesting this is only run when validating and during training. Though weird we did not get that error, you might try something like this:
Or maybe remove it and see if it still initializes properly? |
Hi there!
I have been trying to run val.py which imports yolo_four_input
in the function _forward_augment
yi = self._forward_once(xi)[0] # forward
just one argument is passed to forward_once where it expects at least two. Why is x_ir missing? I think you don't want to augment IR images which is understood.
but how to resolve this.
Thank you!
The text was updated successfully, but these errors were encountered: