1.0.4 • Published 5 years ago

resnet_imagenet v1.0.4

Weekly downloads
3
License
ISC
Repository
github
Last release
5 years ago

ResNet Model trained on ImageNet

GSOC GitHub npm (tag)

The ResNet50 model pretrained on imagenet for TensorFlow.js as a layers model.
On ImageNet, this model gets to a top-1 validation accuracy of 0.749 and a top-5 validation accuracy of 0.921.
The default input size for this model is 224x224.

This model has been converted, using the tfjs-converter.
The base model and weights were taken from keras.

Install npm install resnet_imagenet

How to use

import ResNetPredictor from 'resnet_imagenet';

const tabbyCatURI = 'https://upload.wikimedia.org/wikipedia/commons/6/66/An_up-close_picture_of_a_curious_male_domestic_shorthair_tabby_cat.jpg';

const run = async () => {
    const predictor = await ResNetPredictor.create();
    const prediction = await predictor.classify(tabbyCatURI);
    return prediction;
}

To try the model you can just load it using:

ResNetURL = 'https://raw.githubusercontent.com/paulsp94/tfjs_resnet_imagenet/master/ResNet50/model.json';
const ResNet = await tf.loadLayersModel(ResNetURL);