You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19-5Lines changed: 19 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,16 @@ npm install compreface-js-sdk
17
17
## Recognition Service
18
18
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.
19
19
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 }```
| 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
+
21
30
```
22
31
{
23
32
"image_id": "<UUID>",
@@ -38,7 +47,7 @@ The main purpose of Recognition Service is operating on images in your face coll
38
47
}
39
48
```
40
49
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.
42
51
```{
43
52
"result": [
44
53
{
@@ -61,7 +70,7 @@ The main purpose of Recognition Service is operating on images in your face coll
61
70
}
62
71
```
63
72
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.
65
74
```
66
75
{
67
76
"result": [
@@ -102,15 +111,20 @@ The main purpose of Recognition Service is operating on images in your face coll
102
111
-```faceCollection.delete_all()``` - to delete all images from face collection.
103
112
104
113
## 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.
106
115
```
107
116
import { CompreFace } from 'compreface-js-sdk';
108
117
109
118
let api_key = "your_key";
110
119
let server = "http://localhost";
111
120
let port = 8000;
121
+
let options = {
122
+
limit: 0,
123
+
det_prob_threshold: 0.5,
124
+
prediction_count: 1
125
+
}
112
126
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
114
128
let recognitionService = compreFace.initFaceRecognitionService(api_key); // initialize service
115
129
let faceCollection = recognitionService.getFaceCollection();
0 commit comments