Skip to content

zhiftyDK/image-classifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image Classifier

Install

npm install @zhiftydk/image-classifier

About

This nodejs package is the easiest image classifier to use. The package is based on tensorflows knn-classifier and mobilenet model.

How to use

Dateset/image directory configuration:

Animals/
... cats/
    ... cat1.jpg
    ... cat2.jpg
    ... cat3.jpg
... dogs/
    ... dog1.jpg
    ... dog2.jpg
    ... dog3.jpg

In this example animals/ is the parent folder, and all the subdirectories like e.g. dogs/ & cats/ will become the different classes used in the classification.

Import:

// CommonJS
const ImageClassifier = require("@zhiftydk/image-classifier");

// Or ES Modules
import ImageClassifier from "@zhiftydk/image-classifier";

Example:

// OPTIONAL: Set image size. Default = 64
ImageClassifier.imageSize = 64;

// Process images (Generates a model.json in the root directory)
const datasetPath = "./animals/";
ImageClassifier.process(datasetPath); // Returns nothing

// Compare a new image with the model and classify it
const newImagePath = "./testimage.jpg"
ImageClassifier.compare(newImagePath).then(result => {
    console.log(result);
});

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published