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
3a17e339
Unverified
Commit
3a17e339
authored
Oct 27, 2021
by
Nicolas Hug
Committed by
GitHub
Oct 27, 2021
Browse files
Remove p_value test for RandomHorizontalFlipVideo (#4765)
parent
0f770ac9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
25 deletions
+7
-25
test/test_transforms_video.py
test/test_transforms_video.py
+7
-25
No files found.
test/test_transforms_video.py
View file @
3a17e339
...
...
@@ -160,34 +160,16 @@ class TestVideoTransforms:
trans
.
__repr__
()
@
pytest
.
mark
.
skipif
(
stats
is
None
,
reason
=
"scipy.stats not available"
)
def
test_random_horizontal_flip_video
(
self
):
random_state
=
random
.
getstate
()
random
.
seed
(
42
)
@
pytest
.
mark
.
parametrize
(
"p"
,
(
0
,
1
))
def
test_random_horizontal_flip_video
(
self
,
p
):
clip
=
torch
.
rand
((
3
,
4
,
112
,
112
),
dtype
=
torch
.
float
)
hclip
=
clip
.
flip
((
-
1
))
num_samples
=
250
num_horizontal
=
0
for
_
in
range
(
num_samples
):
out
=
transforms
.
RandomHorizontalFlipVideo
()(
clip
)
if
torch
.
all
(
torch
.
eq
(
out
,
hclip
)):
num_horizontal
+=
1
p_value
=
stats
.
binom_test
(
num_horizontal
,
num_samples
,
p
=
0.5
)
random
.
setstate
(
random_state
)
assert
p_value
>
0.0001
num_samples
=
250
num_horizontal
=
0
for
_
in
range
(
num_samples
):
out
=
transforms
.
RandomHorizontalFlipVideo
(
p
=
0.7
)(
clip
)
if
torch
.
all
(
torch
.
eq
(
out
,
hclip
)):
num_horizontal
+=
1
p_value
=
stats
.
binom_test
(
num_horizontal
,
num_samples
,
p
=
0.7
)
random
.
setstate
(
random_state
)
assert
p_value
>
0.0001
out
=
transforms
.
RandomHorizontalFlipVideo
(
p
=
p
)(
clip
)
if
p
==
0
:
torch
.
testing
.
assert_close
(
out
,
clip
)
elif
p
==
1
:
torch
.
testing
.
assert_close
(
out
,
hclip
)
transforms
.
RandomHorizontalFlipVideo
().
__repr__
()
...
...
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