facer 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/facer.rb +1 -1
- data/lib/facer/faces.rb +32 -8
- metadata +4 -4
data/lib/facer.rb
CHANGED
data/lib/facer/faces.rb
CHANGED
@@ -72,14 +72,16 @@ module Facer
|
|
72
72
|
|
73
73
|
# Associace many images to a user. I assume every images contains a single face
|
74
74
|
def associate_multi(images,user,namespace, force_train = false, detector = :Normal)
|
75
|
-
|
75
|
+
out=[]
|
76
76
|
images.each do |image|
|
77
|
-
|
77
|
+
resp=associate(image,user,namespace,false,detector) || {"tid" => nil, "infos" => nil}
|
78
|
+
resp["image"]=image
|
79
|
+
out += resp
|
78
80
|
end
|
79
|
-
if(
|
80
|
-
|
81
|
+
if(force_train)
|
82
|
+
train(user,namespace)
|
81
83
|
end
|
82
|
-
return
|
84
|
+
return out
|
83
85
|
end
|
84
86
|
|
85
87
|
# Associace a face image to a user. I assume the image contains a single face
|
@@ -92,13 +94,35 @@ module Facer
|
|
92
94
|
ret=@linker.call("tags","save",{"tids" => tid, "uid" => "#{user}@#{namespace}"})
|
93
95
|
if(ret["status"].to_sym == :success)
|
94
96
|
if(force_train)
|
95
|
-
|
97
|
+
train(user,namespace)
|
96
98
|
end
|
97
|
-
return
|
99
|
+
return {"tid" => ret["saved_tags"][0]["tid"], "infos" => tag}
|
98
100
|
end
|
99
101
|
end
|
100
102
|
end
|
101
|
-
return
|
103
|
+
return nil
|
104
|
+
end
|
105
|
+
|
106
|
+
def deassociate(tid,user,namespace, force_train = false)
|
107
|
+
ret=@linker.call("tags","remove",{"tids" => tid})
|
108
|
+
if(ret["status"].to_sym == :success)
|
109
|
+
if(force_train)
|
110
|
+
train(user,namespace)
|
111
|
+
end
|
112
|
+
return true
|
113
|
+
end
|
114
|
+
return false
|
115
|
+
end
|
116
|
+
|
117
|
+
def deassociate_multi(tids,user,namespace, force_train = false)
|
118
|
+
out=[]
|
119
|
+
tids.each do |tid|
|
120
|
+
out += {"tid" => tid, "success" => deassociate(tid,user,namespace,false,detector)}
|
121
|
+
end
|
122
|
+
if(force_train)
|
123
|
+
train(user,namespace)
|
124
|
+
end
|
125
|
+
return out
|
102
126
|
end
|
103
127
|
|
104
128
|
private
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: facer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Stefano Valicchia
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-16 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|