LoginSignup
0
0

More than 5 years have passed since last update.

convnet.jsで7セグメントLED

Last updated at Posted at 2019-01-23

概要

convnet.jsで7セグメントLED、学習してみた。

写真

モデルを作って、教師データを学習する。

dataset

var data = [
    [0, 0, 0, 0],
    [1, 0, 0, 0], 
    [0, 1, 0, 0],
    [1, 1, 0, 0], 
    [0, 0, 1, 0],
    [1, 0, 1, 0],
    [0, 1, 1, 0],
    [1, 1, 1, 0],
    [0, 0, 0, 1], 
    [1, 0, 0, 1]];
var labels = [
    [1, 1, 0, 1, 1, 1, 1], 
    [1, 1, 1, 1, 1, 1, 1],
    [0, 1, 0, 0, 1, 1, 1],
    [1, 1, 1, 1, 1, 0, 1],
    [1, 1, 0, 1, 1, 0, 1],
    [1, 1, 0, 0, 1, 1, 0], 
    [1, 0, 0, 1, 1, 1, 1], 
    [1, 0, 1, 1, 0, 1, 1],
    [0, 0, 0, 0, 1, 1, 0], 
    [0, 1, 1, 1, 1, 1, 1]];

model

net.makeLayers([{
    type: 'input', 
    out_sx: 1,
    out_sy: 1,
    out_depth: 4
}, {
    type: 'fc', 
    num_neurons: 20,
    activation: 'relu'        
}, {
    type: 'regression',
    num_neurons: 7
}]);

モデルは、入力4、出力7、全結合20、reluの回帰。
オプチマイザーは、sgd
学習は、1000回

成果物

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0