ZoneMinder / mlapi

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

mlapi crash on #37

Closed mfauvain closed 3 years ago

mfauvain commented 3 years ago

mlapi crashes with shapely/speedups/_speedups.pyx when running an event (not all of them do crash) I have:

This model iteration inside object found: labels: ['person'],conf:[0.9985199570655823]
Mar 03 2021 18:02:23.172784 [DBG 3] intersection: comparing object:person,POLYGON ((389 30, 513 30, 513 238, 389 238, 389 30)) to polygon:smaller_m7,POLYGON ((0 476, 54 455, 623 240, 604 453, 0 476))
Traceback (most recent call last):
  File "shapely/speedups/_speedups.pyx", line 247, in shapely.speedups._speedups.geos_linearring_from_py
AttributeError: 'list' object has no attribute '__array_interface__'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/flask/app.py", line 2464, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/lib/python3.9/site-packages/flask/app.py", line 2450, in wsgi_app
    response = self.handle_exception(e)
  File "/usr/lib/python3.9/site-packages/flask_restful/__init__.py", line 272, in error_router
    return original_handler(e)
  File "/usr/lib/python3.9/site-packages/flask/app.py", line 1867, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib/python3.9/site-packages/flask/_compat.py", line 38, in reraise
    raise value.with_traceback(tb)
  File "/usr/lib/python3.9/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/lib/python3.9/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/lib/python3.9/site-packages/flask_restful/__init__.py", line 272, in error_router
    return original_handler(e)
  File "/usr/lib/python3.9/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib/python3.9/site-packages/flask/_compat.py", line 38, in reraise
    raise value.with_traceback(tb)
  File "/usr/lib/python3.9/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/lib/python3.9/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/lib/python3.9/site-packages/flask_restful/__init__.py", line 468, in wrapper
    resp = resource(*args, **kwargs)
  File "/usr/lib/python3.9/site-packages/flask/views.py", line 89, in view
    return self.dispatch_request(*args, **kwargs)
  File "/usr/lib/python3.9/site-packages/flask_restful/__init__.py", line 583, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/usr/lib/python3.9/site-packages/flask_jwt_extended/view_decorators.py", line 108, in wrapper
    return fn(*args, **kwargs)
  File "/home/x/.mlapi/mlapi.py", line 228, in post
    matched_data,all_matches = m.detect_stream(stream=stream, options=stream_options, ml_overrides=ml_overrides)
  File "/usr/lib/python3.9/site-packages/pyzm/ml/detect_sequence.py", line 466, in detect_stream
    _b,_l,_c, _e = self._filter_patterns(seq,_b,_l,_c, polygons)
  File "/usr/lib/python3.9/site-packages/pyzm/ml/detect_sequence.py", line 263, in _filter_patterns
    poly = Polygon(p['value'])
  File "/usr/lib/python3.9/site-packages/shapely/geometry/polygon.py", line 243, in __init__
    ret = geos_polygon_from_py(shell, holes)
  File "/usr/lib/python3.9/site-packages/shapely/geometry/polygon.py", line 509, in geos_polygon_from_py
    ret = geos_linearring_from_py(shell)
  File "shapely/speedups/_speedups.pyx", line 341, in shapely.speedups._speedups.geos_linearring_from_py
ValueError: A LinearRing must have at least 3 coordinate tuples

when running the same event on ES server directly I have :

zmesdetect_m7[56308] DBG4 detect_sequence.py:437 [This model iteration inside object found: labels: ['person'],conf:[0.9997007250785828]]
03/03/21 17:59:15 zmesdetect_m7[56308] DBG3 detect_sequence.py:240 [intersection: comparing object:person,POLYGON ((114 142, 258 142, 258 344, 114 344, 114 142)) to polygon:all,POLYGON ((0 476, 1 216, 636 23, 604 453, 0 476))]
03/03/21 17:59:15 zmesdetect_m7[56308] DBG3 detect_sequence.py:244 [all polygon/zone has its own pattern of (bicycle|motorbike), using that]
03/03/21 17:59:15 zmesdetect_m7[56308] DBG3 detect_sequence.py:273 [all intersects object:person[[(114, 142), (258, 142), (258, 344), (114, 344)]] but does NOT match your detect pattern filter]
03/03/21 17:59:15 zmesdetect_m7[56308] DBG2 detect_sequence.py:482 [We did not find any object matches in frame: snapshot]
03/03/21 17:59:15 zmesdetect_m7[56308] DBG2 yolo.py:63 [pyzm_uid33_cpu_lock portalock already released]
03/03/21 17:59:15 zmesdetect_m7[56308] DBG1 detect_sequence.py:526 [perf: TOTAL detection sequence (with image loads) took: 0:00:03.229984  to process 644885]

not sure where to start..

EDIT : looking closer, it seems mlapi does not take the right zone into account. ES server checks (correctly) the detected object vs 'all' zone, whereas mlapi checks vs 'smaller_m7' zone.

the monitor is defined as below:

[monitor-7]
resize=no
match_past_detections=no
detection_sequence=object
smaller_m7=0,476 54,455 623,240 604,453
smaller_m7_zone_detection_pattern=(person|bear|dog|cat)
all_zone_detection_pattern=(bicycle|motorbike)
wait=2
pliablepixels commented 3 years ago
  1. Please post exact [monitor-7] definition from objectconfig.ini
  2. Please post exact [monitor-7] definition from mlapiconfig.ini
  3. Run mlapi with --debug and please post the output of when it starts
mfauvain commented 3 years ago

