/image-classifier-in-javascript

Deploy image classifier on a static website using javascript.

Primary LanguageJupyter NotebookOtherNOASSERTION

A cat dog image classifier deployed client side using javascript

image

Instructions

  1. Train a keras classifier and save its weights
  2. install tensorflowjs python library
pip install tensorflowjs
  1. Use tensorflowjs converter tool to convert h5 weights to js format.
tensorflowjs_converter --input_format=keras ./model.h5 ./jsweights
  • Make sure the .h5 weights location is correct and also destination path exists.

After running above command you will see model.json and .bin files, tensorflowjs converter dumps model architecture in model.json and it's weights in .bin files.

setup

  • Place your converted weights inside weights folder

  • Open classifier.js and update model.json path according to your weights folder

  • After everything is setup up perfectly run below command inside the directory.

python3 -m http.server

Output

courage_garfield