Comments (9)
Hey, can you please send me the error message?
PIL is used for some pre-processing and utility functions in TFLearn.
from tflearn.
i test it on jupyter notebook.
import tflearn
import numpy as np
from PIL import Image
img_path = "...img_path..."
Image.open(img_path)
Error log:
---------------------------------------------------------------------------
IOError Traceback (most recent call last)
/usr/local/lib/python2.7/dist-packages/IPython/core/formatters.pyc in __call__(self, obj)
341 method = _safe_get_formatter_method(obj, self.print_method)
342 if method is not None:
--> 343 return method()
344 return None
345 else:
/usr/local/lib/python2.7/dist-packages/PIL/Image.pyc in _repr_png_(self)
617 from io import BytesIO
618 b = BytesIO()
--> 619 self.save(b, 'PNG')
620 return b.getvalue()
621
/usr/local/lib/python2.7/dist-packages/PIL/Image.pyc in save(self, fp, format, **params)
1656
1657 # may mutate self!
-> 1658 self.load()
1659
1660 save_all = False
/usr/local/lib/python2.7/dist-packages/PIL/ImageFile.pyc in load(self)
233 if not self.map and not LOAD_TRUNCATED_IMAGES and e < 0:
234 # still raised if decoder fails to return anything
--> 235 raise_ioerror(e)
236
237 # post processing
/usr/local/lib/python2.7/dist-packages/PIL/ImageFile.pyc in raise_ioerror(error)
57 if not message:
58 message = "decoder error %d" % error
---> 59 raise IOError(message + " when reading image file")
60
61
IOError: broken data stream when reading image file
Out[1] : <PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=84x256 at 0x7FDF4DA8EC10>
import numpy as np
from PIL import Image
img_path = "...img_path..."
Image.open(img_path)
Out[1] : display image
from tflearn.
I think this is an issue with PIL, maybe try to update pillow.
from tflearn.
pillow version is 3.2.0.(latest)
so.. i reinstall pillow but, result is same.
from tflearn.
You can try to
sudo apt-get install libjpeg8-dev
And reinstall pillow
from tflearn.
libjpeg8-dev is already the newest version.
I also reinstall libjpeg8-dev and Pillow.
result is same.
My desktop's os is Ubuntu 14.04 LTS.
I will debug this problem.
When i figure it out, i'll tell you.
from tflearn.
Ok thanks!
from tflearn.
This problem is tensorflow's Issue.
TensorFlow_0.8.0 somehow breaks PIL ? #2101
scikit-image/scikit-image#2000
Simple solution is
from PIL import Image
import tensorflow as tf
or
Use TensorFlow 0.7.1 version. (It is the 0.8.0 version's problem)
from tflearn.
I can confirm this error when running alexnet.py with TensorFlow 0.8:
Starting to parse images... Traceback (most recent call last): File "alexnet.py", line 27, in <module> X, Y = oxflower17.load_data(one_hot=True) File "/usr/local/lib/python2.7/dist-packages/tflearn/datasets/oxflower17.py", line 34, in load_data categorical_Y=one_hot) File "/usr/local/lib/python2.7/dist-packages/tflearn/data_utils.py", line 227, in build_image_dataset_from_dir X, Y = image_dirs_to_samples(directory, resize, convert_gray, filetypes) File "/usr/local/lib/python2.7/dist-packages/tflearn/data_utils.py", line 210, in image_dirs_to_samples samples[i] = resize_image(samples[i], resize[0], resize[1]) File "/usr/local/lib/python2.7/dist-packages/tflearn/data_utils.py", line 184, in resize_image img = in_image.resize((new_width, new_height), resize_mode) File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 1538, in resize self.load() File "/usr/local/lib/python2.7/dist-packages/PIL/ImageFile.py", line 235, in load raise_ioerror(e) File "/usr/local/lib/python2.7/dist-packages/PIL/ImageFile.py", line 59, in raise_ioerror raise IOError(message + " when reading image file") IOError: broken data stream when reading image file
And import PIL before TensorFlow fixed this error.
from tflearn.
Related Issues (20)
- HELLO? ANYBODY HOME? HOT 1
- Syntax warnings due to comparison of literals using is
- Error in TF2.0... Any ideas? HOT 3
- #001 'unicodeescape' code can't decode bytes in position 2-3: truncated \UXXXXXXXX escape HOT 1
- Update required HOT 1
- Not working with tensorflow 2.3.1 HOT 5
- Import error
- ValueError: Cannot feed value of shape (61,) for Tensor 'InputData/X:0', which has shape '(?, 61)' HOT 1
- Examples
- Xception Example model
- def variance_scaling in initializations.py tries to call deprecated class
- LSTM stateful?
- why i got same number with Alexnet ? HOT 1
- Why tflearn disables executing eagerly ? HOT 2
- OSS License compatibility question
- tflearn import issue HOT 5
- Pillow 10 breaks tflearn import HOT 2
- Requesting Review for pull request #1176
- Use github.com/apssouza22/chatflow as a conversational layer. It would enable actual API requests to be carried out from natural language inputs.
- tflearn HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tflearn.