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
652a70ff
Unverified
Commit
652a70ff
authored
Mar 12, 2021
by
Nicolas Hug
Committed by
GitHub
Mar 12, 2021
Browse files
better cond (#3548)
Co-authored-by:
Vasilis Vryniotis
<
datumbox@users.noreply.github.com
>
parent
9a08e47d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
test/test_datasets.py
test/test_datasets.py
+2
-2
test/test_utils.py
test/test_utils.py
+4
-4
No files found.
test/test_datasets.py
View file @
652a70ff
...
@@ -147,7 +147,7 @@ class Tester(DatasetTestcase):
...
@@ -147,7 +147,7 @@ class Tester(DatasetTestcase):
self
.
assertEqual
(
dataset
.
class_to_idx
[
dataset
.
classes
[
0
]],
target
)
self
.
assertEqual
(
dataset
.
class_to_idx
[
dataset
.
classes
[
0
]],
target
)
@
mock
.
patch
(
'torchvision.datasets.WIDERFace._check_integrity'
)
@
mock
.
patch
(
'torchvision.datasets.WIDERFace._check_integrity'
)
@
unittest
.
skipIf
(
'win'
in
sys
.
platform
,
'temporarily disabled on Windows'
)
@
unittest
.
skipIf
(
sys
.
platform
in
(
'win32'
,
'cygwin'
)
,
'temporarily disabled on Windows'
)
def
test_widerface
(
self
,
mock_check_integrity
):
def
test_widerface
(
self
,
mock_check_integrity
):
mock_check_integrity
.
return_value
=
True
mock_check_integrity
.
return_value
=
True
with
widerface_root
()
as
root
:
with
widerface_root
()
as
root
:
...
@@ -166,7 +166,7 @@ class Tester(DatasetTestcase):
...
@@ -166,7 +166,7 @@ class Tester(DatasetTestcase):
img
,
target
=
dataset
[
0
]
img
,
target
=
dataset
[
0
]
self
.
assertTrue
(
isinstance
(
img
,
PIL
.
Image
.
Image
))
self
.
assertTrue
(
isinstance
(
img
,
PIL
.
Image
.
Image
))
@
unittest
.
skipIf
(
'win'
in
sys
.
platform
,
'temporarily disabled on Windows'
)
@
unittest
.
skipIf
(
sys
.
platform
in
(
'win32'
,
'cygwin'
)
,
'temporarily disabled on Windows'
)
def
test_cityscapes
(
self
):
def
test_cityscapes
(
self
):
with
cityscapes_root
()
as
root
:
with
cityscapes_root
()
as
root
:
...
...
test/test_utils.py
View file @
652a70ff
...
@@ -42,21 +42,21 @@ class Tester(unittest.TestCase):
...
@@ -42,21 +42,21 @@ class Tester(unittest.TestCase):
self
.
assertTrue
(
torch
.
equal
(
norm_max
,
rounded_grid_max
),
'Normalized max is not equal to 1'
)
self
.
assertTrue
(
torch
.
equal
(
norm_max
,
rounded_grid_max
),
'Normalized max is not equal to 1'
)
self
.
assertTrue
(
torch
.
equal
(
norm_min
,
rounded_grid_min
),
'Normalized min is not equal to 0'
)
self
.
assertTrue
(
torch
.
equal
(
norm_min
,
rounded_grid_min
),
'Normalized min is not equal to 0'
)
@
unittest
.
skipIf
(
'win'
in
sys
.
platform
,
'temporarily disabled on Windows'
)
@
unittest
.
skipIf
(
sys
.
platform
in
(
'win32'
,
'cygwin'
)
,
'temporarily disabled on Windows'
)
def
test_save_image
(
self
):
def
test_save_image
(
self
):
with
tempfile
.
NamedTemporaryFile
(
suffix
=
'.png'
)
as
f
:
with
tempfile
.
NamedTemporaryFile
(
suffix
=
'.png'
)
as
f
:
t
=
torch
.
rand
(
2
,
3
,
64
,
64
)
t
=
torch
.
rand
(
2
,
3
,
64
,
64
)
utils
.
save_image
(
t
,
f
.
name
)
utils
.
save_image
(
t
,
f
.
name
)
self
.
assertTrue
(
os
.
path
.
exists
(
f
.
name
),
'The image is not present after save'
)
self
.
assertTrue
(
os
.
path
.
exists
(
f
.
name
),
'The image is not present after save'
)
@
unittest
.
skipIf
(
'win'
in
sys
.
platform
,
'temporarily disabled on Windows'
)
@
unittest
.
skipIf
(
sys
.
platform
in
(
'win32'
,
'cygwin'
)
,
'temporarily disabled on Windows'
)
def
test_save_image_single_pixel
(
self
):
def
test_save_image_single_pixel
(
self
):
with
tempfile
.
NamedTemporaryFile
(
suffix
=
'.png'
)
as
f
:
with
tempfile
.
NamedTemporaryFile
(
suffix
=
'.png'
)
as
f
:
t
=
torch
.
rand
(
1
,
3
,
1
,
1
)
t
=
torch
.
rand
(
1
,
3
,
1
,
1
)
utils
.
save_image
(
t
,
f
.
name
)
utils
.
save_image
(
t
,
f
.
name
)
self
.
assertTrue
(
os
.
path
.
exists
(
f
.
name
),
'The pixel image is not present after save'
)
self
.
assertTrue
(
os
.
path
.
exists
(
f
.
name
),
'The pixel image is not present after save'
)
@
unittest
.
skipIf
(
'win'
in
sys
.
platform
,
'temporarily disabled on Windows'
)
@
unittest
.
skipIf
(
sys
.
platform
in
(
'win32'
,
'cygwin'
)
,
'temporarily disabled on Windows'
)
def
test_save_image_file_object
(
self
):
def
test_save_image_file_object
(
self
):
with
tempfile
.
NamedTemporaryFile
(
suffix
=
'.png'
)
as
f
:
with
tempfile
.
NamedTemporaryFile
(
suffix
=
'.png'
)
as
f
:
t
=
torch
.
rand
(
2
,
3
,
64
,
64
)
t
=
torch
.
rand
(
2
,
3
,
64
,
64
)
...
@@ -68,7 +68,7 @@ class Tester(unittest.TestCase):
...
@@ -68,7 +68,7 @@ class Tester(unittest.TestCase):
self
.
assertTrue
(
torch
.
equal
(
F
.
to_tensor
(
img_orig
),
F
.
to_tensor
(
img_bytes
)),
self
.
assertTrue
(
torch
.
equal
(
F
.
to_tensor
(
img_orig
),
F
.
to_tensor
(
img_bytes
)),
'Image not stored in file object'
)
'Image not stored in file object'
)
@
unittest
.
skipIf
(
'win'
in
sys
.
platform
,
'temporarily disabled on Windows'
)
@
unittest
.
skipIf
(
sys
.
platform
in
(
'win32'
,
'cygwin'
)
,
'temporarily disabled on Windows'
)
def
test_save_image_single_pixel_file_object
(
self
):
def
test_save_image_single_pixel_file_object
(
self
):
with
tempfile
.
NamedTemporaryFile
(
suffix
=
'.png'
)
as
f
:
with
tempfile
.
NamedTemporaryFile
(
suffix
=
'.png'
)
as
f
:
t
=
torch
.
rand
(
1
,
3
,
1
,
1
)
t
=
torch
.
rand
(
1
,
3
,
1
,
1
)
...
...
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