ZoneMinder / mlapi

An easy to use/extend object recognition API you can locally install. Python+Flask. Also works with ZMES!
Other
58 stars 34 forks source link

No images written, neither in zoneminder dir nor bbox debug #4

Closed plysdyret closed 4 years ago

plysdyret commented 4 years ago

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

pliablepixels commented 4 years ago

Fixed via https://github.com/pliablepixels/zmeventnotification/commit/a8d51e8222360221f2b12027ba5fa3ed45dad9e3