Edgeimpulse.com tinyML Machine Learning supports exports to Tensorflow, TensorflowLite, TensorflowMicro but not TensorflowJs. It can easily be converted from one of the other formats but typically takes a python script which is not Javascript.
Perhaps a few people could “like” the following Feature Request at EdgeImpulse.com to increase its chances of adoption.
So it looks like Edge Impulse will not be helping with exporting to TFJS.
Anyone any opinions on how to convert from Tensorflow saved model to TensorflowJs layers model. I used to do it all the time but my code doesn’t seem to work anymore. Anyone got uptodate conversion examples and installation code.
I used to have several steps full automated on this github to take a model.json to several other forms, but I dont even thing the instalation is working anymore.
What is the error though? Did the model you are trying to convert change? On our side I am not aware of any major updates to the converter itself so it should still work assuming same model architecture / ops being used. If the issue is with the TFLite converter then maybe someone from the TFLite team can comment on that?
tflite_convert --help
2021-08-08 21:03:08.629865: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory ...
The above was on a Gitpod Cloud Debian server, when I try to install directly onto my ubuntu machine I have installation issues.
My github that loads on Gitpod is here the auto gitpod load URL is here
This all worked great a year ago, so I wonder what is different.
I see. If you believe this is a bug and not an error with your environment etc then please submit a bug to the TFJS repo so it can be triaged.
We have had a few people using the converter recently on regular vanilla Ubuntu cloud instances and not reported this issue before AFAIK. Please confirm there were no issues with deps not installed on your local environment first though / file access permissions. If it still persists after checking those on your end feel free to open a bug using link above. Thanks!
Thanks @Jason, presently away from my computer lab so I have a minimal number of computers to test the issues on. I will look into it in when I can. Does anyone else have ideas about possible changes to any dependencies for the converters over the last year?
Seems that installing tensorflow first or tf-nightly was messing something up, tensorflowjs seems to install the correct tensorflow. Also pip3 helped over just trying pip.
Next issue is converting edgeImpulse GRAYSCALE 120 x 120 tensorflow saved model to tfjs.
Conversion created the necessary files, now how to run it in the browser?
Typically I would take a mobilenet demo and upload my new saved file, but that might prove tricky.
So far getting errors just loading the saved layer model in yhe browser. I will have to dig a bit deeper.
Anyone got any GRAYSCALE TFJS webcam working demos they could share?
Perhaps an easier route is just to change my edgeimpulse model to RGB?
So I am having issues loading a model.json file from my website. Best to start from scratch:
@Jason does anyone know if there is an up-to-date mobilenet webcam example? I have these old single web page vanilla javascript ones which work on multiple devices. Has anyone put together a simple mobilenet webcam version. I can do it, just nice to see what others have done.
My older version which does not work well on iPhone browsers
I have lots more but everything is a few years old, would love to see something that was modern simple and easy to load a TFJS layers model and test it using a webcam.
That is certain one route which uses our COCO-SSD model however if you wanted a mobile net example all my working code is available on Glitch.com and Codepen.io eg here:
Mobilenet:
Here I show how to apply to a single image and also webcam classification too. Mobilenet on its own tends to give interesting results so I much prefer to use COCO-SSD for object detection or retrain Mobilenet for specific things eg like TeachableMachine does. Anyhow my minimal COCO-SSD demo is here:
Just checking something I read. Can a Tensorflow Saved model be converted to a TFJS Layers Model? I think I read somewhere that it can only be converted to a TFJS Graph Model.
I really want a layers model from Edge Impulse. Could a TFLite model be converted to a TFJS layers model?
ooooooo I see the issue I need to crop the video. Can that be done using the video element or do I have to convert it to a canvas. Also does anyone know the code to grab the middle pixels. Presently the webcam is 640 x 480 and I will need the middle 224 x 224.
The TFJS webpage now runs, but does not analyze correctly. The problem is most likely the input data from the canvas being formatted incorrectly. Anyone got any suggestions?
My last working web page demo should be here (since it is vanilla javascript just right click to view all the source code.)
My active model is here, but I routinely break it.