- Train a keras classifier and save its weights
- install
tensorflowjs
python library
pip install tensorflowjs
- 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.
-
Place your converted weights inside
weights
folder -
Open
classifier.js
and updatemodel.json
path according to your weights folder -
After everything is setup up perfectly run below command inside the directory.
python3 -m http.server
- navigate to localhost