1.0.3 • Published 5 years ago

gender-classification v1.0.3

Weekly downloads
8
License
MIT
Repository
github
Last release
5 years ago

Gender Classification

JavaScript API for gender classification and prediction in the browser implemented on top of the tensorflow.js core API (tensorflow/tfjs-core)

npm install gender-classification --save

Table of Contents:

Resources

Live Demo

Check out the live demo!

Examples

Gender Classification

> genderClassification("John") > "Male"

> genderClassification("Sarah") > "Female"

Under the hood: The model is trained with a three-layer feed forward neural network using back propagation with the input layer using 10 neurons with the relu activation function, a hidden layer with 5 neurons again with the relu activation function, and an output layer using 2 neurons with the softmax activation function.

Neural Network

Usage

Loading the Model

To load the model, you have provide the corresponding manifest.json file as well as the model weight files (shards) as assets. Simply copy them to your public or assets folder. The manifest.json and shard files of a model have to be located in the same directory / accessible under the same route.

Assuming the models reside in public/models:

const tf = require('@tensorflow/tfjs')
const genderClassification = require('gender-classification')

let model = await genderClassification(tf).loadModel('./model/model.json')

model.classify(name).then(function(prediction) {
  return prediction.gender
})
1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago