Skip to content

Commit 8c34c89

Browse files
committed
Updates
1 parent 7155274 commit 8c34c89

17 files changed

+389
-87
lines changed

Idris-Elba.jpg

-8.39 KB
Loading

backup.rs

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using System;
2+
using System.IO;
3+
using System.Net.Http;
4+
using System.Threading.Tasks;
5+
6+
7+
namespace app
8+
{
9+
10+
class App {
11+
12+
static HttpClient client = new HttpClient();
13+
14+
public static async Task makeRequest(){
15+
16+
var request = new MultipartFormDataContent();
17+
var image_data = File.OpenRead("image.jpg");
18+
request.Add(new StreamContent(image_data),"image",Path.GetFileName("image.jpg"));
19+
var output = await client.PostAsync("http://localhost:80/v1/vision/scene",request);
20+
var jsonString = await output.Content.ReadAsStringAsync();
21+
22+
Console.WriteLine(jsonString);
23+
24+
}
25+
26+
static void Main(string[] args){
27+
28+
makeRequest().Wait();
29+
30+
}
31+
32+
}
33+
34+
}

deepstack_activated.png

887 KB
Loading

deepstack_pre.png

874 KB
Loading

facedetection.rst

+5-9
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
You can adapt this file completely to your liking, but it should at least
44
contain the root `toctree` directive.
55
6+
.. _facedetection:
7+
68
Face Detection
7-
==============
9+
================
810

911
The face detection API detects faces and returns their coordinates as well as the gender.
1012
It functions similarly to the face recognition API except that it does not
@@ -58,12 +60,6 @@ Also note that the recognition API does not return gender predictions.
5860
var output = await client.PostAsync("http://localhost:80/v1/vision/face",request);
5961
var jsonString = await output.Content.ReadAsStringAsync();
6062
Response response = JsonConvert.DeserializeObject<Response>(jsonString);
61-
62-
foreach (var user in response.predictions){
63-
64-
Console.WriteLine(user.gender);
65-
66-
}
6763

6864
Console.WriteLine(jsonString);
6965

@@ -85,7 +81,7 @@ Result ::
8581
male
8682
male
8783
female
88-
{'predictions': [{'y_max': 303, 'gender': 'female', 'confidence': 0.99999213, 'x_min': 534, 'x_max': 629, 'y_min': 174}, {'y_max': 275, 'gender': 'male', 'confidence': 0.6611953, 'x_min': 616, 'x_max': 711, 'y_min': 146}, {'y_max': 259, 'gender': 'male', 'confidence': 0.99884146, 'x_min': 729, 'x_max': 811, 'y_min': 147}, {'y_max': 290, 'gender': 'female', 'confidence': 0.99997365, 'x_min': 471, 'x_max': 549, 'y_min': 190}], 'success': True}
84+
{'predictions': [{'y_max': 303, 'gender': 'female', 'confidence': 100, 'x_min': 534, 'x_max': 629, 'y_min': 174}, {'y_max': 275, 'gender': 'male', 'confidence': 99, 'x_min': 616, 'x_max': 711, 'y_min': 146}, {'y_max': 259, 'gender': 'male', 'confidence': 98, 'x_min': 729, 'x_max': 811, 'y_min': 147}, {'y_max': 290, 'gender': 'female', 'confidence': 99, 'x_min': 471, 'x_max': 549, 'y_min': 190}], 'success': True}
8985

9086
We can use the coordinates returned to extract the faces from the image
9187

@@ -148,7 +144,7 @@ We can use the coordinates returned to extract the faces from the image
148144
image.Mutate(x => x
149145
.Crop(crop_region)
150146
);
151-
image.Save(user.gender + i.ToString() + "_.jpg");
147+
image.Save(i.ToString() + "_.jpg");
152148

153149
}
154150

facematch.rst

