ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Using Keras and cv_bridge in ROS melodic

asked 2020-07-28 23:36:31 -0600

fibernutz gravatar image


I am working on a project that involves using Keras to develop a model for detecting traffic signs through a raspberry pi camera. If I run my code in an anaconda environment, I can use Keras and load in the model, but I run into the following error: ImportError: dynamic module does not define module export function (PyInit_cv_bridge_boost).

I then tried to run my code using python2 as opposed to just python. The cv_bridge function works as needed but then I can not load in the Keras model since I believe Keras only works in python 3.

Any help would be greatly appreciated, thanks for your time.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-08-29 16:27:39 -0600

Ishak Khelili gravatar image


I experienced recently the same issue with ROS Kinetic, I ended up understanding that Python 3 wasn't having all the required packages to run Cv_Bridge smoothly, since Cv_Bridge builds for Python 2.7. Also ROS is based on Python 2 which is already deprecated since Jan 1st, 2020.

All I had to do was to install the missing dependencies for python3 and build Cv_Bridge from the official vison_opencv repository. (Please refer to this Stackoverflow answer for detailed instructions) .

And for Keras, you need to have at least Tensorflow 2.2.0 installed, which itself needs python 3 to work properly on your machine. You can work around with Tensorflow 2.1.0 that is supported by python 2.7, but you will be restricted on resources and implementation solutions.


edit flag offensive delete link more

Question Tools

1 follower


Asked: 2020-07-28 23:36:31 -0600

Seen: 448 times

Last updated: Jul 28 '20