Train Face Recognizer

No algorithm description given

Trains a face recognizer from a labeled set of faces. This is a wrapper for the FaceRecognition algorithm.  The FaceRecognition algorithm additionally requires a user to specify a "train" mode, so this wrapper makes things slightly more convenient.  Users must pass in a list of JSON objects, one for each image.  Each image JSON object must have a "ID" field with an ID (or label) saying whose face is pictured.  It must also have a "Path" field specifying the image URL (e.g. the path to the image in an Algorithmia collection). (Note: if an image has multiple faces, all faces will be detected and used in training, but each face will have the ID specified to the image as a whole.  For instance, in a multi-face picture of the Smith siblings, each face will be used for training and each will have the image "Smith siblings".   It is difficult to specify labels more precisely than that, so that is the greatest level of precision this algorithm supports.) After preprocessing the image data by using an OpenCV face detector to detect faces, this program trains a face recognizer using Local Binary Pattern Histograms, also as implemented in OpenCV.  This face recognizer will be saved in XML format to a data collection of the user's choosing, along with a file of the same name (but with an additional _idList tag and a .txt extension) that maps people's IDs to numeric labels used internally.  For use when updating the model or classifying with it, both files must have the same name and must be in the same directory. Users must also specify an Algorithmia data collection to which a face recognizer can be written as well as a file name for the face recognizer.  This is done by specifying the full path that the .xml face recognizer file will have when saved (including the file name and a .xml extension).  If a file with this path exists, the model in that file will be updated with the new training images.  Otherwise, a new model will be created from scratch.   Upon successful completion, a user will receive a notification: "Successfully completed!"  In the specified directory will then be the face recognition model (face recognizer and ID list).  

Tags
(no tags)

Cost Breakdown

0 cr
royalty per call
1 cr
usage per second
avg duration
This algorithm has permission to call other algorithms which may incur separate royalty and usage costs.

Cost Calculator

API call duration (sec)
×
API calls
=
Estimated cost
per calls
for large volume discounts
For additional details on how pricing works, see Algorithmia pricing.

Calls other algorithms

This algorithm has permission to call other algorithms. This allows an algorithm to compose sophisticated functionality using other algorithms as building blocks, however it also carries the potential of incurring additional royalty and usage costs from any algorithm that it calls.


To understand more about how algorithm permissions work, see the permissions documentation.

1. Type your input

2. See the result

Running algorithm...

3. Use this algorithm

curl -X POST -d '{{input | formatInput:"curl"}}' -H 'Content-Type: application/json' -H 'Authorization: Simple YOUR_API_KEY' https://api.algorithmia.com/v1/algo/mheimann/TrainFaceRecognizer/0.1.5
View cURL Docs
algo auth
# Enter API Key: YOUR_API_KEY
algo run algo://mheimann/TrainFaceRecognizer/0.1.5 -d '{{input | formatInput:"cli"}}'
View CLI Docs
import com.algorithmia.*;
import com.algorithmia.algo.*;

String input = "{{input | formatInput:"java"}}";
AlgorithmiaClient client = Algorithmia.client("YOUR_API_KEY");
Algorithm algo = client.algo("algo://mheimann/TrainFaceRecognizer/0.1.5");
AlgoResponse result = algo.pipeJson(input);
System.out.println(result.asJsonString());
View Java Docs
import com.algorithmia._
import com.algorithmia.algo._

val input = {{input | formatInput:"scala"}}
val client = Algorithmia.client("YOUR_API_KEY")
val algo = client.algo("algo://mheimann/TrainFaceRecognizer/0.1.5")
val result = algo.pipeJson(input)
System.out.println(result.asJsonString)
View Scala Docs
var input = {{input | formatInput:"javascript"}};
Algorithmia.client("YOUR_API_KEY")
           .algo("algo://mheimann/TrainFaceRecognizer/0.1.5")
           .pipe(input)
           .then(function(output) {
             console.log(output);
           });
View Javascript Docs
var input = {{input | formatInput:"javascript"}};
Algorithmia.client("YOUR_API_KEY")
           .algo("algo://mheimann/TrainFaceRecognizer/0.1.5")
           .pipe(input)
           .then(function(response) {
             console.log(response.get());
           });
View NodeJS Docs
import Algorithmia

input = {{input | formatInput:"python"}}
client = Algorithmia.client('YOUR_API_KEY')
algo = client.algo('mheimann/TrainFaceRecognizer/0.1.5')
print algo.pipe(input)
View Python Docs
library(algorithmia)

input <- {{input | formatInput:"r"}}
client <- getAlgorithmiaClient("YOUR_API_KEY")
algo <- client$algo("mheimann/TrainFaceRecognizer/0.1.5")
result <- algo$pipe(input)$result
print(result)
View R Docs
require 'algorithmia'

input = {{input | formatInput:"ruby"}}
client = Algorithmia.client('YOUR_API_KEY')
algo = client.algo('mheimann/TrainFaceRecognizer/0.1.5')
puts algo.pipe(input).result
View Ruby Docs
use algorithmia::*;

let input = {{input | formatInput:"rust"}};
let client = Algorithmia::client("YOUR_API_KEY");
let algo = client.algo("mheimann/TrainFaceRecognizer/0.1.5");
let response = algo.pipe(input);
View Rust Docs
import Algorithmia

let input = "{{input | formatInput:"swift"}}";
let client = Algorithmia.client(simpleKey: "YOUR_API_KEY")
let algo = client.algo(algoUri: "mheimann/TrainFaceRecognizer/0.1.5") { resp, error in
  print(resp)
}
View Swift Docs
Discussion
  • {{comment.username}}