Page 2 of 2

Re: zmeventnotification stopped working

Posted: Fri May 05, 2023 12:18 am
by BigKuma
eresonance wrote: Sun Feb 19, 2023 6:35 pm I have python3.11 and OpenCV 4.7.0 and I see the same issue. I think there's a problem detecting the opencv version.

Open up the yolo.py script:

Code: Select all

sudo vim /usr/local/lib/python3.11/site-packages/pyzm/ml/yolo.py
Go to line 95:

Code: Select all

        (maj, minor, patch) = cv2.__version__.split('.')
        min_ver = int(maj + minor)
        patch = int(patch) if patch.isdigit() else 0
        if min_ver >= 45 and patch >=4:
            # see https://github.com/opencv/opencv/issues/20923
            # we need to modify Yolo code not to expect a nested structure
            g.logger.Debug(1, 'You are using OpenCV >= 4.5.4, making sure we fix getUnconnectedOutLayers() API')
            self.is_get_unconnected_api_list = True
We want that to look like:

Code: Select all

        (maj, minor, patch) = cv2.__version__.split('.')
        min_ver = int(maj + minor + patch)
        if min_ver >= 454:
            # see https://github.com/opencv/opencv/issues/20923
            # we need to modify Yolo code not to expect a nested structure
            g.logger.Debug(1, 'You are using OpenCV >= 4.5.4, making sure we fix getUnconnectedOutLayers() API')
            self.is_get_unconnected_api_list = True
That will handle the case where your minor version is > 5 but your patch is < 4.
Thanks! That worked!
My ZM was 1.37.40
Python was 3.10
I just installed all ML packages, including the OpenCV 4.7.0
My error wasn't even as verbose as Pedulla:
May 4 17:55:09 videoserver zm_detect.py[242542]: ERR [zmesdetect_m1] [Error running model: invalid index to scalar variable.]
What do I need to turn on for line numbers ?

@eresonance, you should push this patch into GitHub

Re: zmeventnotification stopped working

Posted: Mon May 08, 2023 3:27 am
by Pedulla
Python 3.8.10 (default, Mar 13 2023, 10:26:41)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from cv2 import __version__
>>> __version__
'4.7.0'
I'm running stock zm 1.36.33 on Ubuntu 20.04.6LTS
05/07/23 20:16:42 zmesdetect[144034] ERR detect_sequence.py:713 [Error running model: invalid index to scalar variable.]
Changing line 95 as suggested above does not resolve this error. This is way over my head.

This is way over my head. Do I need Python 3.11? Any help would greatly be appreciated.