Sure

  1. objectconfig.ini

    [monitor-7]
    resize=no
    match_past_detections=no
    detection_sequence=object
    smaller_m7=0,476 54,455 623,240 604,453
    smaller_m7_zone_detection_pattern=(person|bear|dog|cat)
    all_zone_detection_pattern=(bicycle|motorbike)
    wait=2
  2. mlapiconfig.ini

    [monitor-7]
    resize=no
    match_past_detections=no
    detection_sequence=object
    smaller_m7=0,476 54,455 623,240 604,453
    smaller_m7_zone_detection_pattern=(person|bear|dog|cat)
    all_zone_detection_pattern=(bicycle|motorbike)
    wait=2
  3. 
    python3 /home/x/.mlapi/mlapi.py -c mlapiconfig.ini --debug
    Mar 04 2021 14:41:19.224543 [ERR] Not able to switch to ZM logs: 'ZM_PATH_LOGS'
    Mar 04 2021 14:41:19.224598 [DBG 1] secret filename: ./secrets.ini
    Mar 04 2021 14:41:19.225048 [DBG 1] Secret token found in config: !MLAPI_SECRET_KEY
    Mar 04 2021 14:41:19.225271 [DBG 1] Secret token found in config: !PLATEREC_ALPR_KEY
    Mar 04 2021 14:41:19.225327 [DBG 2] Found monitor specific section for monitor: 5
    Mar 04 2021 14:41:19.225363 [DBG 4] ml sequence not found in globals
    Mar 04 2021 14:41:19.225385 [DBG 4] stream sequence not found in globals
    Mar 04 2021 14:41:19.225433 [DBG 4] [monitor-5] overrides key:resize with value:no
    Mar 04 2021 14:41:19.225463 [DBG 4] [monitor-5] overrides key:detection_sequence with value:object
    Mar 04 2021 14:41:19.225549 [DBG 2] adding polygon: smaller_m5 [170,389 636,244 636,345 153,425]
    Mar 04 2021 14:41:19.225587 [DBG 2] found zone specific pattern:smaller_m5 storing
    Mar 04 2021 14:41:19.225608 [DBG 2] found zone specific pattern:all storing
    Mar 04 2021 14:41:19.225641 [DBG 2] adding polygon: wait [2]
    Mar 04 2021 14:41:19.225680 [DBG 2] replacing match pattern for polygon:smaller_m5 with: (person|bear|dog|cat|car|bicycle|motorbike|truck)
    Mar 04 2021 14:41:19.225707 [DBG 2] Found monitor specific section for monitor: 6
    Mar 04 2021 14:41:19.225760 [DBG 4] ml sequence not found in globals
    Mar 04 2021 14:41:19.225806 [DBG 4] stream sequence not found in globals
    Mar 04 2021 14:41:19.225853 [DBG 4] [monitor-6] overrides key:resize with value:no
    Mar 04 2021 14:41:19.225914 [DBG 4] [monitor-6] overrides key:detection_sequence with value:object
    Mar 04 2021 14:41:19.225969 [DBG 2] found zone specific pattern:all storing
    Mar 04 2021 14:41:19.226010 [DBG 2] adding polygon: wait [2]
    Mar 04 2021 14:41:19.226034 [DBG 2] Found monitor specific section for monitor: 7
    Mar 04 2021 14:41:19.226066 [DBG 4] ml sequence not found in globals
    Mar 04 2021 14:41:19.226093 [DBG 4] stream sequence not found in globals
    Mar 04 2021 14:41:19.226134 [DBG 4] [monitor-7] overrides key:resize with value:no
    Mar 04 2021 14:41:19.226200 [DBG 4] [monitor-7] overrides key:detection_sequence with value:object
    Mar 04 2021 14:41:19.226303 [DBG 2] adding polygon: smaller_m7 [0,476 54,455 623,240 604,453]
    Mar 04 2021 14:41:19.226340 [DBG 2] found zone specific pattern:smaller_m7 storing
    Mar 04 2021 14:41:19.226375 [DBG 2] found zone specific pattern:all storing
    Mar 04 2021 14:41:19.226407 [DBG 2] adding polygon: wait [2]
    Mar 04 2021 14:41:19.226477 [DBG 2] replacing match pattern for polygon:smaller_m7 with: (person|bear|dog|cat)
    Mar 04 2021 14:41:19.226522 [DBG 2] Found monitor specific section for monitor: 10
    Mar 04 2021 14:41:19.226559 [DBG 4] ml sequence not found in globals
    Mar 04 2021 14:41:19.226607 [DBG 4] stream sequence not found in globals
    Mar 04 2021 14:41:19.226643 [DBG 4] [monitor-10] overrides key:resize with value:no
    Mar 04 2021 14:41:19.226692 [DBG 4] [monitor-10] overrides key:detection_sequence with value:object
    Mar 04 2021 14:41:19.226778 [DBG 2] adding polygon: smaller_m10 [535,64 597,57 543,474 362,476]
    Mar 04 2021 14:41:19.226800 [DBG 2] found zone specific pattern:smaller_m10 storing
    Mar 04 2021 14:41:19.226816 [DBG 2] found zone specific pattern:all storing
    Mar 04 2021 14:41:19.226846 [DBG 2] adding polygon: wait [2]
    Mar 04 2021 14:41:19.226862 [DBG 2] replacing match pattern for polygon:smaller_m10 with: (person|bear|dog|cat|car|bicycle|motorbike|truck)
    Mar 04 2021 14:41:19.226880 [DBG 2] Found monitor specific section for monitor: 11
    Mar 04 2021 14:41:19.226903 [DBG 4] ml sequence not found in globals
    Mar 04 2021 14:41:19.226926 [DBG 4] stream sequence not found in globals
    Mar 04 2021 14:41:19.226959 [DBG 4] [monitor-11] overrides key:resize with value:no
    Mar 04 2021 14:41:19.226998 [DBG 4] [monitor-11] overrides key:detection_sequence with value:object
    Mar 04 2021 14:41:19.227021 [DBG 2] found zone specific pattern:all storing
    Mar 04 2021 14:41:19.227056 [DBG 2] adding polygon: wait [2]
    Mar 04 2021 14:41:19.227076 [DBG 2] Found monitor specific section for monitor: 12
    Mar 04 2021 14:41:19.227116 [DBG 4] ml sequence not found in globals
    Mar 04 2021 14:41:19.227146 [DBG 4] stream sequence not found in globals
    Mar 04 2021 14:41:19.227174 [DBG 4] [monitor-12] overrides key:resize with value:no
    Mar 04 2021 14:41:19.227218 [DBG 4] [monitor-12] overrides key:detection_sequence with value:object
    Mar 04 2021 14:41:19.227242 [DBG 2] found zone specific pattern:all storing
    Mar 04 2021 14:41:19.227278 [DBG 2] adding polygon: wait [2]
    Mar 04 2021 14:41:19.227297 [DBG 2] Found monitor specific section for monitor: 13
    Mar 04 2021 14:41:19.227330 [DBG 4] ml sequence not found in globals
    Mar 04 2021 14:41:19.227351 [DBG 4] stream sequence not found in globals
    Mar 04 2021 14:41:19.227382 [DBG 4] [monitor-13] overrides key:resize with value:no
    Mar 04 2021 14:41:19.227418 [DBG 4] [monitor-13] overrides key:detection_sequence with value:object
    Mar 04 2021 14:41:19.227441 [DBG 2] found zone specific pattern:all storing
    Mar 04 2021 14:41:19.227475 [DBG 2] adding polygon: wait [2]
    Mar 04 2021 14:41:19.227495 [DBG 2] Found monitor specific section for monitor: 14
    Mar 04 2021 14:41:19.227526 [DBG 4] ml sequence not found in globals
    Mar 04 2021 14:41:19.227549 [DBG 4] stream sequence not found in globals
    Mar 04 2021 14:41:19.227587 [DBG 4] [monitor-14] overrides key:resize with value:no
    Mar 04 2021 14:41:19.227647 [DBG 4] [monitor-14] overrides key:detection_sequence with value:object
    Mar 04 2021 14:41:19.227675 [DBG 2] found zone specific pattern:all storing
    Mar 04 2021 14:41:19.227695 [DBG 2] adding polygon: wait [2]
    Mar 04 2021 14:41:19.227709 [DBG 2] Found monitor specific section for monitor: 15
    Mar 04 2021 14:41:19.227731 [DBG 4] ml sequence not found in globals
    Mar 04 2021 14:41:19.227748 [DBG 4] stream sequence not found in globals
    Mar 04 2021 14:41:19.227786 [DBG 4] [monitor-15] overrides key:resize with value:no
    Mar 04 2021 14:41:19.227812 [DBG 4] [monitor-15] overrides key:detection_sequence with value:object
    Mar 04 2021 14:41:19.227833 [DBG 2] found zone specific pattern:all storing
    Mar 04 2021 14:41:19.227851 [DBG 2] adding polygon: wait [2]
    Mar 04 2021 14:41:19.227901 [DBG 4] Doing parameter substitution for globals
    Mar 04 2021 14:41:19.228154 [DBG 4] Doing parameter substitution for monitor specific entities
    Mar 04 2021 14:41:19.232288 [DBG 1] Opening DB at ./db/db.json
    Mar 04 2021 14:41:19.232428 [DBG 1] DB engine ready
    Mar 04 2021 14:41:19.234888 [DBG 2] API SSL certificate check has been disbled
    Mar 04 2021 14:41:19.234938 [DBG 1] using username/password for login
    Mar 04 2021 14:41:19.349153 [DBG 2] Using new token API
    Mar 04 2021 14:41:19.349315 [DBG 1] Access token expires on:2021-03-04 16:41:19.349268 [7200s]
    Mar 04 2021 14:41:19.349400 [DBG 1] Refresh token expires on:2021-03-05 14:41:19.349371 [86400s]
    Mar 04 2021 14:41:19.349494 [DBG 3] No need to relogin as access token still has 119.99999695 minutes remaining
    Mar 04 2021 14:41:19.349594 [DBG 4] make_request called with url=http://192.168.1.189:8095/api/host/gettimezone.json payload={} type=get query={'token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJab25lTWluZGVyIiwiaWF0IjoxNjE0ODkwNDc5LCJleHAiOjE2MTQ4OTc2NzksInVzZXIiOiJhZG1pbiIsInR5cGUiOiJhY2Nlc3MifQ.YrkSXiB9zlPljlmkCxitd2T76fi7ofEze4ZPXBok_u8'}
    Mar 04 2021 14:41:19.399344 [DBG 2] mapping legacy ml data from config
    Mar 04 2021 14:41:19.399492 [DBG 3] Changing detection_mode from all to most_models to adapt to new features
    Mar 04 2021 14:41:19.399589 [DBG 1] Resetting models, will be loaded on next run
    Mar 04 2021 14:41:19.399663 [INF] --------| mlapi version:2.2.4, pyzm version:0.3.35 |--------
    Mar 04 2021 14:41:19.399720 [INF] Using bjoern as WSGI server
    Mar 04 2021 14:41:26.266578 [DBG 1] Monitor ID 7 provided & matching config found in mlapi, ignoring objectconfig.ini
    Mar 04 2021 14:41:26.266719 [DBG 4] Overriding global resize with no
    Mar 04 2021 14:41:26.266789 [DBG 4] Overriding global match_past_detections with no
    Mar 04 2021 14:41:26.266848 [DBG 4] Overriding global detection_sequence with ['object']
    Mar 04 2021 14:41:26.266893 [DBG 2] mapping legacy ml data from config
    Mar 04 2021 14:41:26.266965 [DBG 4] Overwriting ml_sequence of pre loaded model
    Mar 04 2021 14:41:26.267027 [DBG 1] Object Recognition requested
    Mar 04 2021 14:41:26.267185 [DBG 1] Calling detect streams with 644885 and {'resize': None, 'strategy': 'first', 'frame_set': 'alarm,snapshot', 'disable_ssl_cert_check': True, 'api': <pyzm.api.ZMApi object at 0x7f2677524160>, 'polygons': [{'name': 'smaller_m7', 'value': [(0, 476), (54, 455), (623, 240), (604, 453)], 'pattern': '(person|bear|dog|cat)'}, {'name': 'wait', 'value': [(2,)], 'pattern': None}], 'monitorid': '7'} and ml_overrides={} ml_options={'object': {'general': {'pattern': '.*', 'disable_locks': 'no', 'same_model_sequence_strategy': 'first'}, 'sequence': [{'tpu_max_processes': 1, 'tpu_max_lock_wait': 120, 'gpu_max_processes': 1, 'gpu_max_lock_wait': 120, 'cpu_max_processes': 4, 'cpu_max_lock_wait': 120, 'max_detection_size': '90%', 'object_config': 'models/yolov3/yolov3.cfg', 'object_weights': 'models/yolov3/yolov3.weights', 'object_labels': 'models/yolov3/coco.names', 'object_min_confidence': 0.3, 'object_framework': 'opencv', 'object_processor': 'cpu'}]}, 'general': {'model_sequence': 'object'}}
    Mar 04 2021 14:41:26.267268 [DBG 3] Using manual locking as we are only using one model
    Mar 04 2021 14:41:26.267594 [DBG 2] Media get SSL certificate check has been disbled
    Mar 04 2021 14:41:26.267784 [DBG 2] Using URL 644885 for stream
    Mar 04 2021 14:41:26.267874 [DBG 2] We will only process frames: ['alarm', 'snapshot']
    Mar 04 2021 14:41:26.267923 [DBG 2] No need to start streams, we are picking images from http://192.168.1.189:8095/index.php?view=image&eid=644885
    Mar 04 2021 14:41:26.267986 [DBG 3] Reading http://192.168.1.189:8095/index.php?view=image&eid=644885&fid=alarm
    Mar 04 2021 14:41:26.268058 [DBG 3] No need to relogin as access token still has 119.88468721666666 minutes remaining
    Mar 04 2021 14:41:26.268162 [DBG 4] make_request called with url=http://192.168.1.189:8095/index.php?view=image&eid=644885&fid=alarm payload={} type=get query={'token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJab25lTWluZGVyIiwiaWF0IjoxNjE0ODkwNDc5LCJleHAiOjE2MTQ4OTc2NzksInVzZXIiOiJhZG1pbiIsInR5cGUiOiJhY2Nlc3MifQ.YrkSXiB9zlPljlmkCxitd2T76fi7ofEze4ZPXBok_u8'}
    Mar 04 2021 14:41:26.307280 [DBG 1] perf: Starting for frame:alarm
    Mar 04 2021 14:41:26.307408 [DBG 1] ============ Frame: alarm Running object model in sequence ==================
    Mar 04 2021 14:41:26.307491 [DBG 3] load_models (just init, actual load happens at first detect): ['object']
    Mar 04 2021 14:41:26.308392 [DBG 2] Initializing model  type:object with options:{'tpu_max_processes': 1, 'tpu_max_lock_wait': 120, 'gpu_max_processes': 1, 'gpu_max_lock_wait': 120, 'cpu_max_processes': 4, 'cpu_max_lock_wait': 120, 'max_detection_size': '90%', 'object_config': 'models/yolov3/yolov3.cfg', 'object_weights': 'models/yolov3/yolov3.weights', 'object_labels': 'models/yolov3/coco.names', 'object_min_confidence': 0.3, 'object_framework': 'opencv', 'object_processor': 'cpu', 'disable_locks': 'no'}
    Mar 04 2021 14:41:26.317025 [DBG 2] portalock: max:4, name:pyzm_uid1000_cpu_lock, timeout:120
    Mar 04 2021 14:41:26.317150 [DBG 2] Waiting for pyzm_uid1000_cpu_lock portalock...
    filenames [PosixPath('/tmp/pyzm_uid1000_cpu_lock.00.lock'), PosixPath('/tmp/pyzm_uid1000_cpu_lock.01.lock'), PosixPath('/tmp/pyzm_uid1000_cpu_lock.02.lock'), PosixPath('/tmp/pyzm_uid1000_cpu_lock.03.lock')]
    trying lock [PosixPath('/tmp/pyzm_uid1000_cpu_lock.00.lock'), PosixPath('/tmp/pyzm_uid1000_cpu_lock.01.lock'), PosixPath('/tmp/pyzm_uid1000_cpu_lock.02.lock'), PosixPath('/tmp/pyzm_uid1000_cpu_lock.03.lock')]
    trying lock for /tmp/pyzm_uid1000_cpu_lock.00.lock
    locked /tmp/pyzm_uid1000_cpu_lock.00.lock
    Mar 04 2021 14:41:26.317718 [DBG 2] Got pyzm_uid1000_cpu_lock portalock
    Mar 04 2021 14:41:26.317777 [DBG 3] object has a same_model_sequence strategy of first
    Mar 04 2021 14:41:26.317804 [DBG 3] --------- Frame:alarm Running variation: #1 -------------
    Mar 04 2021 14:41:26.317835 [DBG 2] pyzm_uid1000_cpu_lock portalock already acquired
    Mar 04 2021 14:41:26.317856 [DBG 1] |--------- Loading Yolo model from disk ---------|
    Mar 04 2021 14:41:26.427373 [DBG 1] perf: processor:cpu Yolo initialization (loading models/yolov3/yolov3.weights model from disk) took: 109.47 ms
    Mar 04 2021 14:41:26.427518 [DBG 1] Using CPU for detection
    Mar 04 2021 14:41:26.427687 [DBG 1] |---------- YOLO (input image: 640w*480h, model resize dimensions: 416w*416h) ----------|
    Mar 04 2021 14:41:27.325717 [DBG 2] Released pyzm_uid1000_cpu_lock portalock
    Mar 04 2021 14:41:27.325792 [DBG 1] perf: processor:cpu Yolo detection took: 898.07 ms
    Mar 04 2021 14:41:27.461077 [DBG 2] perf: processor:cpu Yolo NMS filtering took: 1.13 ms
    Mar 04 2021 14:41:27.462007 [DBG 3] core model detection over, got 1 objects. Now filtering
    Mar 04 2021 14:41:27.462039 [DBG 3] Max object size found to be: 90%
    Mar 04 2021 14:41:27.462324 [DBG 2] Converted 90% to 276480.0
    Mar 04 2021 14:41:27.462378 [DBG 2] Returning filtered list of 1 objects.
    Mar 04 2021 14:41:27.462410 [DBG 4] This model iteration inside object found: labels: ['person'],conf:[0.9985199570655823]
    Mar 04 2021 14:41:27.462745 [DBG 3] intersection: comparing object:person,POLYGON ((389 30, 513 30, 513 238, 389 238, 389 30)) to polygon:smaller_m7,POLYGON ((0 476, 54 455, 623 240, 604 453, 0 476))
    Traceback (most recent call last):
    File "shapely/speedups/_speedups.pyx", line 247, in shapely.speedups._speedups.geos_linearring_from_py
    AttributeError: 'list' object has no attribute '__array_interface__'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/flask/app.py", line 2464, in call return self.wsgi_app(environ, start_response) File "/usr/lib/python3.9/site-packages/flask/app.py", line 2450, in wsgi_app response = self.handle_exception(e) File "/usr/lib/python3.9/site-packages/flask_restful/init.py", line 272, in error_router return original_handler(e) File "/usr/lib/python3.9/site-packages/flask/app.py", line 1867, in handle_exception reraise(exc_type, exc_value, tb) File "/usr/lib/python3.9/site-packages/flask/_compat.py", line 38, in reraise raise value.with_traceback(tb) File "/usr/lib/python3.9/site-packages/flask/app.py", line 2447, in wsgi_app response = self.full_dispatch_request() File "/usr/lib/python3.9/site-packages/flask/app.py", line 1952, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/lib/python3.9/site-packages/flask_restful/init.py", line 272, in error_router return original_handler(e) File "/usr/lib/python3.9/site-packages/flask/app.py", line 1821, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/lib/python3.9/site-packages/flask/_compat.py", line 38, in reraise raise value.with_traceback(tb) File "/usr/lib/python3.9/site-packages/flask/app.py", line 1950, in full_dispatch_request rv = self.dispatch_request() File "/usr/lib/python3.9/site-packages/flask/app.py", line 1936, in dispatch_request return self.view_functionsrule.endpoint File "/usr/lib/python3.9/site-packages/flask_restful/init.py", line 468, in wrapper resp = resource(*args, kwargs) File "/usr/lib/python3.9/site-packages/flask/views.py", line 89, in view return self.dispatch_request(*args, *kwargs) File "/usr/lib/python3.9/site-packages/flask_restful/init.py", line 583, in dispatch_request resp = meth(args, kwargs) File "/usr/lib/python3.9/site-packages/flask_jwt_extended/view_decorators.py", line 108, in wrapper return fn(*args, **kwargs) File "/home/x/.mlapi/mlapi.py", line 228, in post matched_data,all_matches = m.detect_stream(stream=stream, options=stream_options, ml_overrides=ml_overrides) File "/usr/lib/python3.9/site-packages/pyzm/ml/detect_sequence.py", line 466, in detect_stream _b,_l,_c, _e = self._filter_patterns(seq,_b,_l,_c, polygons) File "/usr/lib/python3.9/site-packages/pyzm/ml/detect_sequence.py", line 263, in _filter_patterns poly = Polygon(p['value']) File "/usr/lib/python3.9/site-packages/shapely/geometry/polygon.py", line 243, in init ret = geos_polygon_from_py(shell, holes) File "/usr/lib/python3.9/site-packages/shapely/geometry/polygon.py", line 509, in geos_polygon_from_py ret = geos_linearring_from_py(shell) File "shapely/speedups/_speedups.pyx", line 341, in shapely.speedups._speedups.geos_linearring_from_py ValueError: A LinearRing must have at least 3 coordinate tuples

