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
27156ad9
Unverified
Commit
27156ad9
authored
Apr 07, 2021
by
Nicolas Hug
Committed by
GitHub
Apr 07, 2021
Browse files
Bump PIL dependency to >=5.3.0 and run 5.3.0 on some CI runs (#3641)
* bump to 5.3.0 * Also make 3.6 CI runs rely on 5.3.0
parent
f9af70a9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
18 deletions
+19
-18
.circleci/unittest/linux/scripts/install.sh
.circleci/unittest/linux/scripts/install.sh
+6
-0
.circleci/unittest/windows/scripts/install.sh
.circleci/unittest/windows/scripts/install.sh
+6
-0
setup.py
setup.py
+1
-1
torchvision/transforms/functional.py
torchvision/transforms/functional.py
+0
-1
torchvision/transforms/functional_pil.py
torchvision/transforms/functional_pil.py
+6
-16
No files found.
.circleci/unittest/linux/scripts/install.sh
View file @
27156ad9
...
@@ -26,5 +26,11 @@ fi
...
@@ -26,5 +26,11 @@ fi
printf
"Installing PyTorch with %s
\n
"
"
${
cudatoolkit
}
"
printf
"Installing PyTorch with %s
\n
"
"
${
cudatoolkit
}
"
conda
install
-y
-c
"pytorch-
${
UPLOAD_CHANNEL
}
"
-c
conda-forge
"pytorch-
${
UPLOAD_CHANNEL
}
"
::pytorch
"
${
cudatoolkit
}
"
conda
install
-y
-c
"pytorch-
${
UPLOAD_CHANNEL
}
"
-c
conda-forge
"pytorch-
${
UPLOAD_CHANNEL
}
"
::pytorch
"
${
cudatoolkit
}
"
if
[
$PYTHON_VERSION
==
"3.6"
]
;
then
printf
"Installing minimal PILLOW version
\n
"
# Install the minimal PILLOW version. Otherwise, let setup.py install the latest
pip
install
pillow
==
5.3.0
fi
printf
"* Installing torchvision
\n
"
printf
"* Installing torchvision
\n
"
python setup.py develop
python setup.py develop
.circleci/unittest/windows/scripts/install.sh
View file @
27156ad9
...
@@ -28,5 +28,11 @@ fi
...
@@ -28,5 +28,11 @@ fi
printf
"Installing PyTorch with %s
\n
"
"
${
cudatoolkit
}
"
printf
"Installing PyTorch with %s
\n
"
"
${
cudatoolkit
}
"
conda
install
-y
-c
"pytorch-
${
UPLOAD_CHANNEL
}
"
-c
conda-forge
"pytorch-
${
UPLOAD_CHANNEL
}
"
::pytorch
"
${
cudatoolkit
}
"
conda
install
-y
-c
"pytorch-
${
UPLOAD_CHANNEL
}
"
-c
conda-forge
"pytorch-
${
UPLOAD_CHANNEL
}
"
::pytorch
"
${
cudatoolkit
}
"
if
[
$PYTHON_VERSION
==
"3.6"
]
;
then
printf
"Installing minimal PILLOW version
\n
"
# Install the minimal PILLOW version. Otherwise, let setup.py install the latest
pip
install
pillow
==
5.3.0
fi
printf
"* Installing torchvision
\n
"
printf
"* Installing torchvision
\n
"
"
$this_dir
/vc_env_helper.bat"
python setup.py develop
"
$this_dir
/vc_env_helper.bat"
python setup.py develop
setup.py
View file @
27156ad9
...
@@ -67,7 +67,7 @@ requirements = [
...
@@ -67,7 +67,7 @@ requirements = [
pytorch_dep
,
pytorch_dep
,
]
]
pillow_ver
=
' >=
4.1.1
'
pillow_ver
=
' >=
5.3.0
'
pillow_req
=
'pillow-simd'
if
get_dist
(
'pillow-simd'
)
is
not
None
else
'pillow'
pillow_req
=
'pillow-simd'
if
get_dist
(
'pillow-simd'
)
is
not
None
else
'pillow'
requirements
.
append
(
pillow_req
+
pillow_ver
)
requirements
.
append
(
pillow_req
+
pillow_ver
)
...
...
torchvision/transforms/functional.py
View file @
27156ad9
...
@@ -55,7 +55,6 @@ pil_modes_mapping = {
...
@@ -55,7 +55,6 @@ pil_modes_mapping = {
}
}
_is_pil_image
=
F_pil
.
_is_pil_image
_is_pil_image
=
F_pil
.
_is_pil_image
_parse_fill
=
F_pil
.
_parse_fill
def
_get_image_size
(
img
:
Tensor
)
->
List
[
int
]:
def
_get_image_size
(
img
:
Tensor
)
->
List
[
int
]:
...
...
torchvision/transforms/functional_pil.py
View file @
27156ad9
...
@@ -3,7 +3,7 @@ from typing import Any, List, Sequence
...
@@ -3,7 +3,7 @@ from typing import Any, List, Sequence
import
numpy
as
np
import
numpy
as
np
import
torch
import
torch
from
PIL
import
Image
,
ImageOps
,
ImageEnhance
,
__version__
as
PILLOW_VERSION
from
PIL
import
Image
,
ImageOps
,
ImageEnhance
try
:
try
:
import
accimage
import
accimage
...
@@ -147,7 +147,7 @@ def pad(img, padding, fill=0, padding_mode="constant"):
...
@@ -147,7 +147,7 @@ def pad(img, padding, fill=0, padding_mode="constant"):
raise
ValueError
(
"Padding mode should be either constant, edge, reflect or symmetric"
)
raise
ValueError
(
"Padding mode should be either constant, edge, reflect or symmetric"
)
if
padding_mode
==
"constant"
:
if
padding_mode
==
"constant"
:
opts
=
_parse_fill
(
fill
,
img
,
"2.3.0"
,
name
=
"fill"
)
opts
=
_parse_fill
(
fill
,
img
,
name
=
"fill"
)
if
img
.
mode
==
"P"
:
if
img
.
mode
==
"P"
:
palette
=
img
.
getpalette
()
palette
=
img
.
getpalette
()
image
=
ImageOps
.
expand
(
img
,
border
=
padding
,
**
opts
)
image
=
ImageOps
.
expand
(
img
,
border
=
padding
,
**
opts
)
...
@@ -242,18 +242,8 @@ def resize(img, size, interpolation=Image.BILINEAR, max_size=None):
...
@@ -242,18 +242,8 @@ def resize(img, size, interpolation=Image.BILINEAR, max_size=None):
@
torch
.
jit
.
unused
@
torch
.
jit
.
unused
def
_parse_fill
(
fill
,
img
,
min_pil_version
,
name
=
"fillcolor"
):
def
_parse_fill
(
fill
,
img
,
name
=
"fillcolor"
):
# Process fill color for affine transforms
# Process fill color for affine transforms
major_found
,
minor_found
=
(
int
(
v
)
for
v
in
PILLOW_VERSION
.
split
(
'.'
)[:
2
])
major_required
,
minor_required
=
(
int
(
v
)
for
v
in
min_pil_version
.
split
(
'.'
)[:
2
])
if
major_found
<
major_required
or
(
major_found
==
major_required
and
minor_found
<
minor_required
):
if
fill
is
None
:
return
{}
else
:
msg
=
(
"The option to fill background area of the transformed image, "
"requires pillow>={}"
)
raise
RuntimeError
(
msg
.
format
(
min_pil_version
))
num_bands
=
len
(
img
.
getbands
())
num_bands
=
len
(
img
.
getbands
())
if
fill
is
None
:
if
fill
is
None
:
fill
=
0
fill
=
0
...
@@ -276,7 +266,7 @@ def affine(img, matrix, interpolation=0, fill=None):
...
@@ -276,7 +266,7 @@ def affine(img, matrix, interpolation=0, fill=None):
raise
TypeError
(
'img should be PIL Image. Got {}'
.
format
(
type
(
img
)))
raise
TypeError
(
'img should be PIL Image. Got {}'
.
format
(
type
(
img
)))
output_size
=
img
.
size
output_size
=
img
.
size
opts
=
_parse_fill
(
fill
,
img
,
'5.0.0'
)
opts
=
_parse_fill
(
fill
,
img
)
return
img
.
transform
(
output_size
,
Image
.
AFFINE
,
matrix
,
interpolation
,
**
opts
)
return
img
.
transform
(
output_size
,
Image
.
AFFINE
,
matrix
,
interpolation
,
**
opts
)
...
@@ -285,7 +275,7 @@ def rotate(img, angle, interpolation=0, expand=False, center=None, fill=None):
...
@@ -285,7 +275,7 @@ def rotate(img, angle, interpolation=0, expand=False, center=None, fill=None):
if
not
_is_pil_image
(
img
):
if
not
_is_pil_image
(
img
):
raise
TypeError
(
"img should be PIL Image. Got {}"
.
format
(
type
(
img
)))
raise
TypeError
(
"img should be PIL Image. Got {}"
.
format
(
type
(
img
)))
opts
=
_parse_fill
(
fill
,
img
,
'5.2.0'
)
opts
=
_parse_fill
(
fill
,
img
)
return
img
.
rotate
(
angle
,
interpolation
,
expand
,
center
,
**
opts
)
return
img
.
rotate
(
angle
,
interpolation
,
expand
,
center
,
**
opts
)
...
@@ -294,7 +284,7 @@ def perspective(img, perspective_coeffs, interpolation=Image.BICUBIC, fill=None)
...
@@ -294,7 +284,7 @@ def perspective(img, perspective_coeffs, interpolation=Image.BICUBIC, fill=None)
if
not
_is_pil_image
(
img
):
if
not
_is_pil_image
(
img
):
raise
TypeError
(
'img should be PIL Image. Got {}'
.
format
(
type
(
img
)))
raise
TypeError
(
'img should be PIL Image. Got {}'
.
format
(
type
(
img
)))
opts
=
_parse_fill
(
fill
,
img
,
'5.0.0'
)
opts
=
_parse_fill
(
fill
,
img
)
return
img
.
transform
(
img
.
size
,
Image
.
PERSPECTIVE
,
perspective_coeffs
,
interpolation
,
**
opts
)
return
img
.
transform
(
img
.
size
,
Image
.
PERSPECTIVE
,
perspective_coeffs
,
interpolation
,
**
opts
)
...
...
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