npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cntk-fastercnn

v0.1.2

Published

node.js API for CNTK Faster-RCNN model

Downloads

9

Readme

cntk-faster-rcnn for node.js

A node wrapper a CNTK Faster-RCNN model

This module is based on the work done by Nadav Bar the evaluation script has been updated to support cntk faster-rcnn

Installation

Install by running:

npm install cntk-fastercnn

Python Preliminaries

Since the FRCNN detector uses bits of the CNTK Fast-RCNN implementation it has the same requirements as the CNTK Faster-RCNN training pipeline.

Before running the code in this repository, please make sure to install the required python packages as described in the Fast-RCNN CNTK tutorial.

How to use

First, load the module and create an instance of a CNTKFRCNNModel object.

The constructor accepts an options object with the following fields:

  • cntkModelPath : Path to the CNTK Faster-RCNN model file.
  • cntkPath : The directory in which CNTK is installed. Default value: 'C:\local\cntk'.
  • cntkEnv : The CNTK env to use (e.g. 'cntk-py34', or 'cntk-py35'). If not specified, the latest available version is used.
  • verbose : if set - the module will write verbose output when running evaluation. Default: false.

For example:

const CNTKFRCNNModel = require('cntk-fastercnn').CNTKFRCNNModel;

const modelFileLocation = 'C:\\cntk_model\\Faster-RCNN.model';

model = new CNTKFRCNNModel({cntkModelPath : modelFileLocation});

Next, call the model for detection using the evaluateDirectory method. Calling the function will result in running the model over every .jpg image in the given directory.

The function accepts the following parameters:

  • A path for a directory with images that will be used as input
  • A completion callback that accepts an error object as the first parameter and the result of the detection operation as the second parameter.

For example:

model.evaluateDirectory('c:\\cntk_input\\testImages', (err, res) => {
    if (err) {
        console.info(err)
        return;
    }
    console.info('%j', res);
});

The result object of the detection operation will contain the possible classes for the detected objects (with class names and class numeric ids), and for each image in the directory it will contain the list of regions that were detected. Each region will have its boundaries and detected class.

Here is an example of the result object of a directory that contains 2 images (named '1.jpg' and '2.jpg'):

{
	"frames": {
		"1.jpg": {
			"regions": [
				{
					"class": 1,
					"x1": 418,
					"x2": 538,
					"y2": 179,
					"y1": 59
				}
			]
		},
		"2.jpg": {
			"regions": [
				{
					"class": 2,
					"x1": 478,
					"x2": 597,
					"y2": 298,
					"y1": 59
				}
			]
		}
	},
	"classes": {
		"background" : 0,
		"human": 1,
		"cat": 2,
		"dog" : 3
	}
}

Adding descriptive classes names

To add descriptive names copy the class_map.txt file from the dataset folder where you trained your FasterRCNN model into the same directory as your model file.