From dc7b0504231b206733c7c1fcc576da0e7d9a9456 Mon Sep 17 00:00:00 2001 From: Brandon Amos Date: Sat, 3 Oct 2015 23:40:16 -0400 Subject: [PATCH] Web demo: Correctly display name. --- demos/web/server.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/demos/web/server.py b/demos/web/server.py index b7a8acd..41e88e0 100755 --- a/demos/web/server.py +++ b/demos/web/server.py @@ -297,7 +297,13 @@ class FaceNetServerProtocol(WebSocketServerProtocol): tr = (bb.right(), bb.top()) cv2.rectangle(annotatedFrame, bl, tr, color=(153, 255, 204), thickness=3) - name = "Unknown" if identity == -1 else self.people[identity] + if identity == -1: + if len(self.people) == 1: + name = self.people[0] + else: + name = "Unknown" + else: + name = self.people[identity] cv2.putText(annotatedFrame, name, (bb.left(), bb.top()-10), cv2.FONT_HERSHEY_SIMPLEX, fontScale=0.75, color=(152, 255, 204), thickness=2)