Я создал флеш-веб-сервер и использовал модель Openface Keras
если запрашивается веб-сервер с изображением с веб-камеры, веб-сервер возвращает результаты из значения прогнозируемой модели.
но я увидел какую-то ошибку,
[2019-06-06 17:28:47,847] ERROR in app: Exception on /facerec [GET]
Traceback (most recent call last):
File "C:\Users\pjh39\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\app.py", line 1832, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\pjh39\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\app.py", line 1818, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "C:\Users\pjh39\AppData\Local\Programs\Python\Python36\lib\site-packages\flask_restful\__init__.py", line 458, in wrapper
resp = resource(*args, **kwargs)
File "C:\Users\pjh39\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\views.py", line 88, in view
return self.dispatch_request(*args, **kwargs)
File "C:\Users\pjh39\AppData\Local\Programs\Python\Python36\lib\site-packages\flask_restful\__init__.py", line 573, in dispatch_request
resp = meth(*args, **kwargs)
File "C:/Users/pjh39/Desktop/raspberrypi_smarthomeproject/face_recognizer/webServer.py", line 383, in get
if recognize_faces_incam(embeddings,args['username'],args['stream_url']):
File "C:/Users/pjh39/Desktop/raspberrypi_smarthomeproject/face_recognizer/webServer.py", line 339, in recognize_faces_incam
identity = recognize_face(face, embeddings)
File "C:/Users/pjh39/Desktop/raspberrypi_smarthomeproject/face_recognizer/webServer.py", line 307, in recognize_face
face_embedding = image_to_embedding(face_image) # 현재 얼굴 이미지를 임베딩 벡터화.
File "C:/Users/pjh39/Desktop/raspberrypi_smarthomeproject/face_recognizer/webServer.py", line 301, in image_to_embedding
embedding = facemodel.predict_on_batch(img_array)
File "C:\Users\pjh39\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\engine\training.py", line 1297, in predict_on_batch
self._make_predict_function()
File "C:\Users\pjh39\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\engine\training.py", line 1979, in _make_predict_function
**kwargs)
File "C:\Users\pjh39\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\backend.py", line 3201, in function
return GraphExecutionFunction(inputs, outputs, updates=updates, **kwargs)
File "C:\Users\pjh39\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\backend.py", line 2939, in __init__
with ops.control_dependencies(self.outputs):
File "C:\Users\pjh39\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 5028, in control_dependencies
return get_default_graph().control_dependencies(control_inputs)
File "C:\Users\pjh39\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 4528, in control_dependencies
c = self.as_graph_element(c)
File "C:\Users\pjh39\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 3478, in as_graph_element
return self._as_graph_element_locked(obj, allow_tensor, allow_operation)
File "C:\Users\pjh39\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 3557, in _as_graph_element_locked
raise ValueError("Tensor %s is not an element of this graph." % obj)
ValueError: Tensor Tensor("norm_layer_1/l2_normalize:0", shape=(?, 128), dtype=float32) is not an element of this graph.
192.168.219.158 - - [06/Jun/2019 17:28:47] "GET /facerec HTTP/1.1" 500 -
Ожидаемая причина заключается в том, что помимо потока, в который загружена взвешенная модель, в запросе веб-сервера колбы создается поток, и ожидается, что сеанс будет перегружен.
Вы можете мне помочь?
Вот мой код:
https://github.com/jaehyunup/raspberrypi_smarthomeproject/blob/master/face_recognizer/webServer.py