EmojiNet is an image to emoji recognizer based on MobileNet / Google Emoji Scavenger Hunt.
Image source: Emoji Scavenger Hunt
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.
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.
Not supported yet.
Pull Requests are welcome!
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 }
// ]
Create a EmojiNet instance.
const emojinet = new EmojiNet()
Load the modle and warm it up.
await emojinet.load()
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 }
// ]
Free the resources.
emojiNet.dispose()
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.
First working version.
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
Huan LI (李卓桓), Google Developers Expert in Machine Learning (ML GDE), zixia@zixia.net
- Docs released under Creative Commons
- Code released under the Apache-2.0 License
- Code & Docs © 2021 Huan LI <zixia@zixia.net>