pliablepixels commented 3 years ago

One of the issues is you have a wait that was being interpreted as a polygon. I've fixed that in master (Also mlapi ignores wait. I've added a delay parameter to stream_sequence which I haven't published yet, but you don't need wait anymore. Look at sleep_between_attempts and max retries in pyzm docs.

However, you also said

EDIT : looking closer, it seems mlapi does not take the right zone into account. ES server checks (correctly) the detected object vs 'all' zone, whereas mlapi checks vs 'smaller_m7' zone.

Both ES and mlapi should be checking the object against all polygons. It will stop when any intersection is found.

mfauvain commented 3 years ago

thx, removing wait=2 fixes the crash. Still, it seems mlapi does not go thru the all zone, only the smaller_m7:

/home/x/.mlapi/mlapi.py -c mlapiconfig.ini --debug
Mar 05 2021 14:14:55.447334 [ERR] Not able to switch to ZM logs: 'ZM_PATH_LOGS'
Mar 05 2021 14:14:55.447396 [DBG 1] secret filename: ./secrets.ini
Mar 05 2021 14:14:55.447810 [DBG 1] Secret token found in config: !MLAPI_SECRET_KEY
Mar 05 2021 14:14:55.448030 [DBG 1] Secret token found in config: !PLATEREC_ALPR_KEY
Mar 05 2021 14:14:55.448107 [DBG 2] Found monitor specific section for monitor: 5
Mar 05 2021 14:14:55.448148 [DBG 4] ml sequence not found in globals
Mar 05 2021 14:14:55.448184 [DBG 4] stream sequence not found in globals
Mar 05 2021 14:14:55.448239 [DBG 4] [monitor-5] overrides key:resize with value:no
Mar 05 2021 14:14:55.448281 [DBG 4] [monitor-5] overrides key:detection_sequence with value:object
Mar 05 2021 14:14:55.448352 [DBG 2] adding polygon: smaller_m5 [170,389 636,244 636,345 153,425]
Mar 05 2021 14:14:55.448380 [DBG 2] found zone specific pattern:smaller_m5 storing
Mar 05 2021 14:14:55.448413 [DBG 2] found zone specific pattern:all storing
Mar 05 2021 14:14:55.448435 [DBG 2] replacing match pattern for polygon:smaller_m5 with: (person|bear|dog|cat|car|bicycle|motorbike|truck)
Mar 05 2021 14:14:55.448461 [DBG 2] Found monitor specific section for monitor: 6
Mar 05 2021 14:14:55.448502 [DBG 4] ml sequence not found in globals
Mar 05 2021 14:14:55.448536 [DBG 4] stream sequence not found in globals
Mar 05 2021 14:14:55.448575 [DBG 4] [monitor-6] overrides key:resize with value:no
Mar 05 2021 14:14:55.448616 [DBG 4] [monitor-6] overrides key:detection_sequence with value:object
Mar 05 2021 14:14:55.448664 [DBG 2] found zone specific pattern:all storing
Mar 05 2021 14:14:55.448684 [DBG 2] Found monitor specific section for monitor: 7
Mar 05 2021 14:14:55.448713 [DBG 4] ml sequence not found in globals
Mar 05 2021 14:14:55.448746 [DBG 4] stream sequence not found in globals
Mar 05 2021 14:14:55.448783 [DBG 4] [monitor-7] overrides key:resize with value:no
Mar 05 2021 14:14:55.448829 [DBG 4] [monitor-7] overrides key:detection_sequence with value:object
Mar 05 2021 14:14:55.448872 [DBG 2] adding polygon: smaller_m7 [0,476 54,455 623,240 604,453]
Mar 05 2021 14:14:55.448901 [DBG 2] found zone specific pattern:smaller_m7 storing
Mar 05 2021 14:14:55.448929 [DBG 2] found zone specific pattern:all storing
Mar 05 2021 14:14:55.448954 [DBG 2] replacing match pattern for polygon:smaller_m7 with: (person|bear|dog|cat)
Mar 05 2021 14:14:55.448978 [DBG 2] Found monitor specific section for monitor: 10
Mar 05 2021 14:14:55.449007 [DBG 4] ml sequence not found in globals
Mar 05 2021 14:14:55.449031 [DBG 4] stream sequence not found in globals
Mar 05 2021 14:14:55.449069 [DBG 4] [monitor-10] overrides key:resize with value:no
Mar 05 2021 14:14:55.449095 [DBG 4] [monitor-10] overrides key:detection_sequence with value:object
Mar 05 2021 14:14:55.449149 [DBG 2] adding polygon: smaller_m10 [535,64 597,57 543,474 362,476]
Mar 05 2021 14:14:55.449176 [DBG 2] found zone specific pattern:smaller_m10 storing
Mar 05 2021 14:14:55.449207 [DBG 2] found zone specific pattern:all storing
Mar 05 2021 14:14:55.449230 [DBG 2] replacing match pattern for polygon:smaller_m10 with: (person|bear|dog|cat|car|bicycle|motorbike|truck)
Mar 05 2021 14:14:55.449254 [DBG 2] Found monitor specific section for monitor: 11
Mar 05 2021 14:14:55.449297 [DBG 4] ml sequence not found in globals
Mar 05 2021 14:14:55.449328 [DBG 4] stream sequence not found in globals
Mar 05 2021 14:14:55.449367 [DBG 4] [monitor-11] overrides key:resize with value:no
Mar 05 2021 14:14:55.449412 [DBG 4] [monitor-11] overrides key:detection_sequence with value:object
Mar 05 2021 14:14:55.449440 [DBG 2] found zone specific pattern:all storing
Mar 05 2021 14:14:55.449467 [DBG 2] Found monitor specific section for monitor: 12
Mar 05 2021 14:14:55.449499 [DBG 4] ml sequence not found in globals
Mar 05 2021 14:14:55.449530 [DBG 4] stream sequence not found in globals
Mar 05 2021 14:14:55.449567 [DBG 4] [monitor-12] overrides key:resize with value:no
Mar 05 2021 14:14:55.449611 [DBG 4] [monitor-12] overrides key:detection_sequence with value:object
Mar 05 2021 14:14:55.449639 [DBG 2] found zone specific pattern:all storing
Mar 05 2021 14:14:55.449662 [DBG 2] Found monitor specific section for monitor: 13
Mar 05 2021 14:14:55.449692 [DBG 4] ml sequence not found in globals
Mar 05 2021 14:14:55.449718 [DBG 4] stream sequence not found in globals
Mar 05 2021 14:14:55.449764 [DBG 4] [monitor-13] overrides key:resize with value:no
Mar 05 2021 14:14:55.449811 [DBG 4] [monitor-13] overrides key:detection_sequence with value:object
Mar 05 2021 14:14:55.449840 [DBG 2] found zone specific pattern:all storing
Mar 05 2021 14:14:55.449865 [DBG 2] Found monitor specific section for monitor: 14
Mar 05 2021 14:14:55.449897 [DBG 4] ml sequence not found in globals
Mar 05 2021 14:14:55.449928 [DBG 4] stream sequence not found in globals
Mar 05 2021 14:14:55.449966 [DBG 4] [monitor-14] overrides key:resize with value:no
Mar 05 2021 14:14:55.450007 [DBG 4] [monitor-14] overrides key:detection_sequence with value:object
Mar 05 2021 14:14:55.450043 [DBG 2] found zone specific pattern:all storing
Mar 05 2021 14:14:55.450076 [DBG 2] Found monitor specific section for monitor: 15
Mar 05 2021 14:14:55.450114 [DBG 4] ml sequence not found in globals
Mar 05 2021 14:14:55.450158 [DBG 4] stream sequence not found in globals
Mar 05 2021 14:14:55.450200 [DBG 4] [monitor-15] overrides key:resize with value:no
Mar 05 2021 14:14:55.450250 [DBG 4] [monitor-15] overrides key:detection_sequence with value:object
Mar 05 2021 14:14:55.450289 [DBG 2] found zone specific pattern:all storing
Mar 05 2021 14:14:55.450344 [DBG 4] Doing parameter substitution for globals
Mar 05 2021 14:14:55.450591 [DBG 4] Doing parameter substitution for monitor specific entities
Mar 05 2021 14:14:55.454431 [DBG 1] Opening DB at ./db/db.json
Mar 05 2021 14:14:55.454596 [DBG 1] DB engine ready
Mar 05 2021 14:14:55.456976 [DBG 2] API SSL certificate check has been disbled
Mar 05 2021 14:14:55.457028 [DBG 1] using username/password for login
Mar 05 2021 14:14:55.567326 [DBG 2] Using new token API
Mar 05 2021 14:14:55.567487 [DBG 1] Access token expires on:2021-03-05 16:14:55.567447 [7200s]
Mar 05 2021 14:14:55.567624 [DBG 1] Refresh token expires on:2021-03-06 14:14:55.567578 [86400s]
Mar 05 2021 14:14:55.567738 [DBG 3] No need to relogin as access token still has 119.99999565 minutes remaining
Mar 05 2021 14:14:55.567863 [DBG 4] make_request called with url=http://192.168.1.189:8095/api/host/gettimezone.json payload={} type=get query={'token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJab25lTWluZGVyIiwiaWF0IjoxNjE0OTc1Mjk1LCJleHAiOjE2MTQ5ODI0OTUsInVzZXIiOiJhZG1pbiIsInR5cGUiOiJhY2Nlc3MifQ.s3EzgDwP4YrHwO9mZielwGAUBLyJjtpF4Z9pbMrD7V8'}
Mar 05 2021 14:14:55.603104 [DBG 2] mapping legacy ml data from config
Mar 05 2021 14:14:55.603327 [DBG 3] Changing detection_mode from all to most_models to adapt to new features
Mar 05 2021 14:14:55.603475 [DBG 1] Resetting models, will be loaded on next run
Mar 05 2021 14:14:55.603613 [INF] --------| mlapi version:2.2.4, pyzm version:0.3.35 |--------
Mar 05 2021 14:14:55.603731 [INF] Using bjoern as WSGI server
Mar 05 2021 14:15:04.650307 [DBG 1] Monitor ID 7 provided & matching config found in mlapi, ignoring objectconfig.ini
Mar 05 2021 14:15:04.650457 [DBG 4] Overriding global resize with no
Mar 05 2021 14:15:04.650533 [DBG 4] Overriding global match_past_detections with no
Mar 05 2021 14:15:04.650596 [DBG 4] Overriding global detection_sequence with ['object']
Mar 05 2021 14:15:04.650648 [DBG 2] mapping legacy ml data from config
Mar 05 2021 14:15:04.650728 [DBG 4] Overwriting ml_sequence of pre loaded model
Mar 05 2021 14:15:04.650803 [DBG 1] Object Recognition requested
Mar 05 2021 14:15:04.650953 [DBG 1] Calling detect streams with 644885 and {'resize': None, 'strategy': 'first', 'frame_set': 'alarm,snapshot', 'disable_ssl_cert_check': True, 'api': <pyzm.api.ZMApi object at 0x7f24dbb0ad90>, 'polygons': [{'name': 'smaller_m7', 'value': [(0, 476), (54, 455), (623, 240), (604, 453)], 'pattern': '(person|bear|dog|cat)'}], 'monitorid': '7'} and ml_overrides={} ml_options={'object': {'general': {'pattern': '.*', 'disable_locks': 'no', 'same_model_sequence_strategy': 'first'}, 'sequence': [{'tpu_max_processes': 1, 'tpu_max_lock_wait': 120, 'gpu_max_processes': 1, 'gpu_max_lock_wait': 120, 'cpu_max_processes': 4, 'cpu_max_lock_wait': 120, 'max_detection_size': '90%', 'object_config': 'models/yolov3/yolov3.cfg', 'object_weights': 'models/yolov3/yolov3.weights', 'object_labels': 'models/yolov3/coco.names', 'object_min_confidence': 0.3, 'object_framework': 'opencv', 'object_processor': 'cpu'}]}, 'general': {'model_sequence': 'object'}}
Mar 05 2021 14:15:04.651044 [DBG 3] Using manual locking as we are only using one model
Mar 05 2021 14:15:04.651464 [DBG 2] Media get SSL certificate check has been disbled
Mar 05 2021 14:15:04.651623 [DBG 2] Using URL 644885 for stream
Mar 05 2021 14:15:04.651701 [DBG 2] We will only process frames: ['alarm', 'snapshot']
Mar 05 2021 14:15:04.651753 [DBG 2] No need to start streams, we are picking images from http://192.168.1.189:8095/index.php?view=image&eid=644885
Mar 05 2021 14:15:04.651825 [DBG 3] Reading http://192.168.1.189:8095/index.php?view=image&eid=644885&fid=alarm
Mar 05 2021 14:15:04.651903 [DBG 3] No need to relogin as access token still has 119.84859281666667 minutes remaining
Mar 05 2021 14:15:04.651999 [DBG 4] make_request called with url=http://192.168.1.189:8095/index.php?view=image&eid=644885&fid=alarm payload={} type=get query={'token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJab25lTWluZGVyIiwiaWF0IjoxNjE0OTc1Mjk1LCJleHAiOjE2MTQ5ODI0OTUsInVzZXIiOiJhZG1pbiIsInR5cGUiOiJhY2Nlc3MifQ.s3EzgDwP4YrHwO9mZielwGAUBLyJjtpF4Z9pbMrD7V8'}
Mar 05 2021 14:15:04.686230 [DBG 1] perf: Starting for frame:alarm
Mar 05 2021 14:15:04.686317 [DBG 1] ============ Frame: alarm Running object model in sequence ==================
Mar 05 2021 14:15:04.686364 [DBG 3] load_models (just init, actual load happens at first detect): ['object']
Mar 05 2021 14:15:04.686962 [DBG 2] Initializing model  type:object with options:{'tpu_max_processes': 1, 'tpu_max_lock_wait': 120, 'gpu_max_processes': 1, 'gpu_max_lock_wait': 120, 'cpu_max_processes': 4, 'cpu_max_lock_wait': 120, 'max_detection_size': '90%', 'object_config': 'models/yolov3/yolov3.cfg', 'object_weights': 'models/yolov3/yolov3.weights', 'object_labels': 'models/yolov3/coco.names', 'object_min_confidence': 0.3, 'object_framework': 'opencv', 'object_processor': 'cpu', 'disable_locks': 'no'}
Mar 05 2021 14:15:04.693011 [DBG 2] portalock: max:4, name:pyzm_uid1000_cpu_lock, timeout:120
Mar 05 2021 14:15:04.693097 [DBG 2] Waiting for pyzm_uid1000_cpu_lock portalock...
filenames [PosixPath('/tmp/pyzm_uid1000_cpu_lock.00.lock'), PosixPath('/tmp/pyzm_uid1000_cpu_lock.01.lock'), PosixPath('/tmp/pyzm_uid1000_cpu_lock.02.lock'), PosixPath('/tmp/pyzm_uid1000_cpu_lock.03.lock')]
trying lock [PosixPath('/tmp/pyzm_uid1000_cpu_lock.00.lock'), PosixPath('/tmp/pyzm_uid1000_cpu_lock.01.lock'), PosixPath('/tmp/pyzm_uid1000_cpu_lock.02.lock'), PosixPath('/tmp/pyzm_uid1000_cpu_lock.03.lock')]
trying lock for /tmp/pyzm_uid1000_cpu_lock.00.lock
locked /tmp/pyzm_uid1000_cpu_lock.00.lock
Mar 05 2021 14:15:04.693619 [DBG 2] Got pyzm_uid1000_cpu_lock portalock
Mar 05 2021 14:15:04.693672 [DBG 3] object has a same_model_sequence strategy of first
Mar 05 2021 14:15:04.693717 [DBG 3] --------- Frame:alarm Running variation: #1 -------------
Mar 05 2021 14:15:04.693763 [DBG 2] pyzm_uid1000_cpu_lock portalock already acquired
Mar 05 2021 14:15:04.693790 [DBG 1] |--------- Loading Yolo model from disk ---------|
Mar 05 2021 14:15:04.802546 [DBG 1] perf: processor:cpu Yolo initialization (loading models/yolov3/yolov3.weights model from disk) took: 108.72 ms
Mar 05 2021 14:15:04.802679 [DBG 1] Using CPU for detection
Mar 05 2021 14:15:04.802824 [DBG 1] |---------- YOLO (input image: 640w*480h, model resize dimensions: 416w*416h) ----------|
Mar 05 2021 14:15:05.682308 [DBG 2] Released pyzm_uid1000_cpu_lock portalock
Mar 05 2021 14:15:05.682374 [DBG 1] perf: processor:cpu Yolo detection took: 879.52 ms
Mar 05 2021 14:15:05.817934 [DBG 2] perf: processor:cpu Yolo NMS filtering took: 0.97 ms
Mar 05 2021 14:15:05.818973 [DBG 3] core model detection over, got 1 objects. Now filtering
Mar 05 2021 14:15:05.819017 [DBG 3] Max object size found to be: 90%
Mar 05 2021 14:15:05.819260 [DBG 2] Converted 90% to 276480.0
Mar 05 2021 14:15:05.819285 [DBG 2] Returning filtered list of 1 objects.
Mar 05 2021 14:15:05.819309 [DBG 4] This model iteration inside object found: labels: ['person'],conf:[0.9985199570655823]
Mar 05 2021 14:15:05.819538 [DBG 3] intersection: comparing object:person,POLYGON ((389 30, 513 30, 513 238, 389 238, 389 30)) to polygon:smaller_m7,POLYGON ((0 476, 54 455, 623 240, 604 453, 0 476))
Mar 05 2021 14:15:05.819606 [INF] object:person at POLYGON ((389 30, 513 30, 513 238, 389 238, 389 30)) does not fall into any polygons, removing...
Mar 05 2021 14:15:05.819659 [DBG 2] We did not find any object matches in frame: alarm
Mar 05 2021 14:15:05.819682 [DBG 3] Reading http://192.168.1.189:8095/index.php?view=image&eid=644885&fid=snapshot
Mar 05 2021 14:15:05.819707 [DBG 3] No need to relogin as access token still has 119.82912913333332 minutes remaining
Mar 05 2021 14:15:05.819741 [DBG 4] make_request called with url=http://192.168.1.189:8095/index.php?view=image&eid=644885&fid=snapshot payload={} type=get query={'token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJab25lTWluZGVyIiwiaWF0IjoxNjE0OTc1Mjk1LCJleHAiOjE2MTQ5ODI0OTUsInVzZXIiOiJhZG1pbiIsInR5cGUiOiJhY2Nlc3MifQ.s3EzgDwP4YrHwO9mZielwGAUBLyJjtpF4Z9pbMrD7V8'}
Mar 05 2021 14:15:05.843071 [DBG 1] perf: Starting for frame:snapshot
Mar 05 2021 14:15:05.843120 [DBG 1] ============ Frame: snapshot Running object model in sequence ==================
Mar 05 2021 14:15:05.843140 [DBG 3] object has a same_model_sequence strategy of first
Mar 05 2021 14:15:05.843154 [DBG 3] --------- Frame:snapshot Running variation: #1 -------------
Mar 05 2021 14:15:05.843174 [DBG 2] Waiting for pyzm_uid1000_cpu_lock portalock...
filenames [PosixPath('/tmp/pyzm_uid1000_cpu_lock.00.lock'), PosixPath('/tmp/pyzm_uid1000_cpu_lock.01.lock'), PosixPath('/tmp/pyzm_uid1000_cpu_lock.02.lock'), PosixPath('/tmp/pyzm_uid1000_cpu_lock.03.lock')]
trying lock [PosixPath('/tmp/pyzm_uid1000_cpu_lock.00.lock'), PosixPath('/tmp/pyzm_uid1000_cpu_lock.01.lock'), PosixPath('/tmp/pyzm_uid1000_cpu_lock.02.lock'), PosixPath('/tmp/pyzm_uid1000_cpu_lock.03.lock')]
trying lock for /tmp/pyzm_uid1000_cpu_lock.00.lock
locked /tmp/pyzm_uid1000_cpu_lock.00.lock
Mar 05 2021 14:15:05.843387 [DBG 2] Got pyzm_uid1000_cpu_lock portalock
Mar 05 2021 14:15:05.843408 [DBG 1] |---------- YOLO (input image: 640w*480h, model resize dimensions: 416w*416h) ----------|
Mar 05 2021 14:15:06.528883 [DBG 2] Released pyzm_uid1000_cpu_lock portalock
Mar 05 2021 14:15:06.528956 [DBG 1] perf: processor:cpu Yolo detection took: 685.51 ms
Mar 05 2021 14:15:06.658382 [DBG 2] perf: processor:cpu Yolo NMS filtering took: 0.74 ms
Mar 05 2021 14:15:06.659243 [DBG 3] core model detection over, got 1 objects. Now filtering
Mar 05 2021 14:15:06.659278 [DBG 3] Max object size found to be: 90%
Mar 05 2021 14:15:06.659349 [DBG 2] Converted 90% to 276480.0
Mar 05 2021 14:15:06.659369 [DBG 2] Returning filtered list of 1 objects.
Mar 05 2021 14:15:06.659391 [DBG 4] This model iteration inside object found: labels: ['person'],conf:[0.9997007250785828]
Mar 05 2021 14:15:06.659563 [DBG 3] intersection: comparing object:person,POLYGON ((114 142, 258 142, 258 344, 114 344, 114 142)) to polygon:smaller_m7,POLYGON ((0 476, 54 455, 623 240, 604 453, 0 476))
Mar 05 2021 14:15:06.659646 [INF] object:person at POLYGON ((114 142, 258 142, 258 344, 114 344, 114 142)) does not fall into any polygons, removing...
Mar 05 2021 14:15:06.659675 [DBG 2] We did not find any object matches in frame: snapshot
Mar 05 2021 14:15:06.659696 [DBG 2] pyzm_uid1000_cpu_lock portalock already released
Mar 05 2021 14:15:06.659714 [DBG 1] perf: TOTAL detection sequence (with image loads) took: 2008.59 ms  to process 644885
Mar 05 2021 14:15:06.659748 [DBG 4] Restoring global config & ml_options
Mar 05 2021 14:15:06.659778 [DBG 1] Returning {'matched_data': {'boxes': [], 'error_boxes': [], 'labels': [], 'confidences': [], 'frame_id': None, 'image_dimensions': {'original': (480, 640), 'resized': (480, 640)}, 'image': None}, 'all_matches': [], 'polygons': [{'name': 'smaller_m7', 'value': [(0, 476), (54, 455), (623, 240), (604, 453)], 'pattern': '(person|bear|dog|cat)'}]}

