-
Notifications
You must be signed in to change notification settings - Fork 13
/
facebox.remoto.go
266 lines (216 loc) · 7.57 KB
/
facebox.remoto.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
// Package machinebox provides access to Facebox Remoto services.
package machinebox
import (
"github.com/machinebox/remoto/remototypes"
)
// Facebox provides facial detection and recognition in images.
type Facebox interface {
// TeachFile teaches Facebox a new face from an image file.
TeachFile(TeachFileRequest) TeachFileResponse
// TeachURL teaches Facebox a new face from an image on the web.
TeachURL(TeachURLRequest) TeachURLResponse
// TeachFaceprint teaches Facebox about a face from a Faceprint.
TeachFaceprint(TeachFaceprintRequest) TeachFaceprintResponse
// CheckFile checks an image file for faces.
CheckFile(CheckFileRequest) CheckFileResponse
// CheckURL checks a hosted image file for faces.
CheckURL(CheckURLRequest) CheckURLResponse
// CheckFaceprint checks to see if a Faceprint matches any known
// faces.
CheckFaceprint(CheckFaceprintRequest) CheckFaceprintResponse
// SimilarID checks for similar faces by ID.
SimilarID(SimilarIDRequest) SimilarIDResponse
// SimilarFile checks for similar faces from the face in an image file.
SimilarFile(SimilarFileRequest) SimilarFileResponse
// SimilarURL checks for similar faces in a hosted image file.
SimilarURL(SimilarURLRequest) SimilarURLResponse
// Rename changes a person's name.
Rename(RenameRequest) RenameResponse
// RenameID changes the name of a previously taught face, by ID.
RenameID(RenameIDRequest) RenameIDResponse
// RemoveID removes a face with the specified ID.
RemoveID(RemoveIDRequest) RemoveIDResponse
// FaceprintCompare compares faceprints to a specified target describing
// similarity.
FaceprintCompare(FaceprintCompareRequest) FaceprintCompareResponse
// GetState gets the Facebox state file.
GetState(GetStateRequest) remototypes.FileResponse
// PutState sets the Facebox state file.
PutState(PutStateRequest) PutStateResponse
}
// TeachFileRequest is the request object for TeachFile calls.
type TeachFileRequest struct {
// ID is an identifier describing the source, for example the filename.
ID string
// Name is the name of the person in the image.
Name string
// File is the image containing the face to teach.
File remototypes.File
}
// TeachFileResponse is the response object for TeachFile calls.
type TeachFileResponse struct{}
// TeachURLRequest is the request object for TeachURL calls.
type TeachURLRequest struct {
// ID is an identifier describing the source, for example the filename.
ID string
// Name is the name of the person in the image.
Name string
// URL is the address of the image.
URL string
}
// TeachURLResponse is the response object for TeachURL calls.
type TeachURLResponse struct{}
// TeachFaceprintRequest is the request object for TeachFaceprint calls.
type TeachFaceprintRequest struct {
ID string
Name string
Faceprint string
}
// TeachFaceprintResponse is the response object for TeachFaceprint calls.
type TeachFaceprintResponse struct{}
// CheckFileRequest is the request object for CheckFile calls.
type CheckFileRequest struct {
// File is the image to check for faces.
File remototypes.File
}
// CheckFileResponse is the response object for CheckFile calls.
type CheckFileResponse struct {
// Faces is a list of faces that were found.
Faces []Face
}
// CheckURLRequest is the request object for CheckURL calls.
type CheckURLRequest struct {
// URL is the address of the image to check.
URL string
}
// CheckURLResponse is the response object for CheckURL calls.
type CheckURLResponse struct {
// Faces is a list of faces that were found.
Faces []Face
}
// Face describes a face.
type Face struct {
// ID is the identifier of the source that was matched.
ID string
// Name is the name of the identified person.
Name string
// Matched is whether the face was recognized or not.
Matched bool
// Faceprint is the Facebox Faceprint of this face.
Faceprint string
// Rect is where the face appears in the source image.
Rect Rect
}
// Rect is a bounding box describing a rectangle of an image.
type Rect struct {
// Top is the starting Y coordinate.
Top int
// Left is the starting X coordinate.
Left int
// Width is the width.
Width int
// Height is the height.
Height int
}
// SimilarIDRequest is the request object for SimilarID calls.
type SimilarIDRequest struct {
// ID is the identifier of the source to look for similar faces of.
ID string
}
// SimilarIDResponse is the response object for SimilarID calls.
type SimilarIDResponse struct {
// Faces is a list of similar faces.
Faces []SimilarFace
}
// SimilarFileRequest is the request object for SimilarFile calls.
type SimilarFileRequest struct {
File remototypes.File
}
// SimilarFileResponse is the response object for SimilarFile calls.
type SimilarFileResponse struct {
Faces []SimilarFace
}
// SimilarURLRequest is the request object for SimilarURL calls.
type SimilarURLRequest struct {
URL string
}
// SimilarURLResponse is the response object for SimilarURL calls.
type SimilarURLResponse struct {
Faces []SimilarFace
}
// SimilarFace is a detected face with similar matching faces.
type SimilarFace struct {
// Rect is where the face appears in the image.
Rect Rect
// SimilarFaces is a list of similar faces.
SimilarFaces []Face
}
// RenameRequest is the request object for Rename calls.
type RenameRequest struct {
// From is the original name.
From string
// To is the new name.
To string
}
// RenameResponse is the response object for Rename calls.
type RenameResponse struct{}
// RenameIDRequest is the request object for RenameID calls.
type RenameIDRequest struct {
// ID is the identifier of the source to rename.
ID string
// Name is the new name to assign to the item matching ID.
Name string
}
// RenameIDResponse is the response object for RenameID calls.
type RenameIDResponse struct{}
// RemoveIDRequest is the request object for RemoveID calls.
type RemoveIDRequest struct {
// ID is the identifier of the source to remove.
ID string
}
// RemoveIDResponse is the response object for RemoveID calls.
type RemoveIDResponse struct{}
// FaceprintCompareRequest is the request object for FaceprintCompare calls.
type FaceprintCompareRequest struct {
// Target is the target Faceprint to which the Faceprints will be compared.
Target string
// Faceprints is a list of Faceprints that will be compared to Target.
Faceprints []string
}
// FaceprintCompareResponse is the response object for FaceprintCompare calls.
type FaceprintCompareResponse struct {
// Confidences is a list of confidence values.
// The order matches the order of FaceprintCompareRequest.Faceprints.
Confidences []float64
}
// CheckFaceprintRequest is the request object for CheckFaceprint calls.
type CheckFaceprintRequest struct {
// Faceprints is a list of Faceprints to check.
Faceprints []string
}
// CheckFaceprintResponse is the response object for CheckFaceprint calls.
type CheckFaceprintResponse struct {
// Faces is a list of faces checked from Faceprints.
Faces []FaceprintFace
}
// FaceprintFace is a face.
type FaceprintFace struct {
// Matched is whether the face was recognized or not.
Matched bool
// Confidence is a numerical value of how confident the AI
// is that this is a match.
Confidence float64
// ID is the identifier of the source that matched.
ID string
// Name is the name of the person recognized.
Name string
}
// GetStateRequest is the request object for GetState calls.
type GetStateRequest struct{}
// PutStateRequest is the request object for PutState calls.
type PutStateRequest struct {
// StateFile is the Facebox state file to set.
StateFile remototypes.File
}
// PutStateResponse is the response object for PutState calls.
type PutStateResponse struct{}