Hi @SullyChen
First of all thank you a lot for letting available your code that is very nice to read, plus the DataSet and pre-trained model. It makes it very handy for experimenting with it :)
Before testing on new data, I wanted to verify I installed all correctly, so I wrote a basic test file, to run the model on few samples from the training data. I was thinking it would output values very close to the ground truth. But it is not the case...
What am I missing? Or are the output from the run actually good?
I hope you can help.. :)
In any case again thank you very much
K.
Images tested from the training data set:
['3252.jpg', '3253.jpg', '3254.jpg', '33255.jpg', '33256.jpg', '33257.jpg', '9501.jpg', '9502.jpg', '9503.jpg']
Corresponding values in data.txt file:
3252.jpg 2.420000
3253.jpg 2.420000
3254.jpg 2.420000
33255.jpg -37.210000
33256.jpg -37.210000
33257.jpg -37.310000
9501.jpg -17.240000
9502.jpg -17.450000
9503.jpg -17.550000
Output from the network:
Predicted steering angle: -61.0882010686 degrees ie -1.06619 rad for image: 3252.jpg
Predicted steering angle: -60.9035537346 degrees ie -1.06297 rad for image: 3253.jpg
Predicted steering angle: -60.0010808395 degrees ie -1.04722 rad for image: 3254.jpg
Predicted steering angle: -27.5703796036 degrees ie -0.481194 rad for image: 33255.jpg
Predicted steering angle: -28.3578594338 degrees ie -0.494938 rad for image: 33256.jpg
Predicted steering angle: -36.3197870436 degrees ie -0.6339 rad for image: 33257.jpg
Predicted steering angle: 46.7075895259 degrees ie 0.815201 rad for image: 9501.jpg
Predicted steering angle: 49.5550373342 degrees ie 0.864899 rad for image: 9502.jpg
Predicted steering angle: 52.0180820961 degrees ie 0.907887 rad for image: 9503.jpg
The code for testing:
import tensorflow as tf
import scipy.misc
import model
import cv2
import glob
sess = tf.InteractiveSession()
saver = tf.train.Saver()
saver.restore(sess, "save/model.ckpt")
all_img = glob.glob("*.jpg")
all_img.sort()
for img_path in all_img:
img = cv2.imread(img_path)
image = scipy.misc.imresize(img, [66, 200]) / 255.0
radian = model.y.eval(feed_dict={model.x: [image], model.keep_prob: 1.0})[0][0]
degrees = radian * 180 / scipy.pi
print("Predicted steering angle: " + str(degrees) + " degrees ie "+ str(radian) + " rad for image: "+img_path)