でOpenCL のライブラリがないということかな?./csim.exe: error while loading shared libraries: libOpenCL.so.1
ということだったので、早速インストールした。sudo apt update
sudo apt install ocl-icd-opencl-dev
Straight error is 0
Left error is 0
*test_images_171129/right_turn_test8.bmp
correct data = 2, outs = 1
dot2[0] = -1.498047 dot2[1] = 1.787109 dot2[2] = -0.345703
Right error is 1
x_train shape: (34650, 1, 10, 56)
y_train shape: (34650,)
x_train shape: (34650, 10, 56, 1)
34650 train samples
26550 test samples
Train on 34650 samples, validate on 26550 samples
Epoch 1/8
34650/34650 [==============================] - 5s 154us/step - loss: 0.4760 - acc: 0.8065 - val_loss: 0.2648 - val_acc: 0.9200
Epoch 2/8
34650/34650 [==============================] - 5s 150us/step - loss: 0.2083 - acc: 0.9254 - val_loss: 0.2098 - val_acc: 0.9264
Epoch 3/8
34650/34650 [==============================] - 5s 151us/step - loss: 0.1419 - acc: 0.9484 - val_loss: 0.1368 - val_acc: 0.9551
Epoch 4/8
34650/34650 [==============================] - 5s 149us/step - loss: 0.1098 - acc: 0.9595 - val_loss: 0.1200 - val_acc: 0.9601
Epoch 5/8
34650/34650 [==============================] - 5s 150us/step - loss: 0.0908 - acc: 0.9668 - val_loss: 0.1065 - val_acc: 0.9650
Epoch 6/8
34650/34650 [==============================] - 5s 149us/step - loss: 0.0753 - acc: 0.9724 - val_loss: 0.1002 - val_acc: 0.9650
Epoch 7/8
34650/34650 [==============================] - 5s 152us/step - loss: 0.0645 - acc: 0.9763 - val_loss: 0.0983 - val_acc: 0.9666
Epoch 8/8
34650/34650 [==============================] - 5s 149us/step - loss: 0.0546 - acc: 0.9805 - val_loss: 0.0872 - val_acc: 0.9705
hw_err_cnt = 13, sw_err_cnt = 16
hw accuracy = 95.666665%, sw accuracy = 94.666666%
hw_err_cnt = 4, sw_err_cnt = 6
hw accuracy = 98.666668%, sw accuracy = 98.000002%
hw_err_cnt = 27, sw_err_cnt = 25
hw accuracy = 91.000003%, sw accuracy = 91.666669%
x_test_str = x_test_str[1:] # 文字列の内で最初の文字を削除
x_test_str = x_test_str[:-1] # 文字列の内で最後の文字を削除
# 白線走行用テスト・データをCの配列に出力し、ファイルに書き込み
# 2018/07/30 by marsee
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
from dataset_curve.curve_dataset import load_mnist
import numpy as np
import datetime
OUTPUT_DATA_NUM = 1000 # 出力するMNISTのテストデータ数 10000までの数
OFFSET = 0 # MNISTデータセットのオフセット、100だったら100番目からOUTPUT_DATA_NUM個を出力する
# データの読み込み
(x_train, y_train), (x_test, y_test) = load_mnist(normalize=False, flatten=False)
# トレーニングデータとテストデータをシャッフル
trainzip = list(zip(y_train, x_train))
np.random.shuffle(trainzip)
y_train, x_train = zip(*trainzip)
x_train = np.asarray(x_train)
y_train = np.asarray(y_train)
testzip = list(zip(y_test, x_test))
np.random.shuffle(testzip)
y_test, x_test = zip(*testzip)
x_test = np.asarray(x_test)
y_test = np.asarray(y_test)
img_rows, img_cols = 10, 56
x_train = x_train.reshape(x_train.shape[0], img_rows, img_cols, 1)
x_test = x_test.reshape(x_test.shape[0], img_rows, img_cols, 1)
input_shape = (img_rows, img_cols, 1)
x_train = x_train.astype('float32')
x_test = x_test.astype('float32')
x_train /= 256
x_test /= 256
print(x_test.shape)
f = open("curve_line_data.h", 'w')
todaytime = datetime.datetime.today()
f.write('// curve_line_data.h\n')
strdtime = todaytime.strftime("%Y/%m/%d %H:%M:%S")
f.write('// {0} by marsee\n'.format(strdtime))
f.write("\n")
f.write('ap_ufixed<8, 0, AP_TRN, AP_WRAP> x_test['+str(OUTPUT_DATA_NUM)+']['+str(x_test.shape[1]*x_test.shape[2])+'] = {\n')
for i in range(OFFSET, OFFSET+OUTPUT_DATA_NUM):
f.write("\t{")
for j in range(x_test.shape[1]):
for k in range(x_test.shape[2]):
if (x_test[i][j][k] == 1.0):
x_test[i][j][k] = x_test[i][j][k] * 256
x_test[i][j][k] = (x_test[i][j][k]-1)/256
x_test_str = str(x_test[i][j][k])
x_test_str = x_test_str[1:] # 文字列の内で最初の文字を削除
x_test_str = x_test_str[:-1] # 文字列の内で最後の文字を削除
f.write(x_test_str)
if (j==x_test.shape[1]-1 and k==x_test.shape[2]-1):
if (i==OFFSET+OUTPUT_DATA_NUM-1):
f.write("}\n")
else:
f.write("},\n")
else:
f.write(", ")
f.write("};\n")
f.write('int x_test_256['+str(OUTPUT_DATA_NUM)+']['+str(x_test.shape[1]*x_test.shape[2])+'] = {\n')
for i in range(OFFSET, OFFSET+OUTPUT_DATA_NUM):
f.write("\t{")
for j in range(x_test.shape[1]):
for k in range(x_test.shape[2]):
f.write(str(int(x_test[i][j][k]*256)))
if (j==x_test.shape[1]-1 and k==x_test.shape[2]-1):
if (i==OFFSET+OUTPUT_DATA_NUM-1):
f.write("}\n")
else:
f.write("},\n")
else:
f.write(", ")
f.write("};\n")
f.write("\n")
f.write('int y_test['+str(OUTPUT_DATA_NUM)+'] = {\n')
for i in range(OFFSET, OFFSET+OUTPUT_DATA_NUM):
f.write(str(y_test[i]))
if (i==OFFSET+OUTPUT_DATA_NUM-1):
f.write("};\n")
else:
f.write(", ")
f.close()
日 | 月 | 火 | 水 | 木 | 金 | 土 |
---|---|---|---|---|---|---|
- | - | - | - | 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | - |