Skip to content
forked from huan/emoji-net

EmojiNet is an image to emoji recognizer based on MobileNet / Google Emoji Scavenger Hunt

License

Notifications You must be signed in to change notification settings

XiaoQuark/emoji-net

 
 

Repository files navigation

EmojiNet

NPM NPM Version npm (tag) Powered by TFJS

EmojiNet is an image to emoji recognizer based on MobileNet / Google Emoji Scavenger Hunt.

EmojiNet

Image source: Emoji Scavenger Hunt

Introduction

This model is based on TensorFlow.js / MobileNet and it does not require you to know about machine learning. It can take as input any local file and returns an array of most likely predictions of emoji the image contains.

Usage

There are two main ways to get this model in your JavaScript project: via script tags or by installing it from NPM and using a build tool like Parcel, WebPack, or Rollup.

via Script Tag

Not supported yet.

Pull Requests are welcome!

via NPM

import { EmojiNet } from 'emoji-net'

const emojinet = new EmojiNet()

// Load the model and warm it up
await emojinet.load()

// recognize the image.
const emojiItemList = await emojinet.recognize('tests/fixtures/sofa.jpg')
console.log('emojiItemList:', emojiItemList)
// Output:
// emojiItemList: [
//   { id: 416, name: 'sofa', probobility: 0.9893624782562256 },
//   { id: 61, name: 'bed', probobility: 0.007496606558561325 },
//   { id: 241, name: 'wallet', probobility: 0.000651892158202827 }
// ]

API

new EmojiNet()

Create a EmojiNet instance.

const emojinet = new EmojiNet()

emojinet.load()

Load the modle and warm it up.

await emojinet.load()

emojinet.recognize()

const emojiItemList = await emojinet.recognize('tests/fixtures/sofa.jpg')
console.log('emojiItemList:', emojiItemList)
// Output:
// emojiItemList: [
//   { id: 416, name: 'sofa', probobility: 0.9893624782562256 },
//   { id: 61, name: 'bed', probobility: 0.007496606558561325 },
//   { id: 241, name: 'wallet', probobility: 0.000651892158202827 }
// ]

emojinet.dispose()

Free the resources.

emojiNet.dispose()

Inspired By: Emoji Scavenger Hunt

About MobileNet

MobileNets are small, low-latency, low-power models parameterized to meet the resource constraints of a variety of use cases. They can be built upon for classification, detection, embeddings and segmentation similar to how other popular large scale models, such as Inception, are used.

MobileNets trade off between latency, size and accuracy while comparing favorably with popular models from the literature.

For more information about MobileNet, check out this readme in tensorflow/models.

History

main

v0.2 (Aug 20, 2021)

First working version.

v0.0.1 (Aug 19, 2021)

Initial version.

Most of the code are copy/pasted from Google Emoji Scavenger Hunt:

an experiment that leverages the power of neural networks and your phone’s camera to identify the real world versions of the emojis we use every day

Author

Huan LI (李卓桓), Google Developers Expert in Machine Learning (ML GDE), zixia@zixia.net

Profile of Huan LI (李卓桓) on StackOverflow

Copyright & License

  • Docs released under Creative Commons
  • Code released under the Apache-2.0 License
  • Code & Docs © 2021 Huan LI <zixia@zixia.net>

About

EmojiNet is an image to emoji recognizer based on MobileNet / Google Emoji Scavenger Hunt

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 95.9%
  • Shell 3.1%
  • JavaScript 1.0%