Saturday, 27 January 2018

Installing opencv in python3

sudo pip3 install opencv-python

Tuesday, 31 October 2017

Keras version error - how to know the version of keras - how to solve

model.add(LSTM(HIDDEN_LAYER_SIZE, dropout=0.2, recurrent_dropout=0.2))
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/", line 475, in add
    output_tensor = layer(self.outputs[0])
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/layers/", line 268, in __call__
    return super(Recurrent, self).__call__(inputs, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/engine/", line 575, in __call__[0])
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/layers/", line 1050, in build
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/legacy/", line 87, in wrapper
    return func(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/engine/", line 396, in add_weight
    weight = K.variable(initializer(shape),
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/layers/", line 1042, in bias_initializer
    self.bias_initializer((self.units * 2,), *args, **kwargs),
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/backend/", line 1709, in concatenate
    return tf.concat([to_dense(x) for x in tensors],axis)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/ops/", line 1075, in concat
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/framework/", line 669, in convert_to_tensor
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/framework/", line 176, in _constant_tensor_conversion_function
    return constant(v, dtype=dtype, name=name)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/framework/", line 165, in constant
    tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape, verify_shape=verify_shape))
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/framework/", line 367, in make_tensor_proto
    _AssertCompatible(values, dtype)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/framework/", line 302, in _AssertCompatible
    (, repr(mismatch), type(mismatch).__name__))
TypeError: Expected int32, got list containing Tensors of type '_Message' instead.

python3 -c 'import keras; print(keras.__version__)'

I only take in concatenate(tensors, axis)
Change this:
return tf.concat([to_dense(x) for x in tensors], axis)  
To this:
return tf.concat(axis,[to_dense(x) for x in tensors])

How to update tensorflo to a specific version or the latest

Specific Version
pip3 install 'tensorflow==1.0.0' --force-reinstall

Latest version
pip3 install tensorflow --upgrade 

Thursday, 26 October 2017

./configure cudnn and cuda sdk

Please specify the CUDA SDK version you want to use, e.g. 7.0. [Leave empty to use system default]: 8.0

Please specify the location where CUDA 8.0 toolkit is installed. Refer to for more details. [Default is /usr/local/cuda]: /Developer/NVIDIA/CUDA-8.0/

Please specify the cuDNN version you want to use. [Leave empty to use system default]: 7
Please specify the location where cuDNN 7 library is installed. Refer to for more details. [Default is /Developer/NVIDIA/CUDA-8.0/]: /Users/zuni/cuda/lib
Please specify a list of comma-separated Cuda compute capabilities you want to build with.
You can find the compute capability of your device at:
Please note that each additional compute capability significantly increases your build time and binary size.

[Default is: "3.5,5.2"]: 5.0

how to check your added paths in mac

cat ~/.bash_profile


# added by Miniconda2 4.3.21 instal/bin:$PATH"
export PATH=“/usr/local/bin:$PATH”/
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:$PATH

# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
export PATH
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:$PATH

# added by Miniconda2 4.3.21 installer
export PATH="/Users/zuni/miniconda2/bin:$PATH"
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:$PATH

Wednesday, 18 October 2017

how to start tensorboard

$pip install tensorflow-tensorboard

$which tensorboard

#if it shows then it is installed

$tensorboard --logdir '<location of your graph file till the folder not the file name>'

open http://localhost:6006/ on a web browser