Coder Social home page Coder Social logo

stophobia / tensorflow-typescript-starter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sami-badawi/tensorflow-typescript-starter

0.0 1.0 0.0 15 KB

Starter project for TensorFlow.js in TypeScript for Node.js

License: Apache License 2.0

TypeScript 100.00%

tensorflow-typescript-starter's Introduction

Starter Project for TensorFlow.js in TypeScript

TensorFlow.js is an incredibly easy and powerful way to work with deep learning both in the browser and on the server.

TensorFlow.js would be even easier to use if it was written to run in TypeScript.

It is not hard to get this working, but there are still a little trail and error. This project is a starter project for running TensorFlow.js in TypeScript.

The example task is the hello world example of deep learning. Recognize the handwritten digits in the MNIST dataset by training a convolutional neural network.

This project is based on the MNIST TensorFlow.js example.

To Run

git clone https://github.com/sami-badawi/tensorflow-typescript-starter.git

cd tensorflow-typescript-starter

npm i

npm run build

npm run test

npm run start

To Run with Parameters


node dist/main.js --epochs 1

If you want to run with only 1 epoch.

Output

node dist/main.js --epochs 1
2019-02-16 13:49:35.108255: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.2 AVX AVX2 FMA
_________________________________________________________________
Layer (type)                 Output shape              Param #   
=================================================================
conv2d_Conv2D1 (Conv2D)      [null,26,26,32]           320       
_________________________________________________________________
conv2d_Conv2D2 (Conv2D)      [null,24,24,32]           9248      
_________________________________________________________________
max_pooling2d_MaxPooling2D1  [null,12,12,32]           0         
_________________________________________________________________
conv2d_Conv2D3 (Conv2D)      [null,10,10,64]           18496     
_________________________________________________________________
conv2d_Conv2D4 (Conv2D)      [null,8,8,64]             36928     
_________________________________________________________________
max_pooling2d_MaxPooling2D2  [null,4,4,64]             0         
_________________________________________________________________
flatten_Flatten1 (Flatten)   [null,1024]               0         
_________________________________________________________________
dropout_Dropout1 (Dropout)   [null,1024]               0         
_________________________________________________________________
dense_Dense1 (Dense)         [null,512]                524800    
_________________________________________________________________
dropout_Dropout2 (Dropout)   [null,512]                0         
_________________________________________________________________
dense_Dense2 (Dense)         [null,10]                 5130      
=================================================================
Total params: 594922
Trainable params: 594922
Non-trainable params: 0
_________________________________________________________________
Epoch 1 / 1
eta=0.0 =====================================================================================================================================> 
477998ms 9373us/step - acc=0.921 loss=0.250 val_acc=0.983 val_loss=0.0553 

Accuracy

The model gets to 98.3% accuracy on test data in 1 epoch and to 99.3% accuracy in 20 epochs.

Unit Test

There is only one unit tests. It checks that TensorFlow has been loaded.

The purpose is to set up the needed dependencies to work with unit tests. It is using Mocha and Chai libraries.

tensorflow-typescript-starter's People

Contributors

sami-badawi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.