Skip to content

Commit

Permalink
Fixed documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
pospielov committed Mar 2, 2021
1 parent beb323e commit a1b01c5
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 31 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
* [Custom Builds](/docs/Custom-builds.md)
* [Gathering Anonymous Statistics](/docs/Gathering-anonymous-statistics.md)
* [Contributing](#contributing)
* [License info](#license)
* [License info](#license-info)


# Overview
Expand Down
14 changes: 8 additions & 6 deletions docs/Architecture-and-scalability.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
# Architecture and Scalability

By default, CompreFace is delivered as docker-compose file, so you can easily start it with one command. However, CompreFace could be scaled up to distribute computations on different servers and achieve high availability.
This section describes the architecture of CompreFace, each of its components, and suggestions on how to scale the system.

###CompreFace architecture diagram
## CompreFace architecture diagram

![CompreFace architecture diagram](https://user-images.githubusercontent.com/3736126/107855144-5db83580-6e29-11eb-993a-46cdc0c82812.png)

###Balancer + UI
## Balancer + UI
Container name in docker-compose file: compreface-fe

This container runs Nginx that serves CompreFace UI.

In the default config, it’s also used as the main gateway - Nginx proxies user requests to admin and api servers.

###Admin server
## Admin server
Container name in docker-compose file: compreface-admin

Admin server is a Spring Boot application and it’s responsible for all operations that are done on UI. Admin server connects to PostgreSQL database to store the data.

###Api servers
## Api servers
Container name in docker-compose file: compreface-api

Api servers handle all user API calls: face recognition, face detection, and face verification.
Expand All @@ -28,7 +30,7 @@ In the default config number of API servers is 1, but for production environment

Classification is not a very heavy operation as embedding calculation and in most cases doesn’t require GPU. API server connects to PostgreSQL database to store the data.

###Embedding Servers
## Embedding Servers
Container name in docker-compose file: compreface-core

Embedding server is responsible for running neural networks. It calculates embeddings from faces and makes all plugin recognitions like age and gender detection. These servers are stateless, they don't have a connection to a database and they don't require any synchronization between each other.
Expand All @@ -37,7 +39,7 @@ In the default config number of API servers is 1, but for production environment

Running neural networks is a very heavy operation. The total performance of the system highly depends on these nodes. This is why we recommend using highly performant nodes to run Embedding Servers, ideally with GPU support. To learn more about how to run CompreFace with GPU, see custom builds documentation.

###PostgreSQL
## PostgreSQL
Default docker-compose configuration includes postgreSQL database.

If you want CompreFace to connect to your database, you need to provide such environment variables for compreface-admin and compreface-api containers:
Expand Down
1 change: 1 addition & 0 deletions docs/Configuration.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Configuration

In the [release](https://github.com/exadel-inc/CompreFace/releases) archive and all custom builds there is a `.env` file with
configuration options for CompreFace. For production systems
Expand Down
2 changes: 2 additions & 0 deletions docs/Custom-builds.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Custom Builds

We pre-build CompreFace with different models for the face services, so you can choose the best build for your purposes. Some of them have higher accuracy but the performance on CPU is low, others optimized for low-performance hardware and have acceptable accuracy.
Default CompreFace docker-compose build includes FaceNet library for face recognition and custom age and gender detector and doesn’t include GPU support.
You can find custom builds in the “builds” folder. There is more information about builds and installation instructions in the readme in this folder.
8 changes: 5 additions & 3 deletions docs/Face-services-and-plugins.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Face Services and Plugins

CompreFace supports these face services and plugins:
* Face recognition service (Face identification)
* Face detection service
Expand All @@ -7,7 +9,7 @@ CompreFace supports these face services and plugins:
* Landmarks detection plugin
* Calculator plugin

### Services
## Services

To use face service you need to create it in an application on UI. The type of service depends on your application needs. Each service has its own REST API context and there is no possibility to change the service type after creation. Here is a short description of each of them:
* Face recognition service is used for face identification. This means that you first need to upload known faces to faces collection and then recognize unknown faces among them. When you upload an unknown face, the service returns the most similar faces to it. Also, face recognition service supports verify endpoint to check if this person from face collection is the correct one. The possible cases include:
Expand All @@ -23,14 +25,14 @@ To use face service you need to create it in an application on UI. The type of s
* get landmark information to know where customers look at
* gather statistics on how many customers in the store

### Face plugins
## Face plugins

Face plugins could be used with any of the face services. By default, face services return only bounding boxes and similarity if
applicable. To add more information in response you can add face plugins in your request. To add a plugin you need to list
comma-separated needed plugins in the query `plugins` parameter. This parameter is supported by all face recognition services.
Example:
```shell
curl -X POST "http://localhost:8000/api/v1/faces/recognize?plugins=age,gender,landmarks" \
curl -X POST "http://localhost:8000/api/v1/recognition/recognize?plugins=age,gender,landmarks" \
-H "Content-Type: multipart/form-data" \
-H "x-api-key: <faces_recognition_api_key>" \
-F file=<local_file>
Expand Down
4 changes: 3 additions & 1 deletion docs/Gathering-anonymous-statistics.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Gathering Anonymous Statistics

To better understand which features we should add to the service and how we can improve it further we implemented functionality for gathering anonymous statistics. This section aims to describe what exact information we collect.

We respect the privacy of our users, this is why all statistics are strictly anonymized before sent to our servers. There is no possibility to de-anonymize received information. In short, we collect information about how many users, applications, services, and faces your installation has. During the first user sign up there is a sign “Agree to send anonymous statistics”. By checking it you agree with Exadel Privacy Policy and agree to send anonymous statistics to our servers.
Expand All @@ -17,4 +19,4 @@ What we do NOT collect:

During the first start, we assign to the CompreFace installation the `install_guid` variable. This variable is totally random, there is no possibility to retrieve any information from it, the only purpose of this variable is to understand that gathered statistics were sent from one machine. We send it in every request to our server to understand that this is the same installation as before.

If you have any questions about the privacy policy, what data we collect or how we use it, please [contact us]([email protected])
If you have any questions about the privacy policy, what data we collect or how we use it, please [contact us](mailto:[email protected])
6 changes: 4 additions & 2 deletions docs/How-to-Use-CompreFace.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# How to Use CompreFace


**Step 1.** You need to sign up for the system and log in into the account you’ve just created or use the one you already have. After that, the system redirects you to the main page.

Expand Down Expand Up @@ -60,7 +62,7 @@ async function saveNewImageToFaceCollection() {
formData.append("photo", photo);

try {
let r = await fetch('http://localhost:8000/api/v1/faces/?subject=`${name}`', {method: "POST", body: formData});
let r = await fetch('http://localhost:8000/api/v1/recognition/faces/?subject=`${name}`', {method: "POST", body: formData});
} catch (e) {
console.log('Houston, we have a problem...:', e);
}
Expand All @@ -73,7 +75,7 @@ This function sends the image to our server and shows results in a text area:
function recognizeFace(input) {

async function getData() {
let response = await fetch('http://localhost:8000/api/v1/faces/recognize')
let response = await fetch('http://localhost:8000/api/v1/recognition/recognize')
let data = await response.json()
return data
}
Expand Down
38 changes: 20 additions & 18 deletions docs/Rest-API-description.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Rest API description

## Table Of Contents

+ [Face Recognition Service Endpoints](#face-recognition-service-endpoints)
Expand Down Expand Up @@ -70,7 +72,7 @@ curl -X POST "http://localhost:8000/api/v1/recognition/recognize?limit=<limit>&
| face_plugins | param | string | optional | comma-separated slugs of face plugins. If empty, no additional information is returned. [Learn more](Face-services-and-plugins.md) |

Response body on success:
```
```json
{
"result" : [ {
"age" : [ 25, 32 ],
Expand Down Expand Up @@ -106,13 +108,13 @@ Response body on success:

| Element | Type | Description |
| ------------------------------ | ------- | ------------------------------------------------------------ |
| age | array | detected age range. Return only if [age plugin](docs/Face-services-and-plugins.md#face-plugins) is enabled |
| gender | string | detected gender. Return only if [gender plugin](docs/Face-services-and-plugins.md#face-plugins) is enabled |
| embedding | array | face embeddings. Return only if [calculator plugin](docs/Face-services-and-plugins.md#face-plugins) is enabled |
| age | array | detected age range. Return only if [age plugin](Face-services-and-plugins.md#face-plugins) is enabled |
| gender | string | detected gender. Return only if [gender plugin](Face-services-and-plugins.md#face-plugins) is enabled |
| embedding | array | face embeddings. Return only if [calculator plugin](Face-services-and-plugins.md#face-plugins) is enabled |
| box | object | list of parameters of the bounding box for this face |
| probability | float | probability that a found face is actually a face |
| x_max, y_max, x_min, y_min | integer | coordinates of the frame containing the face |
| landmarks | array | list of the coordinates of the frame containing the face-landmarks. Return only if [landmarks plugin](docs/Face-services-and-plugins.md#face-plugins) is enabled |
| landmarks | array | list of the coordinates of the frame containing the face-landmarks. Return only if [landmarks plugin](Face-services-and-plugins.md#face-plugins) is enabled |
| faces | list | list of similar faces with size of <prediction_count> order by similarity |
| similarity | float | similarity that on that image predicted person |
| subject | string | name of the subject in Face Collection |
Expand Down Expand Up @@ -271,18 +273,18 @@ Response body on success:

| Element | Type | Description |
| ------------------------------ | ------- | ------------------------------------------------------------ |
| age | array | detected age range. Return only if [age plugin](docs/Face-services-and-plugins.md#face-plugins) is enabled |
| gender | string | detected gender. Return only if [gender plugin](docs/Face-services-and-plugins.md#face-plugins) is enabled |
| embedding | array | face embeddings. Return only if [calculator plugin](docs/Face-services-and-plugins.md#face-plugins) is enabled |
| age | array | detected age range. Return only if [age plugin](Face-services-and-plugins.md#face-plugins) is enabled |
| gender | string | detected gender. Return only if [gender plugin](Face-services-and-plugins.md#face-plugins) is enabled |
| embedding | array | face embeddings. Return only if [calculator plugin](Face-services-and-plugins.md#face-plugins) is enabled |
| box | object | list of parameters of the bounding box for this face |
| probability | float | probability that a found face is actually a face |
| x_max, y_max, x_min, y_min | integer | coordinates of the frame containing the face |
| landmarks | array | list of the coordinates of the frame containing the face-landmarks. Return only if [landmarks plugin](docs/Face-services-and-plugins.md#face-plugins) is enabled |
| landmarks | array | list of the coordinates of the frame containing the face-landmarks. Return only if [landmarks plugin](Face-services-and-plugins.md#face-plugins) is enabled |
| similarity | float | similarity that on that image predicted person |
| execution_time | object | execution time of all plugins |
| plugins_versions | object | contains information about plugin versions |

## Face Detection Dervice
## Face Detection Service

To detect faces from the uploaded image:

Expand Down Expand Up @@ -337,13 +339,13 @@ Response body on success:

| Element | Type | Description |
| ------------------------------ | ------- | ------------------------------------------------------------ |
| age | array | detected age range. Return only if [age plugin](docs/Face-services-and-plugins.md#face-plugins) is enabled |
| gender | string | detected gender. Return only if [gender plugin](docs/Face-services-and-plugins.md#face-plugins) is enabled |
| embedding | array | face embeddings. Return only if [calculator plugin](docs/Face-services-and-plugins.md#face-plugins) is enabled |
| age | array | detected age range. Return only if [age plugin](Face-services-and-plugins.md#face-plugins) is enabled |
| gender | string | detected gender. Return only if [gender plugin](Face-services-and-plugins.md#face-plugins) is enabled |
| embedding | array | face embeddings. Return only if [calculator plugin](Face-services-and-plugins.md#face-plugins) is enabled |
| box | object | list of parameters of the bounding box for this face (on processedImage) |
| probability | float | probability that a found face is actually a face (on processedImage) |
| x_max, y_max, x_min, y_min | integer | coordinates of the frame containing the face (on processedImage) |
| landmarks | array | list of the coordinates of the frame containing the face-landmarks. Return only if [landmarks plugin](docs/Face-services-and-plugins.md#face-plugins) is enabled |
| landmarks | array | list of the coordinates of the frame containing the face-landmarks. Return only if [landmarks plugin](Face-services-and-plugins.md#face-plugins) is enabled |
| execution_time | object | execution time of all plugins |
| plugins_versions | object | contains information about plugin versions |

Expand Down Expand Up @@ -428,13 +430,13 @@ Response body on success:
| ------------------------------ | ------- | ------------------------------------------------------------ |
| source_image_face | object | additional info about source image face |
| face_matches | array | result of face verification |
| age | array | detected age range. Return only if [age plugin](docs/Face-services-and-plugins.md#face-plugins) is enabled |
| gender | string | detected gender. Return only if [gender plugin](docs/Face-services-and-plugins.md#face-plugins) is enabled |
| embedding | array | face embeddings. Return only if [calculator plugin](docs/Face-services-and-plugins.md#face-plugins) is enabled |
| age | array | detected age range. Return only if [age plugin](Face-services-and-plugins.md#face-plugins) is enabled |
| gender | string | detected gender. Return only if [gender plugin](Face-services-and-plugins.md#face-plugins) is enabled |
| embedding | array | face embeddings. Return only if [calculator plugin](Face-services-and-plugins.md#face-plugins) is enabled |
| box | object | list of parameters of the bounding box for this face |
| probability | float | probability that a found face is actually a face |
| x_max, y_max, x_min, y_min | integer | coordinates of the frame containing the face |
| landmarks | array | list of the coordinates of the frame containing the face-landmarks. Return only if [landmarks plugin](docs/Face-services-and-plugins.md#face-plugins) is enabled |
| landmarks | array | list of the coordinates of the frame containing the face-landmarks. Return only if [landmarks plugin](Face-services-and-plugins.md#face-plugins) is enabled |
| similarity | float | similarity between this face and the face on the source image |
| execution_time | object | execution time of all plugins |
| plugins_versions | object | contains information about plugin versions |

0 comments on commit a1b01c5

Please sign in to comment.