is import_zm_zones=yes used? or is the monitor not defined correctly?

[monitor-7]
resize=no
match_past_detections=no
detection_sequence=object
smaller_m7=0,476 54,455 623,240 604,453
smaller_m7_zone_detection_pattern=(person|bear|dog|cat)
all_zone_detection_pattern=(bicycle|motorbike)
pliablepixels commented 3 years ago

Try master now. If it doesn't work, just post the startup messages (don't have to run a detection)

mfauvain commented 3 years ago

just did. same output.

Mar 05 2021 16:08:39.398400 [ERR] Not able to switch to ZM logs: 'ZM_PATH_LOGS'
Mar 05 2021 16:08:39.398452 [DBG 1] secret filename: ./secrets.ini
Mar 05 2021 16:08:39.398831 [DBG 1] Secret token found in config: !MLAPI_SECRET_KEY
Mar 05 2021 16:08:39.399052 [DBG 1] Secret token found in config: !PLATEREC_ALPR_KEY
Mar 05 2021 16:08:39.399113 [DBG 2] Found monitor specific section for monitor: 5
Mar 05 2021 16:08:39.399152 [DBG 4] ml sequence not found in globals
Mar 05 2021 16:08:39.399175 [DBG 4] stream sequence not found in globals
Mar 05 2021 16:08:39.399221 [DBG 4] [monitor-5] overrides key:resize with value:no
Mar 05 2021 16:08:39.399247 [DBG 4] [monitor-5] overrides key:detection_sequence with value:object
Mar 05 2021 16:08:39.399289 [DBG 2] adding polygon: smaller_m5 [170,389 636,244 636,345 153,425]
Mar 05 2021 16:08:39.399305 [DBG 2] found zone specific pattern:smaller_m5 storing
Mar 05 2021 16:08:39.399326 [DBG 2] found zone specific pattern:all storing
Mar 05 2021 16:08:39.399347 [DBG 2] replacing match pattern for polygon:smaller_m5 with: (person|bear|dog|cat|car|bicycle|motorbike|truck)
Mar 05 2021 16:08:39.399369 [DBG 2] Found monitor specific section for monitor: 6
Mar 05 2021 16:08:39.399398 [DBG 4] ml sequence not found in globals
Mar 05 2021 16:08:39.399429 [DBG 4] stream sequence not found in globals
Mar 05 2021 16:08:39.399460 [DBG 4] [monitor-6] overrides key:resize with value:no
Mar 05 2021 16:08:39.399483 [DBG 4] [monitor-6] overrides key:detection_sequence with value:object
Mar 05 2021 16:08:39.399514 [DBG 2] found zone specific pattern:all storing
Mar 05 2021 16:08:39.399532 [DBG 2] Found monitor specific section for monitor: 7
Mar 05 2021 16:08:39.399550 [DBG 4] ml sequence not found in globals
Mar 05 2021 16:08:39.399567 [DBG 4] stream sequence not found in globals
Mar 05 2021 16:08:39.399597 [DBG 4] [monitor-7] overrides key:resize with value:no
Mar 05 2021 16:08:39.399625 [DBG 4] [monitor-7] overrides key:detection_sequence with value:object
Mar 05 2021 16:08:39.399653 [DBG 2] adding polygon: smaller_m7 [0,476 54,455 623,240 604,453]
Mar 05 2021 16:08:39.399670 [DBG 2] found zone specific pattern:smaller_m7 storing
Mar 05 2021 16:08:39.399688 [DBG 2] found zone specific pattern:all storing
Mar 05 2021 16:08:39.399702 [DBG 2] replacing match pattern for polygon:smaller_m7 with: (person|bear|dog|cat)
Mar 05 2021 16:08:39.399714 [DBG 2] Found monitor specific section for monitor: 10
Mar 05 2021 16:08:39.399730 [DBG 4] ml sequence not found in globals
Mar 05 2021 16:08:39.399747 [DBG 4] stream sequence not found in globals
Mar 05 2021 16:08:39.399767 [DBG 4] [monitor-10] overrides key:resize with value:no
Mar 05 2021 16:08:39.399784 [DBG 4] [monitor-10] overrides key:detection_sequence with value:object
Mar 05 2021 16:08:39.399815 [DBG 2] adding polygon: smaller_m10 [535,64 597,57 543,474 362,476]
Mar 05 2021 16:08:39.399831 [DBG 2] found zone specific pattern:smaller_m10 storing
Mar 05 2021 16:08:39.399846 [DBG 2] found zone specific pattern:all storing
Mar 05 2021 16:08:39.399857 [DBG 2] replacing match pattern for polygon:smaller_m10 with: (person|bear|dog|cat|car|bicycle|motorbike|truck)
Mar 05 2021 16:08:39.399869 [DBG 2] Found monitor specific section for monitor: 11
Mar 05 2021 16:08:39.399885 [DBG 4] ml sequence not found in globals
Mar 05 2021 16:08:39.399909 [DBG 4] stream sequence not found in globals
Mar 05 2021 16:08:39.399938 [DBG 4] [monitor-11] overrides key:resize with value:no
Mar 05 2021 16:08:39.399970 [DBG 4] [monitor-11] overrides key:detection_sequence with value:object
Mar 05 2021 16:08:39.399989 [DBG 2] found zone specific pattern:all storing
Mar 05 2021 16:08:39.400007 [DBG 2] Found monitor specific section for monitor: 12
Mar 05 2021 16:08:39.400026 [DBG 4] ml sequence not found in globals
Mar 05 2021 16:08:39.400042 [DBG 4] stream sequence not found in globals
Mar 05 2021 16:08:39.400065 [DBG 4] [monitor-12] overrides key:resize with value:no
Mar 05 2021 16:08:39.400092 [DBG 4] [monitor-12] overrides key:detection_sequence with value:object
Mar 05 2021 16:08:39.400112 [DBG 2] found zone specific pattern:all storing
Mar 05 2021 16:08:39.400126 [DBG 2] Found monitor specific section for monitor: 13
Mar 05 2021 16:08:39.400142 [DBG 4] ml sequence not found in globals
Mar 05 2021 16:08:39.400160 [DBG 4] stream sequence not found in globals
Mar 05 2021 16:08:39.400181 [DBG 4] [monitor-13] overrides key:resize with value:no
Mar 05 2021 16:08:39.400206 [DBG 4] [monitor-13] overrides key:detection_sequence with value:object
Mar 05 2021 16:08:39.400226 [DBG 2] found zone specific pattern:all storing
Mar 05 2021 16:08:39.400240 [DBG 2] Found monitor specific section for monitor: 14
Mar 05 2021 16:08:39.400255 [DBG 4] ml sequence not found in globals
Mar 05 2021 16:08:39.400277 [DBG 4] stream sequence not found in globals
Mar 05 2021 16:08:39.400302 [DBG 4] [monitor-14] overrides key:resize with value:no
Mar 05 2021 16:08:39.400331 [DBG 4] [monitor-14] overrides key:detection_sequence with value:object
Mar 05 2021 16:08:39.400351 [DBG 2] found zone specific pattern:all storing
Mar 05 2021 16:08:39.400364 [DBG 2] Found monitor specific section for monitor: 15
Mar 05 2021 16:08:39.400384 [DBG 4] ml sequence not found in globals
Mar 05 2021 16:08:39.400401 [DBG 4] stream sequence not found in globals
Mar 05 2021 16:08:39.400422 [DBG 4] [monitor-15] overrides key:resize with value:no
Mar 05 2021 16:08:39.400450 [DBG 4] [monitor-15] overrides key:detection_sequence with value:object
Mar 05 2021 16:08:39.400467 [DBG 2] found zone specific pattern:all storing
Mar 05 2021 16:08:39.400500 [DBG 4] Doing parameter substitution for globals
Mar 05 2021 16:08:39.400739 [DBG 4] Doing parameter substitution for monitor specific entities
Mar 05 2021 16:08:39.404436 [DBG 1] Opening DB at ./db/db.json
Mar 05 2021 16:08:39.404602 [DBG 1] DB engine ready
Mar 05 2021 16:08:39.406893 [DBG 2] API SSL certificate check has been disbled
Mar 05 2021 16:08:39.406954 [DBG 1] using username/password for login
Mar 05 2021 16:08:39.520820 [DBG 2] Using new token API
Mar 05 2021 16:08:39.520981 [DBG 1] Access token expires on:2021-03-05 18:08:39.520937 [7200s]
Mar 05 2021 16:08:39.521061 [DBG 1] Refresh token expires on:2021-03-06 16:08:39.521035 [86400s]
Mar 05 2021 16:08:39.521139 [DBG 3] No need to relogin as access token still has 119.99999708333333 minutes remaining
Mar 05 2021 16:08:39.521216 [DBG 4] make_request called with url=http://192.168.1.189:8095/api/host/gettimezone.json payload={} type=get query={'token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJab25lTWluZGVyIiwiaWF0IjoxNjE0OTgyMTE5LCJleHAiOjE2MTQ5ODkzMTksInVzZXIiOiJhZG1pbiIsInR5cGUiOiJhY2Nlc3MifQ.uvXJUMMfdTalCAQgdqO_V7Hkk3p2LXBDfJ6G1Btl79Y'}
Mar 05 2021 16:08:39.565827 [DBG 2] mapping legacy ml data from config
Mar 05 2021 16:08:39.565950 [DBG 3] Changing detection_mode from all to most_models to adapt to new features
Mar 05 2021 16:08:39.566023 [DBG 1] Resetting models, will be loaded on next run
Mar 05 2021 16:08:39.566073 [INF] --------| mlapi version:2.2.4, pyzm version:0.3.36 |--------
Mar 05 2021 16:08:39.566120 [INF] Using bjoern as WSGI server
Mar 05 2021 16:08:44.652871 [DBG 1] Monitor ID 7 provided & matching config found in mlapi, ignoring objectconfig.ini
Mar 05 2021 16:08:44.653032 [DBG 4] Overriding global resize with no
Mar 05 2021 16:08:44.653148 [DBG 4] Overriding global match_past_detections with no
Mar 05 2021 16:08:44.653246 [DBG 4] Overriding global detection_sequence with ['object']
Mar 05 2021 16:08:44.653318 [DBG 2] mapping legacy ml data from config
Mar 05 2021 16:08:44.653454 [DBG 4] Overwriting ml_sequence of pre loaded model
Mar 05 2021 16:08:44.653579 [DBG 1] Object Recognition requested
Mar 05 2021 16:08:44.653776 [DBG 1] Calling detect streams with 644885 and {'resize': None, 'strategy': 'first', 'frame_set': 'alarm,snapshot', 'disable_ssl_cert_check': True, 'api': <pyzm.api.ZMApi object at 0x7f7fed9cbf40>, 'polygons': [{'name': 'smaller_m7', 'value': [(0, 476), (54, 455), (623, 240), (604, 453)], 'pattern': '(person|bear|dog|cat)'}], 'monitorid': '7'} and ml_overrides={} ml_options={'object': {'general': {'pattern': '.*', 'disable_locks': 'no', 'same_model_sequence_strategy': 'first'}, 'sequence': [{'tpu_max_processes': 1, 'tpu_max_lock_wait': 120, 'gpu_max_processes': 1, 'gpu_max_lock_wait': 120, 'cpu_max_processes': 4, 'cpu_max_lock_wait': 120, 'max_detection_size': '90%', 'object_config': 'models/yolov3/yolov3.cfg', 'object_weights': 'models/yolov3/yolov3.weights', 'object_labels': 'models/yolov3/coco.names', 'object_min_confidence': 0.3, 'object_framework': 'opencv', 'object_processor': 'cpu'}]}, 'general': {'model_sequence': 'object'}}
Mar 05 2021 16:08:44.653867 [DBG 3] Using manual locking as we are only using one model
Mar 05 2021 16:08:44.654330 [DBG 2] Media get SSL certificate check has been disbled
Mar 05 2021 16:08:44.654508 [DBG 2] Using URL 644885 for stream
Mar 05 2021 16:08:44.654591 [DBG 2] We will only process frames: ['alarm', 'snapshot']
Mar 05 2021 16:08:44.654656 [DBG 2] No need to start streams, we are picking images from http://192.168.1.189:8095/index.php?view=image&eid=644885
Mar 05 2021 16:08:44.654758 [DBG 3] Reading http://192.168.1.189:8095/index.php?view=image&eid=644885&fid=alarm
Mar 05 2021 16:08:44.654866 [DBG 3] No need to relogin as access token still has 119.91443513333334 minutes remaining
Mar 05 2021 16:08:44.655013 [DBG 4] make_request called with url=http://192.168.1.189:8095/index.php?view=image&eid=644885&fid=alarm payload={} type=get query={'token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJab25lTWluZGVyIiwiaWF0IjoxNjE0OTgyMTE5LCJleHAiOjE2MTQ5ODkzMTksInVzZXIiOiJhZG1pbiIsInR5cGUiOiJhY2Nlc3MifQ.uvXJUMMfdTalCAQgdqO_V7Hkk3p2LXBDfJ6G1Btl79Y'}
Mar 05 2021 16:08:44.697161 [DBG 1] perf: Starting for frame:alarm
Mar 05 2021 16:08:44.697293 [DBG 1] ============ Frame: alarm Running object model in sequence ==================
Mar 05 2021 16:08:44.697374 [DBG 3] load_models (just init, actual load happens at first detect): ['object']
Mar 05 2021 16:08:44.698251 [DBG 2] Initializing model  type:object with options:{'tpu_max_processes': 1, 'tpu_max_lock_wait': 120, 'gpu_max_processes': 1, 'gpu_max_lock_wait': 120, 'cpu_max_processes': 4, 'cpu_max_lock_wait': 120, 'max_detection_size': '90%', 'object_config': 'models/yolov3/yolov3.cfg', 'object_weights': 'models/yolov3/yolov3.weights', 'object_labels': 'models/yolov3/coco.names', 'object_min_confidence': 0.3, 'object_framework': 'opencv', 'object_processor': 'cpu', 'disable_locks': 'no'}
Mar 05 2021 16:08:44.704609 [DBG 2] portalock: max:4, name:pyzm_uid1000_cpu_lock, timeout:120
Mar 05 2021 16:08:44.704705 [DBG 2] Waiting for pyzm_uid1000_cpu_lock portalock...
filenames [PosixPath('/tmp/pyzm_uid1000_cpu_lock.00.lock'), PosixPath('/tmp/pyzm_uid1000_cpu_lock.01.lock'), PosixPath('/tmp/pyzm_uid1000_cpu_lock.02.lock'), PosixPath('/tmp/pyzm_uid1000_cpu_lock.03.lock')]
trying lock [PosixPath('/tmp/pyzm_uid1000_cpu_lock.00.lock'), PosixPath('/tmp/pyzm_uid1000_cpu_lock.01.lock'), PosixPath('/tmp/pyzm_uid1000_cpu_lock.02.lock'), PosixPath('/tmp/pyzm_uid1000_cpu_lock.03.lock')]
trying lock for /tmp/pyzm_uid1000_cpu_lock.00.lock
locked /tmp/pyzm_uid1000_cpu_lock.00.lock
Mar 05 2021 16:08:44.705206 [DBG 2] Got pyzm_uid1000_cpu_lock portalock
Mar 05 2021 16:08:44.705260 [DBG 3] object has a same_model_sequence strategy of first
Mar 05 2021 16:08:44.705300 [DBG 3] --------- Frame:alarm Running variation: #1 -------------
Mar 05 2021 16:08:44.705348 [DBG 2] pyzm_uid1000_cpu_lock portalock already acquired
Mar 05 2021 16:08:44.705380 [DBG 1] |--------- Loading Yolo model from disk ---------|
Mar 05 2021 16:08:44.824117 [DBG 1] perf: processor:cpu Yolo initialization (loading models/yolov3/yolov3.weights model from disk) took: 118.69 ms
Mar 05 2021 16:08:44.824259 [DBG 1] Using CPU for detection
Mar 05 2021 16:08:44.824398 [DBG 1] |---------- YOLO (input image: 640w*480h, model resize dimensions: 416w*416h) ----------|
Mar 05 2021 16:08:45.807688 [DBG 2] Released pyzm_uid1000_cpu_lock portalock
Mar 05 2021 16:08:45.807753 [DBG 1] perf: processor:cpu Yolo detection took: 983.32 ms
Mar 05 2021 16:08:45.943307 [DBG 2] perf: processor:cpu Yolo NMS filtering took: 0.84 ms
Mar 05 2021 16:08:45.944690 [DBG 3] core model detection over, got 1 objects. Now filtering
Mar 05 2021 16:08:45.944738 [DBG 3] Max object size found to be: 90%
Mar 05 2021 16:08:45.945069 [DBG 2] Converted 90% to 276480.0
Mar 05 2021 16:08:45.945096 [DBG 2] Returning filtered list of 1 objects.
Mar 05 2021 16:08:45.945119 [DBG 4] This model iteration inside object found: labels: ['person'],conf:[0.9985199570655823]
Mar 05 2021 16:08:45.945346 [DBG 3] intersection: comparing object:person,POLYGON ((389 30, 513 30, 513 238, 389 238, 389 30)) to polygon:smaller_m7,POLYGON ((0 476, 54 455, 623 240, 604 453, 0 476))
Mar 05 2021 16:08:45.945413 [INF] object:person at POLYGON ((389 30, 513 30, 513 238, 389 238, 389 30)) does not fall into any polygons, removing...
Mar 05 2021 16:08:45.945463 [DBG 2] We did not find any object matches in frame: alarm
Mar 05 2021 16:08:45.945486 [DBG 3] Reading http://192.168.1.189:8095/index.php?view=image&eid=644885&fid=snapshot
Mar 05 2021 16:08:45.945509 [DBG 3] No need to relogin as access token still has 119.89292391666666 minutes remaining
Mar 05 2021 16:08:45.945534 [DBG 4] make_request called with url=http://192.168.1.189:8095/index.php?view=image&eid=644885&fid=snapshot payload={} type=get query={'token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJab25lTWluZGVyIiwiaWF0IjoxNjE0OTgyMTE5LCJleHAiOjE2MTQ5ODkzMTksInVzZXIiOiJhZG1pbiIsInR5cGUiOiJhY2Nlc3MifQ.uvXJUMMfdTalCAQgdqO_V7Hkk3p2LXBDfJ6G1Btl79Y'}
Mar 05 2021 16:08:45.969164 [DBG 1] perf: Starting for frame:snapshot
Mar 05 2021 16:08:45.969214 [DBG 1] ============ Frame: snapshot Running object model in sequence ==================
Mar 05 2021 16:08:45.969234 [DBG 3] object has a same_model_sequence strategy of first
Mar 05 2021 16:08:45.969248 [DBG 3] --------- Frame:snapshot Running variation: #1 -------------
Mar 05 2021 16:08:45.969268 [DBG 2] Waiting for pyzm_uid1000_cpu_lock portalock...
filenames [PosixPath('/tmp/pyzm_uid1000_cpu_lock.00.lock'), PosixPath('/tmp/pyzm_uid1000_cpu_lock.01.lock'), PosixPath('/tmp/pyzm_uid1000_cpu_lock.02.lock'), PosixPath('/tmp/pyzm_uid1000_cpu_lock.03.lock')]
trying lock [PosixPath('/tmp/pyzm_uid1000_cpu_lock.00.lock'), PosixPath('/tmp/pyzm_uid1000_cpu_lock.01.lock'), PosixPath('/tmp/pyzm_uid1000_cpu_lock.02.lock'), PosixPath('/tmp/pyzm_uid1000_cpu_lock.03.lock')]
trying lock for /tmp/pyzm_uid1000_cpu_lock.00.lock
locked /tmp/pyzm_uid1000_cpu_lock.00.lock
Mar 05 2021 16:08:45.969560 [DBG 2] Got pyzm_uid1000_cpu_lock portalock
Mar 05 2021 16:08:45.969588 [DBG 1] |---------- YOLO (input image: 640w*480h, model resize dimensions: 416w*416h) ----------|
Mar 05 2021 16:08:46.640178 [DBG 2] Released pyzm_uid1000_cpu_lock portalock
Mar 05 2021 16:08:46.640258 [DBG 1] perf: processor:cpu Yolo detection took: 670.64 ms
Mar 05 2021 16:08:46.776230 [DBG 2] perf: processor:cpu Yolo NMS filtering took: 1.11 ms
Mar 05 2021 16:08:46.777297 [DBG 3] core model detection over, got 1 objects. Now filtering
Mar 05 2021 16:08:46.777337 [DBG 3] Max object size found to be: 90%
Mar 05 2021 16:08:46.777402 [DBG 2] Converted 90% to 276480.0
Mar 05 2021 16:08:46.777435 [DBG 2] Returning filtered list of 1 objects.
Mar 05 2021 16:08:46.777473 [DBG 4] This model iteration inside object found: labels: ['person'],conf:[0.9997007250785828]
Mar 05 2021 16:08:46.777725 [DBG 3] intersection: comparing object:person,POLYGON ((114 142, 258 142, 258 344, 114 344, 114 142)) to polygon:smaller_m7,POLYGON ((0 476, 54 455, 623 240, 604 453, 0 476))
Mar 05 2021 16:08:46.777870 [INF] object:person at POLYGON ((114 142, 258 142, 258 344, 114 344, 114 142)) does not fall into any polygons, removing...
Mar 05 2021 16:08:46.777904 [DBG 2] We did not find any object matches in frame: snapshot
Mar 05 2021 16:08:46.777963 [DBG 2] pyzm_uid1000_cpu_lock portalock already released
Mar 05 2021 16:08:46.778002 [DBG 1] perf: TOTAL detection sequence (with image loads) took: 2123.97 ms  to process 644885
Mar 05 2021 16:08:46.778026 [DBG 4] Restoring global config & ml_options
Mar 05 2021 16:08:46.778079 [DBG 1] Returning {'matched_data': {'boxes': [], 'error_boxes': [], 'labels': [], 'confidences': [], 'frame_id': None, 'image_dimensions': {'original': (480, 640), 'resized': (480, 640)}, 'image': None}, 'all_matches': [], 'polygons': [{'name': 'smaller_m7', 'value': [(0, 476), (54, 455), (623, 240), (604, 453)], 'pattern': '(person|bear|dog|cat)'}]}
pliablepixels commented 3 years ago

