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

watson-visual-recognition-utils

v0.1.1

Published

Command Line Interface and NPM module for easily creating/updating Watson Visual Recognition customer classifiers.

Downloads

3

Readme

Visual Recognition CLI Build Status

Command Line Interface for quickly and easily interacting with the Watson Visual Recognition service & custom classifiers.

Getting Started

Make sure you read the documentation for Visual Recognition before using this library.

You must have a valid Visual Recognition key to use this tool. If you do not have one, you can get a free trial here.

npm install watson-visual-recognition-utils -g

Usage

Run either the command watson-visual-recognition-utils or wvru in the terminal (both are aliases to the same code), you should see something like this:

$ watson-visual-recognition-utils
Watson Visual Recognition - Custom Classifier Utilities

  Usage:  <command> [options]


  Commands:

    api-usage [options]             View IBM Watson Visual Recognition API Key usage and limits
    classifier-list [options]       List all custom classifiers
    classifier-detail [options]     Fetch custom classifier verbose details
    classifier-classify [options]   Classify an image
    classifier-create [options]     Create a new custom classifier
    classifier-delete [options]     Delete a custom classifier
    key-set <key>                   Save your Watson Visual Recognition key in CLI preferences
    key-unset                       Remove your Watson Visual Recognition key in CLI preference

  Options:

    -h, --help     output usage information
    -V, --version  output the version number

You can either pass the Visual Recognition key as a CLI parameter, or save it in encrypted preferences so it does not need to be passed with every invocation.

Specify the API key as CLI parameter

This will call the list command, using the API key as a CLI argument:

watson-visual-recognition-utils classifier-list --key YOUR_WATSON_KEY_HERE

-OR-

First, set the key in preferences

watson-visual-recognition-utils key-set YOUR_WATSON_KEY_HERE

Next, call the list command (key is saved for all subsequent actions)

watson-visual-recognition-utils classifier-list

Create a new classifier

Invoke the classifier-create command. You can specify multiple positive classes, and optionally a negative collection of images, per service specs at: https://www.ibm.com/watson/developercloud/doc/visual-recognition/classifiers-tutorials.shtml

watson-visual-recognition-utils classifier-create
  • You can specify multiple positive classes
    • requires pairs of --positive-class (string for class name) and --positive-path (path to zip file for positive images).
    • pairs are processed in order specified
  • You can optionally specify a negative zip file
    • contains negative images for the classifier

One positive and one negative:

watson-visual-recognition-utils classifier-create --name classifier_name --positive-class rust --positive-path ./positive.zip --negative-path ./negative.zip

Multiple positive classes and a negative:

watson-visual-recognition-utils classifier-create --name train_parts --positive-class wheels --positive-path ./positive-wheels.zip --positive-class rails --positive-path ./positive-rails.zip --positive-class springs --positive-path ./positive-springs.zip --negative-path ./negative-other.zip

Classify (invoke a classifier)

Invoke the classify command:

watson-visual-recognition-utils classifier-classify

With CLI arguments:

  • default classifier is system "default"
  • can specify multiple classifiers as comma delimited list (no spaces)
watson-visual-recognition-utils classifier-classify --image ./path/to/image.jpg --classifier_ids default,rust,cracks  

Output from the classify service will be displayed as a JSON object.

License

This sample code is licensed under Apache 2.0.

Contributing

See CONTRIBUTING.

Open Source @ IBM

Find more open source projects on the IBM Github Page