With processes = 1 it seems to work, but I get no images.
`[root@ryzen mlapi]# python3 ./api.py -c config.ini
Initializing log
DEBUG: DB engine ready
DEBUG: No secrets file configured
DEBUG: Initializing face recognition with model:cnn upsample:1, jitters:0
DEBUG: pre-trained faces found, using that. If you want to add new images, remove: ./known_faces/faces.dat
INFO: --------| mlapi version:1.0.1 |--------
INFO: Starting server with max:1 processes
Serving Flask app "api" (lazy loading)
Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
Debug mode: off
Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
DEBUG: Object Recognition requested
DEBUG: get_file returned: images/2bf2b853-265a-4c05-a6da-35656dd76527.jpg
DEBUG: Initializing Yolo
DEBUG: config:./models/yolov3/yolov3.cfg, weights:./models/yolov3/yolov3.weights
192.168.40.138 - - [20/Jan/2020 07:10:11] "POST /api/v1/detect/object?delete=True HTTP/1.1" 200 -
DEBUG: Object Recognition requested
DEBUG: get_file returned: images/7b7ac66c-9eb4-4f34-b4cf-b26273cea75d.jpg
INFO: object:train at [-4, 40, 512, 442] has a acceptable confidence:0.7992180585861206 compared to min confidence of: 0.4, adding
192.168.40.138 - - [20/Jan/2020 07:10:13] "POST /api/v1/detect/object?delete=True HTTP/1.1" 200 -
DEBUG: Face Recognition requested
DEBUG: get_file returned: images/5164491b-f26d-4b75-89e0-2411f7fca166.jpg
DEBUG: Face recognition: no faces found
192.168.40.138 - - [20/Jan/2020 07:10:14] "POST /api/v1/detect/object?type=face&delete=True HTTP/1.1" 200 -
DEBUG: Object Recognition requested
DEBUG: get_file returned: images/be67ae34-90ad-4bd1-86c7-c8364c28d8cb.jpg
192.168.40.138 - - [20/Jan/2020 07:10:16] "POST /api/v1/detect/object?delete=True HTTP/1.1" 200 -
DEBUG: Object Recognition requested
DEBUG: get_file returned: images/e85484eb-3d29-493b-91b6-e2864d7aba80.jpg
192.168.40.138 - - [20/Jan/2020 07:10:18] "POST /api/v1/detect/object?delete=True HTTP/1.1" 200 -
DEBUG: Face Recognition requested
DEBUG: get_file returned: images/a7e82e7b-4473-43f3-8d96-382040b480a7.jpg
DEBUG: Face recognition: no faces found
192.168.40.138 - - [20/Jan/2020 07:10:18] "POST /api/v1/detect/object?type=face&delete=True HTTP/1.1" 200 -
DEBUG: Object Recognition requested
DEBUG: get_file returned: images/3ed7ddf3-2900-4886-9052-f32651f28403.jpg
192.168.40.138 - - [20/Jan/2020 07:10:31] "POST /api/v1/detect/object?delete=True HTTP/1.1" 200 -
DEBUG: Object Recognition requested
DEBUG: get_file returned: images/7e94b3b8-c3ed-4bfd-9423-817494ed6a1f.jpg
192.168.40.138 - - [20/Jan/2020 07:10:32] "POST /api/v1/detect/object?delete=True HTTP/1.1" 200 -
DEBUG: Face Recognition requested
DEBUG: get_file returned: images/a95a802b-20f1-4851-92d7-12c0cff18e26.jpg
DEBUG: Face recognition: no faces found
192.168.40.138 - - [20/Jan/2020 07:10:32] "POST /api/v1/detect/object?type=face&delete=True HTTP/1.1" 200 -
DEBUG: Object Recognition requested
DEBUG: get_file returned: images/e1e952ad-234f-427c-a4f3-ba639ac5c2b3.jpg
INFO: object:train at [-4, 74, 514, 478] has a acceptable confidence:0.7119221091270447 compared to min confidence of: 0.4, adding
192.168.40.138 - - [20/Jan/2020 07:10:36] "POST /api/v1/detect/object?delete=True HTTP/1.1" 200 -
DEBUG: Object Recognition requested
DEBUG: get_file returned: images/08f73b58-1892-4624-b692-2cfe49044df0.jpg
INFO: object:train at [-4, 74, 514, 478] has a acceptable confidence:0.7119221091270447 compared to min confidence of: 0.4, adding
192.168.40.138 - - [20/Jan/2020 07:10:38] "POST /api/v1/detect/object?delete=True HTTP/1.1" 200 -
DEBUG: Face Recognition requested
DEBUG: get_file returned: images/d6695aac-711d-49eb-80ad-7fec5de0c696.jpg
DEBUG: Face recognition: no faces found
[snip]
`
With processes = 2 there's an error:
DEBUG: Object Recognition requested DEBUG: get_file returned: images/52ac9970-d23f-4158-990d-ac65fee2a52e.jpg DEBUG: Initializing Yolo DEBUG: config:./models/yolov3/yolov3.cfg, weights:./models/yolov3/yolov3.weights INFO: object:person at [462, 318, 600, 654] has a acceptable confidence:0.9877113103866577 compared to min confidence of: 0.4, adding 192.168.40.138 - - [20/Jan/2020 07:07:21] "POST /api/v1/detect/object?delete=True HTTP/1.1" 200 - DEBUG: Face Recognition requested DEBUG: get_file returned: images/bfe44a18-5ce6-4d08-a27b-6845c24e73ec.jpg 192.168.40.138 - - [20/Jan/2020 07:07:22] "POST /api/v1/detect/object?type=face&delete=True HTTP/1.1" 500 - Error on request: Traceback (most recent call last): File "/usr/local/lib64/python3.6/site-packages/werkzeug/serving.py", line 304, in run_wsgi execute(self.server.app) File "/usr/local/lib64/python3.6/site-packages/werkzeug/serving.py", line 292, in execute application_iter = app(environ, start_response) File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2463, in __call__ return self.wsgi_app(environ, start_response) File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2449, in wsgi_app response = self.handle_exception(e) File "/usr/local/lib/python3.6/site-packages/flask_restful/__init__.py", line 269, in error_router return original_handler(e) File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1866, in handle_exception reraise(exc_type, exc_value, tb) File "/usr/local/lib/python3.6/site-packages/flask/_compat.py", line 38, in reraise raise value.with_traceback(tb) File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2446, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1951, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/local/lib/python3.6/site-packages/flask_restful/__init__.py", line 269, in error_router return original_handler(e) File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1820, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/local/lib/python3.6/site-packages/flask/_compat.py", line 38, in reraise raise value.with_traceback(tb) File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1949, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1935, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/usr/local/lib/python3.6/site-packages/flask_restful/__init__.py", line 458, in wrapper resp = resource(*args, **kwargs) File "/usr/local/lib/python3.6/site-packages/flask/views.py", line 89, in view return self.dispatch_request(*args, **kwargs) File "/usr/local/lib/python3.6/site-packages/flask_restful/__init__.py", line 573, in dispatch_request resp = meth(*args, **kwargs) File "/usr/local/lib/python3.6/site-packages/flask_jwt_extended/view_decorators.py", line 108, in wrapper return fn(*args, **kwargs) File "/root/mlapi/api.py", line 125, in post detections = m.detect(image) File "/root/mlapi/modules/face_recognition.py", line 68, in detect face_locations = face_recognition.face_locations(rgb_image, model=self.model, number_of_times_to_upsample=self.upsample_times) File "/usr/local/lib/python3.6/site-packages/face_recognition/api.py", line 116, in face_locations return [_trim_css_to_bounds(_rect_to_css(face.rect), img.shape) for face in _raw_face_locations(img, number_of_times_to_upsample, "cnn")] File "/usr/local/lib/python3.6/site-packages/face_recognition/api.py", line 100, in _raw_face_locations return cnn_face_detector(img, number_of_times_to_upsample) RuntimeError: Error while calling cudaGetDevice(&the_device_id) in file /tmp/pip-install-28f7zm6b/dlib/dlib/cuda/gpu_data.cpp:201. code: 3, reason: initialization error
Works with local detection. I'll be happy to provide whatever debug is neccesary.
With processes = 1 it seems to work, but I get no images.
`[root@ryzen mlapi]# python3 ./api.py -c config.ini Initializing log DEBUG: DB engine ready DEBUG: No secrets file configured DEBUG: Initializing face recognition with model:cnn upsample:1, jitters:0 DEBUG: pre-trained faces found, using that. If you want to add new images, remove: ./known_faces/faces.dat INFO: --------| mlapi version:1.0.1 |-------- INFO: Starting server with max:1 processes
With processes = 2 there's an error:
DEBUG: Object Recognition requested DEBUG: get_file returned: images/52ac9970-d23f-4158-990d-ac65fee2a52e.jpg DEBUG: Initializing Yolo DEBUG: config:./models/yolov3/yolov3.cfg, weights:./models/yolov3/yolov3.weights INFO: object:person at [462, 318, 600, 654] has a acceptable confidence:0.9877113103866577 compared to min confidence of: 0.4, adding 192.168.40.138 - - [20/Jan/2020 07:07:21] "POST /api/v1/detect/object?delete=True HTTP/1.1" 200 - DEBUG: Face Recognition requested DEBUG: get_file returned: images/bfe44a18-5ce6-4d08-a27b-6845c24e73ec.jpg 192.168.40.138 - - [20/Jan/2020 07:07:22] "POST /api/v1/detect/object?type=face&delete=True HTTP/1.1" 500 - Error on request: Traceback (most recent call last): File "/usr/local/lib64/python3.6/site-packages/werkzeug/serving.py", line 304, in run_wsgi execute(self.server.app) File "/usr/local/lib64/python3.6/site-packages/werkzeug/serving.py", line 292, in execute application_iter = app(environ, start_response) File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2463, in __call__ return self.wsgi_app(environ, start_response) File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2449, in wsgi_app response = self.handle_exception(e) File "/usr/local/lib/python3.6/site-packages/flask_restful/__init__.py", line 269, in error_router return original_handler(e) File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1866, in handle_exception reraise(exc_type, exc_value, tb) File "/usr/local/lib/python3.6/site-packages/flask/_compat.py", line 38, in reraise raise value.with_traceback(tb) File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2446, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1951, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/local/lib/python3.6/site-packages/flask_restful/__init__.py", line 269, in error_router return original_handler(e) File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1820, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/local/lib/python3.6/site-packages/flask/_compat.py", line 38, in reraise raise value.with_traceback(tb) File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1949, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1935, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/usr/local/lib/python3.6/site-packages/flask_restful/__init__.py", line 458, in wrapper resp = resource(*args, **kwargs) File "/usr/local/lib/python3.6/site-packages/flask/views.py", line 89, in view return self.dispatch_request(*args, **kwargs) File "/usr/local/lib/python3.6/site-packages/flask_restful/__init__.py", line 573, in dispatch_request resp = meth(*args, **kwargs) File "/usr/local/lib/python3.6/site-packages/flask_jwt_extended/view_decorators.py", line 108, in wrapper return fn(*args, **kwargs) File "/root/mlapi/api.py", line 125, in post detections = m.detect(image) File "/root/mlapi/modules/face_recognition.py", line 68, in detect face_locations = face_recognition.face_locations(rgb_image, model=self.model, number_of_times_to_upsample=self.upsample_times) File "/usr/local/lib/python3.6/site-packages/face_recognition/api.py", line 116, in face_locations return [_trim_css_to_bounds(_rect_to_css(face.rect), img.shape) for face in _raw_face_locations(img, number_of_times_to_upsample, "cnn")] File "/usr/local/lib/python3.6/site-packages/face_recognition/api.py", line 100, in _raw_face_locations return cnn_face_detector(img, number_of_times_to_upsample) RuntimeError: Error while calling cudaGetDevice(&the_device_id) in file /tmp/pip-install-28f7zm6b/dlib/dlib/cuda/gpu_data.cpp:201. code: 3, reason: initialization error
Works with local detection. I'll be happy to provide whatever debug is neccesary.Mvh.
Torkil