Skip to content
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

Fix: update random_rain.py #2514

Merged
merged 2 commits into from Aug 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions kornia/augmentation/_2d/intensity/random_rain.py
Expand Up @@ -63,7 +63,7 @@ def apply_transform(
bool(torch.all(torch.abs(params['drop_width_factor']) <= image.shape[3])),
"Width of drop should be less than image width.",
)

modeified_img = image.clone()
for i in range(image.shape[0]):
number_of_drops: int = int(params['number_of_drops_factor'][i])
# We generate tensor with maximum number of drops, and then remove unnecessary drops.
Expand All @@ -87,5 +87,5 @@ def apply_transform(
y = torch.linspace(start=0, end=width_of_drop, steps=size_of_line, dtype=torch.long).to(image.device)
# Draw lines
for k in range(x.shape[0]):
image[i, :, coords[0] + x[k], coords[1] + y[k]] = 200 / 255
return image
modeified_img[i, :, coords[0] + x[k], coords[1] + y[k]] = 200 / 255
return modeified_img