Do you have import ZM zones as yes either in global or in monitor specific ? You need it to import ZM zones. My guess is your all is a ZM zone. So if you don’t specify import ZM zones to yes it won’t import. Same as object configuration.

mfauvain commented 3 years ago

I have it global in objectconfig.ini on ES and mlapiconfig.ini on mlapi server. I also added it on monitor-7 to test but I didn't see anything different. I can try again...

pliablepixels commented 3 years ago

Make sure you have updated correctly.

pliablepixels commented 3 years ago

I just bumped up version to 2.2.6 to make sure. Your version shows 2.2.4 which means you did not update correctly - last version was 2.2.5

mfauvain commented 3 years ago

hmm,. weird, I did git clone and run it., still have 2.2.4.. pyzm 0.3.36.. scratch that, tired.. friday.

ok... my bad. so, found another error on my side. import_zm_zones=yes was not in the [general] section but in the [object] section.. fixed that. thks to the debug message in the 2.2.6 version. However, there is still an issue I think, because it does compare to the 2 polygons this time, BUT it uses wrong pattern for all polygon.

intersection: comparing object:person,POLYGON ((114 142, 258 142, 258 344, 114 344, 114 142)) to polygon:smaller_m7,POLYGON ((0 476, 54 455, 623 240, 604 453, 0 476))
Mar 05 2021 19:10:02.552599 [DBG 3] intersection: comparing object:person,POLYGON ((114 142, 258 142, 258 344, 114 344, 114 142)) to polygon:all,POLYGON ((0 476, 1 216, 636 23, 604 453, 0 476))
Mar 05 2021 19:10:02.552635 [DBG 2] Using global match pattern: .*