+133
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
.. DeepStack documentation master file, created by
2+
sphinx-quickstart on Wed Dec 12 17:30:35 2018.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
.. _facematch:
7+
8+
Face Match
9+
===========
10+
11+
The face detection api compares faces in two different pictures and tells the similarity between them.
12+
A typical use of this is matching identity documents with pictures of a person.
13+
14+
15+
**Example**
16+
17+
Here we shall compare two pictures of obama
18+
19+
.. figure:: test-image6.jpeg
20+
:align: center
21+
22+
.. figure:: test-image7.jpg
23+
:align: center
24+
25+
::
26+
27+
using System;
28+
using System.IO;
29+
using System.Net.Http;
30+
using System.Threading.Tasks;
31+
32+
33+
namespace app
34+
{
35+
36+
class App {
37+
38+
static HttpClient client = new HttpClient();
39+
40+
public static async Task makeRequest(){
41+
42+
var request = new MultipartFormDataContent();
43+
var image_data1 = File.OpenRead("test-image6.jpeg");
44+
var image_data2 = File.OpenRead("test-image7.jpg");
45+
request.Add(new StreamContent(image_data1),"image1",Path.GetFileName("test-image6.jpeg"));
46+
request.Add(new StreamContent(image_data2),"image2",Path.GetFileName("test-image7.jpg"));
47+
var output = await client.PostAsync("http://localhost:80/v1/vision/face/match",request);
48+
var jsonString = await output.Content.ReadAsStringAsync();
49+
50+
Console.WriteLine(jsonString);
51+
52+
}
53+
54+
static void Main(string[] args){
55+
56+
makeRequest().Wait();
57+
58+
}
59+
60+
}
61+
62+
}
63+
64+
Result ::
65+
66+
{'similarity': 0.73975885, 'success': True}
67+
68+
Here we shall compare a picture of Obama with that of Bradley Cooper
69+
70+
.. figure:: test-image6.jpeg
71+
:align: center
72+
73+
.. figure:: test-image8.jpg
74+
:align: center
75+
76+
::
77+
78+
using System;
79+
using System.IO;
80+
using System.Net.Http;
81+
using System.Threading.Tasks;
82+
83+
84+
namespace app
85+
{
86+
87+
class App {
88+
89+
static HttpClient client = new HttpClient();
90+
91+
public static async Task makeRequest(){
92+
93+
var request = new MultipartFormDataContent();
94+
var image_data1 = File.OpenRead("test-image6.jpeg");
95+
var image_data2 = File.OpenRead("test-image8.jpg");
96+
request.Add(new StreamContent(image_data1),"image1",Path.GetFileName("test-image6.jpeg"));
97+
request.Add(new StreamContent(image_data2),"image2",Path.GetFileName("test-image8.jpg"));
98+
var output = await client.PostAsync("http://localhost:80/v1/vision/face/match",request);
99+
var jsonString = await output.Content.ReadAsStringAsync();
100+
101+
Console.WriteLine(jsonString);
102+
103+
}
104+
105+
static void Main(string[] args){
106+
107+
makeRequest().Wait();
108+
109+
}
110+
111+
}
112+
113+
}
114+
115+
Result ::
116+
117+
{{'similarity': 0.4456827, 'success': True}
118+
119+
As seen above, the match for two different pictures of Obama was very high while the match for Obama and Bradley Cooper was very low.
120+
121+
**Performance**
122+
123+
DeepStack offers three modes allowing you to tradeoff speed for peformance.
124+
During startup, you can specify performance mode to be , **"High" , "Medium" and "Low"**
125+
126+
The default mode is "Medium"
127+
128+
You can speciy a different mode as seen below ::
129+
130+
sudo docker run -e MODE=High -e VISION-FACE=True -v localstorage:/datastore \
131+
-p 80:5000 deepquestai/deepstack
132+
133+
Note the -**e MODE=High** above

facerecognition.rst

+20-11
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,9 @@ We shall test this on the image below.
153153

154154
Result ::
155155

156-
unknown
157156
Idris Elba
158-
Full Response: {'predictions': [{'confidence': 0, 'y_min': 233, 'x_max': 1290, 'x_min': 850,
159-
'userid': 'unknown', 'y_max': 827}, {'confidence': 0.6676924, 'y_min': 160, 'x_max': 2041,
160-
'x_min': 1577, 'userid': 'Idris Elba', 'y_max': 767}], 'success': True}
157+
unknown
158+
Full Response: {'success': True, 'predictions': [{'x_min': 215, 'confidence': 0.76965684, 'x_max': 264, 'y_max': 91, 'y_min': 20, 'userid': 'Idris Elba'}, {'x_min': 115, 'confidence': 0, 'x_max': 162, 'y_max': 97, 'y_min': 31, 'userid': 'unknown'}]}
161159

162160
As you can see above, the first user is unknown since we did not previously register her, however, Idris Elba was detected as we
163161
registered a picture of his in the previous tutorial.
@@ -254,9 +252,8 @@ Result
254252
**Setting Minimum Confidence**
255253

256254
DeepStack recognizes faces by computing the similarity between the embedding of a new face and the set of embeddings of previously registered faces.
257-
By default, the minimum confidence is 0.45. The confidence ranges between 0 and 1.
255+
By default, the minimum confidence is 0.67. The confidence ranges between 0 and 1.
258256
If the similarity for a new face falls below the min_confidence, unknown will be returned.
259-
260257
The min_confidence parameter allows you to increase or reduce the minimum confidence.
261258

262259
We lower the confidence allowed below.
@@ -327,17 +324,15 @@ Example ::
327324

328325
Result ::
329326

330-
Adele
331327
Idris Elba
332-
Full Response: {'success': True, 'predictions': [{'confidence': 0.44580227, 'y_min': 233,
333-
'y_max': 827, 'userid': 'Adele', 'x_max': 1290, 'x_min': 850}, {'confidence': 0.6676924,
334-
'y_min': 160, 'y_max': 767, 'userid': 'Idris Elba', 'x_max': 2041, 'x_min': 1577}]}
328+
Adele
329+
Full Response: {'success': True, 'predictions': [{'userid': 'Idris Elba', 'y_min': 154, 'x_min': 1615, 'x_max': 1983, 'confidence': 0.76965684, 'y_max': 682}, {'userid': 'Adele', 'y_min': 237, 'x_min': 869, 'x_max': 1214, 'confidence': 0.6044803, 'y_max': 732}]}
335330

336331
By reducing the allowed confidence, the system detects the first face as Adele. The lower the confidence, the more likely
337332
for the system to make mistakes. When the confidence level is high, mistakes are extremely rare, however, the system may
338333
return unknown always if the confidence is too high.
339334

340-
**For security related processes such as authentication, set the min_confidence at 0.5 or higher**
335+
**For security related processes such as authentication, set the min_confidence at 0.7 or higher**
341336

342337
Managing Registered Faces
343338
--------------------------
@@ -423,3 +418,17 @@ Deleting a face ::
423418
Result ::
424419

425420
{'success': True}
421+
422+
**Performance**
423+
424+
DeepStack offers three modes allowing you to tradeoff speed for peformance.
425+
During startup, you can specify performance mode to be , **"High" , "Medium" and "Low"**
426+
427+
The default mode is "Medium"
428+
429+
You can speciy a different mode as seen below ::
430+
431+
sudo docker run -e MODE=High -e VISION-FACE=True -v localstorage:/datastore \
432+
-p 80:5000 deepquestai/deepstack
433+
434+
Note the -**e MODE=High** above

getting-started.rst

+19-9
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,14 @@ Getting Started with DeepStack
77
===============================
88

99
DeepStack is distributed as a docker image. In this tutorial, we shall
10-
go through the complete process of setting up docker and DeepStack and using it
10+
go through the complete process of using DeepStack
1111
to build a Face Recognition system.
1212

13-
**Setting Up Docker**
13+
Setting Up DeepStack
14+
---------------------
1415

15-
Docker is a container platform that allows developers to distribute applications
16-
as self-contained packages that ships every dependency from the
17-
operating system to the app dependences. It is similar to virtual machines
18-
but is more lightweight and easier to manage.
19-
20-
You can learn more about Docker on `Docker's Website <https://docker.io />`_
21-
Visit `Docker Getting Started <https://docs.docker.com/get-started />`_ for instructions on setting up and using Docker for the first time.
16+
Follow instructions on read :ref:`home` to install the CPU Version of DeepStack
17+
If you have a system with Nvidia GPU, follow instruction on read :ref:`gpuinstall` to install the GPU Version of DeepStack
2218

2319
**Installing DeepStack**
2420

@@ -208,3 +204,17 @@ We have just created a face recognition system. You can try with different peopl
208204

209205
The next tutorial is dedicated to the full power of the face recognition api as well as best practices to make the best out of it.
210206

207+
**Performance**
208+
209+
DeepStack offers three modes allowing you to tradeoff speed for peformance.
210+
During startup, you can specify performance mode to be , "High","Medium" and "Low"
211+
212+
The default mode is "Medium"
213+
214+
You can speciy a different mode as seen below ::
215+
216+
sudo docker run -e MODE=High -e VISION-FACE=True -v localstorage:/datastore \
217+
-p 80:5000 deepquestai/deepstack
218+
219+
Note the -**e MODE=High** above
220+

0 commit comments

Comments
 (0)