@spriteful/node-tfjs-retrain
Tensorflow.js mobilenet transfer learning cli tool
Last updated a year ago by claymation296 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @spriteful/node-tfjs-retrain 
SYNC missed versions from official npm registry.

node-tfjs-retrain

Retraining image classification model using TensorFlow.js in Node.

Based on the following js.tensorflow.org tutorials:

Excellent article from James Thomas that helped (skip the stuff about downloading the model shards manually; there's a much simpler way described in the comments):
Machine Learning in Node.js with TensorFlow.js

Example Usages

  • Retrain and test model:
    node app.js --images_dir="C:/Retraining_Project/Images" --model_dir="C:/Retraining_Project/Model"
  • Skip retraining; just test model:
    node app.js --images_dir="C:/Retraining_Project/Images" --model_dir="C:/Retraining_Project/Model" --skip_training=true
  • Create sample images:
    node create_images.js C:/Retraining_Project/Images

_ Full example with tensorboard:

	cli commands to start tensorboard (localhost:6006)

	start virtual environment -

	source ./venv/bin/activate

	start tensorboard on localhost:6006 -

	(venv) $ tensorboard --logdir /tmp/tf_fit_logs

	node-tfjs-retrain cli -

	node app.js --images_dir="/Users/claymation296/dev/magic/synthetic" --model_dir="/Users/claymation296/dev/nathanML/ml-lock/src/model" --sizing="contain" --epochs="500"

	shutdown virtual environment

	(venv) $ deactivate
  • app.js args:

    --batch_size_fraction -> Number default 0.2
    --dense_units 				-> Number default 100
    --epochs 							-> Number default 50
    --learning_rate 			-> Number default 0.0001
    --sizing 							-> String default 'cover'
    --logdir 							-> String default '/tmp/tf_fit_logs', tensorboard --logdir /tmp/tf_fit_logs
    
  • augment_images.js args:

    --flip_images 					-> Boolean default false
    --adjust_brightness 		-> Boolean default false
    --ignore_subdirectories -> Boolean default false
    --labels_to_skip 				-> String default ''
    

Help

I'm quite new to Node and TF, so there's a lot of room for cleanup and code improvements. My initial goal was to get something working and worry about minor improvements later. Feel free to submit a PR :)

Initial TODOs:

  • [x] Create a script to automatically build a training data set to enable users to immediately get started
  • [x] Save trained model in the project directory
  • [x] Replace ui_mock.js with a TrainingParams class

Current Tags

  • 1.0.3                                ...           latest (a year ago)

4 Versions

  • 1.0.3                                ...           a year ago
  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (6)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |