Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
fccc5867
Unverified
Commit
fccc5867
authored
Jan 25, 2022
by
Vasilis Vryniotis
Committed by
GitHub
Jan 25, 2022
Browse files
Fix a bug on RandomZoomOut (#5278)
parent
067dc302
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
references/detection/transforms.py
references/detection/transforms.py
+2
-1
No files found.
references/detection/transforms.py
View file @
fccc5867
...
@@ -189,7 +189,7 @@ class RandomZoomOut(nn.Module):
...
@@ -189,7 +189,7 @@ class RandomZoomOut(nn.Module):
elif
image
.
ndimension
()
==
2
:
elif
image
.
ndimension
()
==
2
:
image
=
image
.
unsqueeze
(
0
)
image
=
image
.
unsqueeze
(
0
)
if
torch
.
rand
(
1
)
<
self
.
p
:
if
torch
.
rand
(
1
)
>=
self
.
p
:
return
image
,
target
return
image
,
target
orig_w
,
orig_h
=
F
.
get_image_size
(
image
)
orig_w
,
orig_h
=
F
.
get_image_size
(
image
)
...
@@ -211,6 +211,7 @@ class RandomZoomOut(nn.Module):
...
@@ -211,6 +211,7 @@ class RandomZoomOut(nn.Module):
image
=
F
.
pad
(
image
,
[
left
,
top
,
right
,
bottom
],
fill
=
fill
)
image
=
F
.
pad
(
image
,
[
left
,
top
,
right
,
bottom
],
fill
=
fill
)
if
isinstance
(
image
,
torch
.
Tensor
):
if
isinstance
(
image
,
torch
.
Tensor
):
# PyTorch's pad supports only integers on fill. So we need to overwrite the colour
v
=
torch
.
tensor
(
self
.
fill
,
device
=
image
.
device
,
dtype
=
image
.
dtype
).
view
(
-
1
,
1
,
1
)
v
=
torch
.
tensor
(
self
.
fill
,
device
=
image
.
device
,
dtype
=
image
.
dtype
).
view
(
-
1
,
1
,
1
)
image
[...,
:
top
,
:]
=
image
[...,
:,
:
left
]
=
image
[...,
(
top
+
orig_h
)
:,
:]
=
image
[
image
[...,
:
top
,
:]
=
image
[...,
:,
:
left
]
=
image
[...,
(
top
+
orig_h
)
:,
:]
=
image
[
...,
:,
(
left
+
orig_w
)
:
...,
:,
(
left
+
orig_w
)
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment