c:\work\ml5js\training-lstm>pip install tensorflow Collecting tensorflow Could not find a version that satisfies the requirement tensorflow (from versions: ) No matching distribution found for tensorflow You are using pip version 18.0, however version 18.1 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.
c:\work\ml5js>pip install tensorflow Collecting tensorflow Could not find a version that satisfies the requirement tensorflow (from versions: ) No matching distribution found for tensorflow
c:\work\ml5js>pip --version pip 18.1 from c:\users\nahok\appdata\local\programs\python\python36-32\lib\site-packages\pip (python 3.6)
c:\work\ml5js>virtualenv --version 16.2.0
しかしインストールできない。
URL指定でもやってみた。
1 2
C:\work\ml5js>pip3 install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.12.0-cp36-cp36m-win_amd64.whl tensorflow-1.12.0-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform.
だめだった。
そして気づく。
おや。ぼくのPython、32bit?
1 2 3
C:\work\ml5js>python Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.
C:\work\ml5js>python Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>>
c:\work\ml5js\training-lstm>python train.py --data_dir=.\mydata Here we go! Reading text file... 0/10500 (epoch 0), train_loss = 8.013, time/batch = 0.963 Model saved to checkpoints\.\mydata\.\mydata! 1/10500 (epoch 0), train_loss = 7.999, time/batch = 0.691 2/10500 (epoch 0), train_loss = 7.961, time/batch = 0.675 (中略) 10497/10500 (epoch 49), train_loss = 1.844, time/batch = 0.602 10498/10500 (epoch 49), train_loss = 1.918, time/batch = 0.614 10499/10500 (epoch 49), train_loss = 1.826, time/batch = 0.593 Model saved to checkpoints\.\mydata\.\mydata! Converting model to ml5js: .\mydata .\mydata-10499 Done! The output model is in models Check https://ml5js.org/docs/training-lstm for more information.
終わった!!
どれくらい時間かかったかわからないんですが。
0.6秒 × 10500 = 105分
くらいでしょうか。
4.自分のデータを使う
LSTM_Textのmodelsフォルダにフォルダごと放り込む。
sketch.jsのデータ指定しているところを変更する。
1 2 3
// Create the LSTM Generator passing it the model directory //charRNN = ml5.charRNN('./models/woolf/', modelReady); charRNN = ml5.charRNN('./models/mydata/', modelReady);
C:\work\python>python c:/work/python/deep-learning-from-scratch-master/ch03/neuralnet_mnist.py Traceback (most recent call last): File "c:/work/python/deep-learning-from-scratch-master/ch03/neuralnet_mnist.py", line 6, in <module> from dataset.mnist import load_mnist ModuleNotFoundError: No module named 'dataset'
C:\work\python>python c:/work/python/deep-learning-from-scratch-master/ch03/mnist_show.py Traceback (most recent call last): File "c:/work/python/deep-learning-from-scratch-master/ch03/mnist_show.py", line 7, in <module> from PIL import Image ModuleNotFoundError: No module named 'PIL'
If you want the voice recognizer service to run automatically when the Pi boots, you need to have a file in the `src` directory named `main.py`. You can make a copy of one of the example scripts and rename it. Then run this command:
pi@raspberrypi:~ $ systemctl status voice-recognizer.service ● voice-recognizer.service - voice recognizer Loaded: loaded (/lib/systemd/system/voice-recognizer.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Sat 2018-12-01 11:49:32 UTC; 1min 54s ago Process: 750 ExecStart=/home/pi/AIY-projects-python/env/bin/python3 -u src/main.py (code=exited, status=203/EXEC) Main PID: 750 (code=exited, status=203/EXEC)
Dec 01 11:49:32 raspberrypi systemd[1]: voice-recognizer.service: Failed with result 'exit-code'. Dec 01 11:49:32 raspberrypi systemd[1]: voice-recognizer.service: Service hold-off time over, scheduling restart. Dec 01 11:49:32 raspberrypi systemd[1]: Stopped voice recognizer. Dec 01 11:49:32 raspberrypi systemd[1]: voice-recognizer.service: Start request repeated too quickly. Dec 01 11:49:32 raspberrypi systemd[1]: Failed to start voice recognizer. Dec 01 11:49:32 raspberrypi systemd[1]: voice-recognizer.service: Unit entered failed state. Dec 01 11:49:32 raspberrypi systemd[1]: voice-recognizer.service: Failed with result 'exit-code'. pi@raspberrypi:~ $ /home/pi/AIY-projects-python/env/bin/python3 -u src/main.py
pi@raspberrypi:~ $ systemctl status voice-recognizer.service ● voice-recognizer.service - voice recognizer Loaded: loaded (/lib/systemd/system/voice-recognizer.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2018-12-01 12:10:45 UTC; 2min 26s ago Main PID: 556 (python3) CGroup: /system.slice/voice-recognizer.service └─556 /usr/bin/python3 -u /home/pi/AIY-projects-python/src/main.py
Dec 01 12:10:45 raspberrypi systemd[1]: Started voice recognizer. Dec 01 12:12:00 raspberrypi python3[556]: Press the button and speak Dec 01 12:12:00 raspberrypi python3[556]: [2018-12-01 12:12:00,698] INFO:recorder:started recording