You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This package provides some convenience methods for using TensorFlow models created using keras-retinanet. Check out the docs. You can also check out the example app.
Getting Started
Convert RetinaNet Model to TensorFlowJS
As an example, we'll convert the ResNet50 weights to TensorFlow.js format. You must have tensorflowjs installed.
First, save a fixed input size training model to a Keras h5 file with both the weights and architecture. You must supply a fixed input shape. In experimenting with different backbones, only a few functioned correctly with undefined input shapes when loaded with TensorFlowJS.
Importantly, we do not convert to a prediction model. Rather, we do the necessary box regression in TensorFlowJS. Including them made some backbones load incorrectly in TensorFlow.js.
The code below loads the above model and does detection. We assume that you have a reference to an HTMLImage object in imageRef and a list of the COCO class label names in COCO_CLASSES. Note that you must supply the preprocessing mode. Check the preprocess_image method on your backbone to see whether your model uses tf or caffe preprocessing.