I don't seem to be able to use TFLearn at all. Whenever I try to run it, Thread 3 in Python crashes, showing this error.
I installed TensorFlow and TFLearn a day ago and I was trying to test this tutorial code: https://medium.com/@ageitgey/machine-learning-is-fun-part-3-deep-learning-and-convolutional-neural-networks-f40359318721
Using:
Windows 10, Python 3.6
Anaconda 4.4.10
TensorFlow 1.5
TFLearn 0.32
Full console log:
C:\ProgramData\Anaconda3\lib\site-packages\h5py__init__.py:34: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
from ._conv import register_converters as _register_converters
curses is not supported on this machine (please install/reinstall curses for an optimal experience)
WARNING:tensorflow:From C:\ProgramData\Anaconda3\lib\site-packages\tflearn\initializations.py:119: UniformUnitScaling.__init__ (from tensorflow.python.ops.init_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.initializers.variance_scaling instead with distribution=uniform to get equivalent behavior.
WARNING:tensorflow:From C:\ProgramData\Anaconda3\lib\site-packages\tflearn\objectives.py:66: calling reduce_sum (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version.
Instructions for updating:
keep_dims is deprecated, use keepdims instead
Run id: fire-classifier
Preprocessing... Calculating mean over all dataset (this may take long)...
add_featurewise_zero_center)Preprocessing... Calculating std over all dataset (this may take long)...
add_featurewise_stdnorm)Training samples: 583
Exception in thread Thread-3:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "C:\ProgramData\Anaconda3\lib\threading.py", line 864, in run
self._target(self._args, *self._kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\tflearn\data_flow.py", line 195, in fill_feed_dict_queue
data[k] = self.dprep_dict[k].apply(data[k])
File "C:\ProgramData\Anaconda3\lib\site-packages\tflearn\data_preprocessing.py", line 46, in apply
batch = m(batch)
File "C:\ProgramData\Anaconda3\lib\site-packages\tflearn\data_preprocessing.py", line 216, in _featurewise_zero_center
batch[i] -= self.global_mean.value
TypeError: Cannot cast ufunc subtract output from dtype('float64') to dtype('uint8') with casting rule 'same_kind'
Same problem
TypeError Traceback (most recent call last)
----> 1 S = p.predict('./imagenes/jumbo_roja/jumbo_roja6.jpg')
41 im = (np.array(im))
42 # Predict
---> 43 prediction = self.model.predict(im)
44 return prediction
45
~/anaconda3/lib/python3.6/site-packages/tflearn/models/dnn.py in predict(self, X)
255 """
256 feed_dict = feed_dict_builder(X, None, self.inputs, None)
--> 257 return self.predictor.predict(feed_dict)
258
259 def predict_label(self, X):
~/anaconda3/lib/python3.6/site-packages/tflearn/helpers/evaluator.py in predict(self, feed_dict)
61 if len(dprep_dict) > 0:
62 for k in dprep_dict:
---> 63 feed_dict[k] = dprep_dict[k].apply(feed_dict[k])
64
65 # Prediction for each tensor
~/anaconda3/lib/python3.6/site-packages/tflearn/data_preprocessing.py in apply(self, batch)
44 batch = m(batch, *self.args[i])
45 else:
---> 46 batch = m(batch)
47 return batch
48
~/anaconda3/lib/python3.6/site-packages/tflearn/data_preprocessing.py in _featurewise_zero_center(self, batch)
214 def _featurewise_zero_center(self, batch):
215 for i in range(len(batch)):
--> 216 batch[i] -= self.global_mean.value
217 return batch
218
TypeError: ufunc 'subtract' output (typecode 'O') could not be coerced to provided output parameter (typecode 'B') according to the casting rule ''same_kind''
Now I get this error
TypeError: ufunc 'subtract' output (typecode 'O') could not be coerced to provided output parameter (typecode 'd') according to the casting rule ''same_kind''
use this link to solve... it works for me.
This has been solved by an update. Closing the issue.
use this link to solve... it works for me.
So good,tnX!!!
Most helpful comment
Now I get this error
TypeError: ufunc 'subtract' output (typecode 'O') could not be coerced to provided output parameter (typecode 'd') according to the casting rule ''same_kind''