![]() |
DeepSight SDK
3.0.0
DeepSight SDK - crowd face analysis
|
The DeepSight SDK service is a minimal HTTP(S) server proxying requests to the SDK. Using an HTTP server allows:
When the service process is started, a ds::DeepSight instance is created. The service will proxy all requests to that ds::DeepSight instance by translating Json request objects to C++ SDK calls and C++ SDK return values into Json response objects. If a different ds::DeepSight instance is required, a new SDK service process needs to be launched.
There is a one-to-one match between the endpoints provided by the service and the SDK API: the ds::DeepSight::authenticate SDK method is mapped to the /DeepSight/authenticate URI and so on. HTTPS requests and responses are handled in Json, and there is a direct correspondence between function input arguments and output as well. For example, the input parameters to a call to the ds::DeepSight::analyze method:
translate to the following request:
and response:
to a /DeepSight/analyze call.
The DeepSightService program is located under the service directory. It can be launched by specifying the following command line arguments:
-s or --settings : sets the path of the settings file to be used to initialize the SDK.-n or --networks : sets the path to the neural networks directory to be used to initialize the SDK.-p or --port : sets the port the HTTP server will listen to. default is 80.--ssl : enables SSL encryption. Requires certificate.key and certificate.crt certificate files (see SSL Certificates).--settings and --networks are mutually exclusive. The neural networks path is the minimum required setting to initialize the SDK. If more settings are needed then specify the path to a settings ini file like this one:
If a license key is set in the settings, the SDK will automatically authenticate. Alternatively, the start-service.sh (Linux) or start-service.bat (Windows) script can be used for launching the process on port 10080 without SSL.
All requests to the SDK service are HTTP POST requests. The body of the request is a Json format string representing the input parameters of the ds::DeepSight member function the URI wraps. For ds::DeepSight member functions that do not accept arguments, an empty json object {} needs to be passed. The Content-Type of the request should be application/json, which means that the request should not be url-encoded or a multipart, but a plain json string. Eg:
Images in Json requests should be base64 encoded. Accepted image formats are jpeg and png. Eg:
C++ objects passed as arguments in Json requests should be translated into Json objects where member variables names are preserved verbatim. Eg:
C++ enum values are represented by their enumerator names. Eg:
ds::Settings C++ objects are represented in Json format as follows:
Responses are Json objects containing 3 fields:
error_codedescriptionresultWhere the error_code is 0 for successful responses, or a value described in the section Error Codes. description is an empty string for successful responses, or the reason for failure. result is the Json representation for the return value of the function call. An example response to the previous /DeepSight/analyze call might be:
For ds::DeepSight member functions that do not return arguments, an empty json object {} is returned.
The SDK service supports SSL encryption. In order for this to work, SSL certificates are required in the directory where the DeepSightService process is launched. The certificate file names default to certificate.key and certificate.crt; these can be given as command-line arguments as well. Self signed certificates are provided in the package under the service directory; however those are provided only for testing purposes. It is recommended to create valid certificates for production purposes.
| 1000 | An unexpected server error occurred. Check the description fields and report this error to support@raydiant.com |
|---|---|
| 1001 | An unexpected error occurred during an SDK function call. Check the description fields and report this error to support@raydiant.com |
| 1100 | Request size exceeds allowed limits. Maximum request size is 20MB |
| 1101 | Input image could not be decoded. Format was not jpeg or png, or an issue occurred during base64 decoding |
| 1102 | Json object input request could not be decoded. Check the json request formatting |
| 1103 | A field is missing in the request for the specific SDK call |
| 1104 | The input Json request has missing or malformed fields |
| 1105 | The combination of fields in the input Json request is wrong |
| 1200 | Could not detect a face in the input image |
A call to a nonexistent endpoint will result in a HTTP status 404 response.
Returns a string containing the DeepSight version number. This is not an SDK call and does not return a Json response; instead it can be used as a health check to verify that the service is up and running.
Check ds::DeepSight::authenticate
Check ds::DeepSight::setSettings
Check ds::DeepSight::getSettings
Check ds::DeepSight::analyze
Check ds::DeepSight::analyzeSingleImage
Check ds::DeepSight::analyzeBodies
Check ds::DeepSight::getLicenseTimeLeft
Check ds::DeepSight::getCountOfBodies
Check ds::DeepSight::getCountOfFaces
Check ds::DeepSight::resetTracker
Check ds::DeepSight::resetBodyTracker
This endpoint returns a default constructed ds::Settings object. It wraps a fictitious C++ API function
whose output Json response has the following format: