Category: Troubleshooting

  • Using model.fit() instead of fit_generator() with Data Generators – TF.Keras

    Using model.fit() instead of fit_generator() with Data Generators – TF.Keras

    If you have been using data generators in Keras, such as ImageDataGenerator for augment and load the input data, then you would be familiar with the using the *_generator() methods (fit_generator(), evaluate_generator(), etc.) to pass the generators when trainning the model.  But recently, if you have switched to TensorFlow 2.1 or later (and tf.keras), you might…

  • Fixing the KeyError: ‘acc’ and KeyError: ‘val_acc’ Errors in Keras 2.3.x

    Have you been using the ‘History’ object returned by the fit() functions of Keras to graph or visualize the training history of your models? And have you been getting a ‘KeyError’ type error such as the following since recent Keras upgrade and wondering why? Traceback (most recent call last): File “lenet_mnist_keras.py”, line 163, in <module>…

  • Cleaning up your Anaconda installations

    If you’ve been using Anaconda Python for a while, and been creating multiple environments and adding/removing packages, you may have noticed that it’s starting to take up a lot of disk space (sometimes tens of GBs). Anaconda installation can get big One reason is that anaconda environments are completely isolated workspaces from each other with…

  • Failed Attempts at Building TensorFlow GPU from Source

    For the last 3 weeks, I’ve been trying to build TensorFlow from source. I wanted to get TensorFlow GPU version working on Windows with CUDA 9.2 and cuDNN 7.1. Since the pre-built wheels only work with CUDA 9.0, the only way we can get it working with 9.2 is to build it ourselves from source.…

  • Fixing the Matplotlib PyPlot import errors

    About a week back, I was reinstalling Keras, TensorFlow and all the other libraries after a reformat of my PC. When I started verifying the library installations, I came across a strange error. When I tried to run a simple deep learning model, Python runtime crashed. As soon as I execute the script I was…

  • Migrating a Model to Keras 2.0

    Keras v2.0 has been released for a couple of months now – v2.0.0 released on 5th May, 2017, while the latest version is 2.0.8 at the time of this writing. It brought in a lot of new features and improvements, but also made some syntax changes. Trying to run a code with the old syntax…

  • What is the image_data_format parameter in Keras, and why is it important

    We’ve talked about the image_dim_ordering parameter in Keras and why is it important. But since from Keras v2 changed the name of the parameter, I thought of bringing this up again. As you know, Keras  is a higher-level neural networks library for Python, which is capable of running on top of TensorFlow, CNTK (Microsoft Cognitive…

  • image_data_format vs. image_dim_ordering in Keras v2

    If you have been using Keras for some time, then you would probably know the image_dim_ordering parameter of Keras. Specially, if you switch between TensorFlow and Theano backends frequently when using Keras. When I first started using Keras for image classification, most of my experiments failed because I have set the image_dim_ordering incorrectly. Learning from…

  • How to solve CNMEM_STATUS_OUT_OF_MEMORY error with Theano on CUDA

    Have yo come across the CNMEM_STATUS_OUT_OF_MEMORY error when using Theano with CUDA, with Keras? You might have been trying to train a slightly larger model, and just when the training starts it throws this error and fails. The CNMEM_STATUS_OUT_OF_MEMORY thrown in Theano with CUDA The full error stack looks something like this, Traceback (most recent call…