deeplearning

deeplearning / CaffeNet / 2.0.1

README.md

1. Introduction

This is the CaffeNet image classifier for classifying Imagenet categories. These categories can be found here.

Input:

  • (Required) Image Data API Url, Web (http/https) Url, binary image or a base64 encoded image.
  • (Optional)  Number of results. (Default=5)

Output:

  • Top N classifications.

Note: The first call to this algorithm will take a bit longer than sequential calls to due algorithm initialization. All following calls will be significantly faster.

2. Examples

Example 1.

  • Parameter 1: Data API Url
{
    "image": "data://deeplearning/example_data/bananas.jpg"
}

Output

{  
   "results":[  
      {"confidence":0.999562680721283,"label":"banana"},
      {"confidence":0.00039236515294760466,"label":"mortar"},
      {"confidence":0.000008457073818135541,"label":"pitcher, ewer"},
      {"confidence":0.000007989773621375207,"label":"lemon"},
      {"confidence":0.0000034339670946792467,"label":"clog, geta, patten, sabot"}
   ]
}

Example 2.

  • Parameter 1: HTTP Url
{
    "image": "https://s3.amazonaws.com/algorithmia-assets/algo_desc_images/deeplearning_CaffeNet/shoes.jpg"
}

Output:

{
  "results": [
    {"confidence": 0.5612723231315613,"label": "running shoe"},
    {"confidence": 0.09682515263557434,"label": "iron, smoothing iron"},
    {"confidence": 0.0658978521823883, "label": "Loafer"},
    {"confidence": 0.05883505567908287,"label": "clog, geta, patten, sabot"},
    {"confidence": 0.024631954729557037, "label": "mitten"},
    {"confidence": 0.020255278795957565, "label": "sock"},
    {"confidence": 0.019952893257141113, "label": "stole"},
    {"confidence": 0.01743927411735058,"label": "wool, woolen, woollen"},
    {"confidence": 0.013626870699226856,"label": "jean, blue jean, denim"},
    {"confidence": 0.012965059839189053, "label": "purse"},
    {"confidence": 0.009541100822389126,"label": "bow tie, bow-tie, bowtie"},
    {"confidence": 0.007822269573807716,"label": "handkerchief, hankie, hanky, hankey"},
    {"confidence": 0.0065187751315534115,"label": "sandal"},
    {"confidence": 0.0061787632293999195,"label": "bath towel"},
    {"confidence": 0.005863594356924295, "label": "buckle"}
  ]
}

Example 3.

  • Parameter 1: Base64 image
{
    "image": "data:image/png;base64....",
}

Output;

{
  "results":[
    {"confidence": 0.4345380365848542, "label":"sports car, sport car"},
    {"confidence": 0.28446707129478466, "label": "convertible"},
    {"confidence": 0.10041847825050354,"label": "beach wagon, station wagon, wagon, estate car, beach waggon, station waggon, waggon"},
    {"confidence": 0.053312629461288466, "label": "car wheel"},
    {"confidence": 0.04541682079434396,"label": "racer, race car, racing car"}
  ]
}

Example 4.

  • Parameter 1: Data API Url
  • Parameter 2: Number of results.
{
  "image": "data://deeplearning/example_data/bananas.jpg",
  "numResults": 15
}

Output:

{  
   "results":[  
      {"confidence":0.999562680721283,"label":"banana"},
      {"confidence":0.00039236515294760466,"label":"mortar"},
      {"confidence":0.000008457073818135541,"label":"pitcher, ewer"},
      {"confidence":0.000007989773621375207,"label":"lemon"},
      {"confidence":0.0000034339670946792467,"label":"clog, geta, patten, sabot"},
      {"confidence":0.000002298381104992586,"label":"cup"},
      {"confidence":0.000002161226348107448,"label":"mixing bowl"},
      {"confidence":0.0000018423750134388683,"label":"pineapple, ananas"},
      {"confidence":0.0000018352727693127235,"label":"strainer"},
      {"confidence":0.0000016318584812324843,"label":"ladle"},
      {"confidence":0.000001281421191379195,"label":"teapot"},
      {"confidence":0.0000010122270168722023,"label":"spaghetti squash"},
      {"confidence":9.90984858617594e-7,"label":"neck brace"},
      {"confidence":9.23445895750774e-7,"label":"bathtub, bathing tub, bath, tub"},
      {"confidence":8.778124538366683e-7,"label":"slug"}
   ]
}

3. Credits

For more information, please refer to: https://github.com/BVLC/caffe/tree/master/models/bvlc_reference_caffenet

Demo image(s) were retrieved from:

https://commons.wikimedia.org/wiki/File:Bananas_(white_background).jpg

https://www.pexels.com/photo/fashion-shoes-footwear-19090/