2018年4月29日日曜日

ディオンのリモコン電池交換

三菱ディオンの鍵についている電池を交換した。種類はCR1616だった。

給油(アウトバック)

レギュラーガソリン55.82L給油。140円/L。ODO:58793km, Trip:453.8km。8.13km/L

2018年4月10日火曜日

bd-1購入(birdy)

昨年の12月に購入したBD-1で近所の公園を散歩した。

2018年3月3日土曜日

アウトバックの車検

アウトバックの車検(H30 1月)で交換したもの
・左右ロアーボールジョイントブーツ
・ブレーキフルード
・タイヤローテーション
・エアーエレメント
・エンジンオイル
・前後のワイパーブレード
・サンフレア(非常信号用具)
・エアコンフィルター
・下廻り防錆コーティング

2018年2月9日金曜日

Anacondaで初期フォルダを変更する

Anacondaスタートメニューから「Anaconda Prompt」をクリックするとプロンプトが立ち上がるので、
jupyter notebook --generate-configと打つ。

次にスタートメニューのJupyterNotebookを右クリックして、そのメニューから「ファイルの場所を開く」をクリック。

そうすると「/ユーザー/自分の名前/.jupyter」に「jupyter_notebook_config.py」ができているので、エディタで開いて202行目を見ると
#c.NotebookApp.notebook_dir = ''
となっているので、行頭の#をとって''の間に作業したいフォルダ名を書く。(例 D:/jupyter)

次に、スタートメニューの「Jupyter Notebook」を右クリックして、プロパティを開けて、作業フォルダーの名前も変更する。また、「リンク先」の最後に「%USERPROFILE%」の記述がある場合は、その部分を削除する。


参考リンク先
PYTHON Jupyter Notebookを開くいてでてくるフォルダ一覧について
Python:Jupyter Notebookの初期ディレクトリが変わらない時の対処方法






給油(ディオン)

レギュラーガソリン50.95L給油。140円/L。ODO:79406km, Trip:433.0km。8.50km/L。

2018年1月15日月曜日

画像認識プログラム(Tensorflow, Keras使用)

#! /usr/bin/python3

import os
os.environ[ 'TF_CPP_MIN_LOG_LEVEL'] = '2'

import numpy as np
import matplotlib.pyplot as plt

import keras

from keras.utils import np_utils
from keras.layers.convolutional import Conv2D, MaxPooling2D
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.preprocessing.image import array_to_img, img_to_array, list_pictures, load_img

from sklearn.model_selection import train_test_split

from PIL import Image

X = []
Y = []

# サンプル入力
for picture in list_pictures('./samle'):
 img = img_to_array(load_img(picture, grayscale=True, target_size=(200,200)))
 X.append(img)
 Y.append(0)


# 参考情報入力
for picture in list_pictures('./reference'):
 img = img_to_array(load_img(picture, grayscale=True, target_size=(200,200)))
 X.append(img)
 Y.append(1)

X = np.asarray(X)
Y = np.asarray(Y)
X = X.astype('float32')
X = X / 255.0

Y = np_utils.to_categorical(Y, 2)
indices = np.array(range(X.shape[0]))


# 学習用データとテストデータ
X_train, X_test, Y_train, Y_test, indices_train, indices_test = train_test_split(X, Y, indices, test_size=0.2, random_state=111)



print('X shape:', X.shape)
print('Y shape:', Y.shape)
print(X.shape[0], 'all samples')    # すべてのサンプル数
print('X_train shape:', X_train.shape)
print('X_test shape:', X_test.shape)
print('Y_train shape:', Y_train.shape)
print('Y_test shape:', Y_test.shape)
print(X_train.shape[0], 'train samples')    # 訓練サンプル数
print(X_test.shape[0], 'test samples')    # テストサンプル数

#----------------------------------------------------------------------------------------------------------------------------------

#plt.imshow(X[100])    # 入力画像の例を表示
#plt.imshow(X_test[100].reshape([40, 40]))    # 入力画像の例を表示
#plt.gray()

#print(X_train[100])
#print(X_test[100])
#print(Y_train[100])
#print(Y_test[100])

#---------------------------------------------------------------------------------------------------------------------------------
# CNNのモデルの作成

model = Sequential()

model.add(Conv2D(32, (3, 3), activation='relu', input_shape=(200, 200, 1)))
model.add(Dropout(0.5))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Conv2D(64, (3, 3), activation='relu'))
model.add(Dropout(0.5))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Flatten())
model.add(Dense(32, activation='relu'))
model.add(Dense(2, activation='softmax'))

model.summary()        # モデル情報の表示

#-------------------------------------------------------------------------------------------------------------------------------------
batch_size = 128         # バッチサイズ
nb_epoch = 10           # 繰り返し回数

#--------------------------------------------------------------------------------------------------------------------------------------
# 学習パラメータの設定
model.compile(loss='categorical_crossentropy',
              optimizer='adam', metrics=['accuracy'])

# モデルの学習
history = model.fit(X_train, Y_train,
                    batch_size=batch_size, epochs=nb_epoch,
                    validation_data=(X_test, Y_test))

# 学習結果の評価
score = model.evaluate(X_test, Y_test, verbose=0)
print('Test score:', score[0])
print('Test accuracy:', score[1])

2017年12月29日金曜日

lubuntuでupgradeできなくなるエラー(16.04.3 LTS)

sudo apt upgrade
を入力すると、
grub-pc (2.02~beta2-36ubuntu3.14) を設定しています ...
/var/lib/dpkg/info/grub-pc.config: 15: /etc/default/grub: GRUB_SAVEDEFAULT:GRUB_SAVEDEFAULT=true: not found

パッケージ grub-pc の処理中にエラーが発生しました

というエラーメッセージが表示される。

etc/defaut/grub中の

GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT:GRUB_SAVEDEFAULT=true

の先頭にコメントアウトを下記のようにつけると、無事、upgradeできた。

#GRUB_DEFAULT=saved
#GRUB_SAVEDEFAULT:GRUB_SAVEDEFAULT=true

2017年12月12日火曜日

給油(ディオン)

レギュラーガソリン51.33L給油。129円/L。ODO:78973km, Trip:463.7km。9.03km/L。

2017年11月4日土曜日

trek1000:グリスアップ

trek1000の前後ハブグリスアップとブレーキを105に交換した。