This repository contains the codes to run tensorflow image recognition with Inception V3 network in ROS. Also, enable users to train their own network model for image recognition.
retrain tensorflow official image recognition(inception v3) model: https://github.com/akshaypai/tfClassifier
runing tensorflow official image recognition(inception v3) in ros: https://github.com/OTL/rostensorflow
*PouChun, Kung ([email protected])
Medium Notes: https://medium.com/@k3083518729/tensorflow-image-recognition-58b0ac77c263
- Install TensorFlow (see tensor flow install guide)
- Install ROS (see http://wiki.ros.org)
$ sudo apt-get install ros-kinetic-cv-bridge ros-kinetic-opencv3
Install camera driver (for example:cv_camera)
$ sudo apt-get install ros-kinetic-cv-camera
Please read official guide. https://www.tensorflow.org/install/install_linux
- publish: /result (std_msgs/String)
- subscribe: /image (sensor_msgs/Image)
Usage
$ roscore
$ rosrun cv_camera cv_camera_node
$ python image_recognition.py image:=/cv_camera/image_raw
$ rostopic echo /result
Download retrain code
$ git clone https://github.com/akshaypai/tfClassifier
$ cd tfClassifier/image_classification
Download dataset(for example:flower_photos dataset)
cd ~
curl -O http://download.tensorflow.org/example_images/flower_photos.tgz
tar xzf flower_photos.tgz
Retrain
python retrain.py --model_dir ./inception --image_dir ~/flower_photos ./output --how_many_training_steps 1000
After retrain process finish you can find ./output.pb and ./labels.txt in /tmp folder .
Move or copy them to ros_inception_v3 folder.
Replace original ./output.pb and ./labels.txt file with new file.
Start test
$ roscore
$ rosrun cv_camera cv_camera_node
$ python image_recognition.py image:=/cv_camera/image_raw
$ rostopic echo /result