as specified in monitor section, all polygon shld use all_zone_detection_pattern=(bicycle|motorbike)

[monitor-7]
resize=no
match_past_detections=no
detection_sequence=object
smaller_m7=0,476 54,455 623,240 604,453
smaller_m7_zone_detection_pattern=(person|bear|dog|cat)
all_zone_detection_pattern=(bicycle|motorbike)

debug says it does use the specific pattern though:

Mar 05 2021 14:14:55.448783 [DBG 4] [monitor-7] overrides key:resize with value:no
Mar 05 2021 14:14:55.448829 [DBG 4] [monitor-7] overrides key:detection_sequence with value:object
Mar 05 2021 14:14:55.448872 [DBG 2] adding polygon: smaller_m7 [0,476 54,455 623,240 604,453]
Mar 05 2021 14:14:55.448901 [DBG 2] found zone specific pattern:smaller_m7 storing
Mar 05 2021 14:14:55.448929 [DBG 2] found zone specific pattern:all storing
pliablepixels commented 3 years ago

Please give master a try

mfauvain commented 3 years ago

success!

[DBG 3] all polygon/zone has its own pattern of (bicycle|motorbike), using that
Mar 06 2021 09:29:09.022991 [DBG 3] all intersects object:person[[(114, 142), (258, 142), (258, 344), (114, 344)]] but does NOT match your detect pattern filter

thx vmuch