Skip to content

Commit 74cb083

Browse files
author
doripjonov
committed
optimized readme
1 parent adecf98 commit 74cb083

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

README.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,16 @@ npm install compreface-js-sdk
1717
## Recognition Service
1818
The main purpose of Recognition Service is operating on images in your face collection. Face collection is an array of objects that every object contains ```image_id``` and ```subject``` to represent added image. Below given useful information about functionaliites of Recognition Service.
1919

20-
- ```faceCollection.add(image_path, subject)``` - to add an image to your face collection. This function takes ```image_path```(path of image) and ```subject```(name) as argument and returns object that contains ```image_id``` and ```subject``` in success
20+
- ```faceCollection.add(image_path, subject, options)``` - to add an image to your face collection. This function takes ```image_path```(path of image), ```subject```(name of image) and options as argument and returns object that contains ```image_id``` and ```subject``` in success. Options argument is an object that contains extra parameters for particular function. Those extra parameters could be ```options = { limit, det_prob_threshold, prediction_count }```
21+
22+
23+
| | | | | |
24+
| ---------------- | ----------- | ------- | -------- | ------------------------------------------------------------ |
25+
| limit | integer | optional | maximum number of faces with best similarity in result. Value of 0 represents no limit. Default value: 0 |
26+
| det_prob_ threshold | string | optional | minimum required confidence that a recognized face is actually a face. Value is between 0.0 and 1.0. |
27+
| prediction_count | integer | optional | maximum number of predictions per faces. Default value: 1 |
28+
29+
2130
```
2231
{
2332
"image_id": "<UUID>",
@@ -38,7 +47,7 @@ The main purpose of Recognition Service is operating on images in your face coll
3847
}
3948
```
4049

41-
- ```faceCollection.recognize(image_path)``` - to recognize faces from given image. The function takes ```image_path``` as argument and returns below object in success.
50+
- ```faceCollection.recognize(image_path, options)``` - to recognize faces from given image. The function takes ```image_path``` and ```options``` as argument and returns below object in success.
4251
```{
4352
"result": [
4453
{
@@ -61,7 +70,7 @@ The main purpose of Recognition Service is operating on images in your face coll
6170
}
6271
```
6372

64-
- ```faceCollection.verify(image_path, image_id)``` - to compare similarities of given image with image from your face collection. Accepts ```image_path```(path of image) and ```image_id``` from your face collection and returns similarity percentage of images.
73+
- ```faceCollection.verify(image_path, image_id, options)``` - to compare similarities of given image with image from your face collection. Accepts ```image_path```(path of image), ```image_id``` from your face collection, ```options``` and returns similarity percentage of images.
6574
```
6675
{
6776
"result": [
@@ -102,15 +111,20 @@ The main purpose of Recognition Service is operating on images in your face coll
102111
- ```faceCollection.delete_all()``` - to delete all images from face collection.
103112

104113
## Usage
105-
You only need to import ```CompreFace``` in order to use functionalities of services. Below given initial setup for your web application.
114+
You only need to import ```CompreFace``` in order to use functionalities of services. Below given initial setup for your web application. NOTE: you can pass options globally too. In this case if you provide same option values from functions, global ones override local one.
106115
```
107116
import { CompreFace } from 'compreface-js-sdk';
108117
109118
let api_key = "your_key";
110119
let server = "http://localhost";
111120
let port = 8000;
121+
let options = {
122+
limit: 0,
123+
det_prob_threshold: 0.5,
124+
prediction_count: 1
125+
}
112126
113-
let compreFace = new CompreFace(server, port); // set server and port number
127+
let compreFace = new CompreFace(server, port, options); // set server, port number and options
114128
let recognitionService = compreFace.initFaceRecognitionService(api_key); // initialize service
115129
let faceCollection = recognitionService.getFaceCollection();
116130
```

0 commit comments

Comments
 (0)