Model trained by Google Colab cannot run in Donkey Car

Image for post
Image for post

Today I am running my colab notebook to train the model for donkey car and notice that the default tensorflow runtime has been upgraded to tensorflow 1.15.0. I actually don’t care about it until I run the model on donkey car and the following error happen

loading model models/tub3.h5
Traceback (most recent call last):
File "/home/pi/env/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/input_layer.py", line 81, in __init__
raise ValueError('Unrecognized keyword arguments:', kwargs.keys())
ValueError: ('Unrecognized keyword arguments:', dict_keys(['ragged']))

I have omitted some of the error for simplicity but the problem looks like it is caused by incompatible version of tensorflow. The first thing I tried is to downgrade the tensorflow model to colab but it doesn’t work. The latest colab doesn’t like tensorflow 1.13.1

Image for post
Image for post

So it leave me no choice but to download and install tensorflow 1.15.0 on pi. The problem is, I am running on buster and therefore running python 3.7. If you just simply do a pip install tensorflow==1.15.0 it won’t work because it is not available on the repository yet. Someone is kind enough to put the compiled version on github and you can download it here. To install it, just run this command on the pi:

wget https://github.com/PINTO0309/Tensorflow-bin/raw/master/tensorflow-1.15.0-cp37-cp37m-linux_armv7l.whl
pip install tensorflow-1.15.0-cp37-cp37m-linux_armv7l.whl

After installing it, you should be able to run the model.

Written by

Love Self-driving technology and machine learning. Community leader in DIYRobocar Hong Kong.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store