Skip to content

Commit c716c1b

Browse files
Evan Lezarmartinwicke
Evan Lezar
authored andcommitted
Import scipy.ndimage before tensorflow to fix jpeg load. (tensorflow#165)
When importing tensorflow before scipi.ndimage and running the example in a docker container, the following error is given: ``` % python example.py Traceback (most recent call last): File "example.py", line 25, in <module> im = im / 255. TypeError: unsupported operand type(s) for /: 'instance' and 'float' ``` This only happens for 'cat.jpg'. When converting the image to a '.png' file, the example runs as expected. When swapping the imports around so that scipy.ndimage is imported BEFORE tensorflow, both 'jpg' and 'png' files work.
1 parent e6b6fb3 commit c716c1b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

transformer/example.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
# ==============================================================================
15+
from scipy import ndimage
1516
import tensorflow as tf
1617
from spatial_transformer import transformer
17-
from scipy import ndimage
1818
import numpy as np
1919
import matplotlib.pyplot as plt
2020

0 commit comments

Comments
 (0)