New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-efficientnet

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-efficientnet

Implementation of efficientNet model in nodejs

  • 1.0.23
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
26
decreased by-45.83%
Maintainers
1
Weekly downloads
 
Created
Source

TensorflowJS EfficientNet

npm Node.js CI Coverage Status Build Status Codacy Badge Run on Repl.it

This repository contains a tensorflowJs implementation of EfficientNet, an object detection model trained on ImageNet and can detect 1000 different objects.

EfficientNet a lightweight convolutional neural network architecture achieving the state-of-the-art accuracy with an order of magnitude fewer parameters and FLOPS, on both ImageNet and five other commonly used transfer learning datasets.

The codebase is heavily inspired by the TensorFlow implementation.

👏 Supporters

Stargazers repo roster for @ntedgi/node-efficientnet

Usage:

EfficientNet has 8 different model checkpoints each checkpoint as different input layer resolution for larger input layer resolution, the greater the accuracy and the running time is slower.

for example lets take this images:

ModelPrediction
EfficientNetB0('Giant panda',83.607) , ( 'Skunk',11.61) , ('hog',4.772)
EfficientNetB7('Giant panda',90.406) , ( 'American black bear',7.07) , ('Badger',2.5192)
ModelPrediction
EfficientNetB3('goldfish, Carassius auratus',82.5) , ( 'starfish, sea star',9.26) , ('corn'',7.33)
EfficientNetB7('goldfish, Carassius auratus',97.5) , ( 'starfish, sea star',1.46) , ('corn'',0.93)
ModelPrediction
EfficientNetB0('Sports Car',88.02) , ( 'racing car',6.647) , ('car wheel',5.32)
EfficientNetB7('Sports Car',87.68) , ( 'convertible'',7.831) , ('car wheel',4.485)
ModelPrediction
EfficientNetB0('revolver',85.52) , ( 'assault rifle',9.85) , ('rifle',4.6197)
EfficientNetB7('revolver',88.13) , ( 'rifle',8.29) , ('assault rifle',3.56)

Table of Contents

  1. Installation
  2. Examples
  3. About EfficientNet Models
  4. Models

Installation

npm i --save node-efficientnet

Examples

const fs = require('fs');
const nodeFetch = require('node-fetch');

const {
  EfficientNetCheckPointFactory,
  EfficientNetCheckPoint
} = require("node-efficientnet")

const images = ['car.jpg', 'panda.jpg']
const imageDir = "./samples"
const imageDirRemoteUri = "https://raw.githubusercontent.com/ntedgi/node-EfficientNet/main/samples"

if (!fs.existsSync(imageDir)) {
  fs.mkdirSync(imageDir);
}

async function download(image, cb) {
  const response = await nodeFetch.default(`${imageDirRemoteUri}/${image}`);
  const buffer = await response.buffer();
  fs.writeFile(`${imageDir}/${image}`, buffer, cb)
}


EfficientNetCheckPointFactory.create(EfficientNetCheckPoint.B2)
  .then((model) => {
    images.forEach(async (image) => {
      await download(image, () => {
        model.inference(`${imageDir}/${image}`).then((result) => {
          console.log(result.result)
        })
      })

    })
  })
  .catch((e) => {
    console.error(e)
  })

output :

[
  { label: 'sports car, sport car', precision: 88.02440940394301 },
  {
    label: 'racer, race car, racing car',
    precision: 6.647441678387659
  },
  { label: 'car wheel', precision: 5.3281489176693295 }
]
[
  {
    label: 'giant panda, panda, panda bear, coon bear, Ailuropoda melanoleuca',
    precision: 83.60747593436018
  },
  { label: 'skunk, polecat, wood pussy', precision: 11.61300759424677 },
  {
    label: 'hog, pig, grunter, squealer, Sus scrofa',
    precision: 4.779516471393051
  }
]

About EfficientNet Models

EfficientNets rely on AutoML and compound scaling to achieve superior performance without compromising resource efficiency. The AutoML Mobile framework has helped develop a mobile-size baseline network, EfficientNet-B0, which is then improved by the compound scaling method to obtain EfficientNet-B1 to B7.

EfficientNets achieve state-of-the-art accuracy on ImageNet with an order of magnitude better efficiency:

  • In high-accuracy regime, EfficientNet-B7 achieves the state-of-the-art 84.4% top-1 / 97.1% top-5 accuracy on ImageNet with 66M parameters and 37B FLOPS. At the same time, the model is 8.4x smaller and 6.1x faster on CPU inference than the former leader, Gpipe.

  • In middle-accuracy regime, EfficientNet-B1 is 7.6x smaller and 5.7x faster on CPU inference than ResNet-152, with similar ImageNet accuracy.

  • Compared to the widely used ResNet-50, EfficientNet-B4 improves the top-1 accuracy from 76.3% of ResNet-50 to 82.6% (+6.3%), under similar FLOPS constraints.

Models

The performance of each model variant using the pre-trained weights converted from checkpoints provided by the authors is as follows:

Architecture@top1* Imagenet@top1* Noisy-Student
EfficientNetB00.7720.788
EfficientNetB10.7910.815
EfficientNetB20.8020.824
EfficientNetB30.8160.841
EfficientNetB40.8300.853
EfficientNetB50.8370.861
EfficientNetB60.8410.864
EfficientNetB70.8440.869

* - topK accuracy score for converted models (imagenet val set)

Keywords

FAQs

Package last updated on 10 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc