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

How to use a trained learning model (.sav) in ROS python node?

asked 2021-12-07 15:25:03 -0500

Emad gravatar image

updated 2021-12-08 15:44:30 -0500

osilva gravatar image

Hello,

I created a learning model (by MLP method) by using the Jupyter notebook. Now, I want to use it in a ROS python node. How I can load the trained model?

In Jupyter notebook, I can use the following code to load a trained model:

# load the model from disk
1) filename = r"C:\Users\....\TrainedModelName.sav"
2) loaded_model = pickle.load(open(filename, 'rb'))

However, by using code line 1 in the ROS python node, I receive the error. (I changed the address according to the Ubuntu directory)

edit retag flag offensive close merge delete

Comments

Have you installed the libraries in your system?

osilva gravatar image osilva  ( 2021-12-07 16:50:50 -0500 )edit

Yes, all were installed.

Emad gravatar image Emad  ( 2021-12-19 20:31:55 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-12-19 20:33:51 -0500

Emad gravatar image

I was using "~" for the directory. When I used "home/my username/" the problem was solved.

edit flag offensive delete link more

Comments

Glad you found the issue. Thank you for sharing

osilva gravatar image osilva  ( 2021-12-19 20:36:09 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2021-12-07 15:25:03 -0500

Seen: 104 times

Last updated: Dec 19 '21