0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

tensorflow.jsで7セグメントLED

Last updated at Posted at 2019-01-22

概要

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

写真

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

dataset

const t_x = tf.tensor2d([
    [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]], [10, 4]);
const t_y = tf.tensor2d([
    [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]], [10, 7]);

モデルは、入力4、出力7、全結合20、sigmoidの分類。
オプチマイザーは、adam
学習は、5000回
biasとweightをsaveする。

学習したモデルを使ってデモ。

学習済みモデルを読み込む。

tensorflow.jsを使わないでデモ。

biasとweightを使って、自前関数。

以上。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?