-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error running model: invalid index to scalar variable. #44
Comments
It looks like the API output changed in OpenCV 4.5.4 In previous versions, the dimensions were returned as an array of array but now its just an array. I'm not sure if this compatibility issue will be fixed, or if this is the new format, but for now, see temporary fix at https://forums.zoneminder.com/viewtopic.php?f=43&t=31129&p=123755&hilit=scalar#p123755 |
thank you very much for your prompt reply. That workaround indeed removes the error. |
Let's keep it open till I fix it correctly |
Could you replace your yolo.py with this one and test? https://github.com/pliablepixels/pyzm/blob/5dfd2b7bfe57024dabc125c53c10b2c9f8e1a82b/pyzm/ml/yolo.py I am not running 4.5.4 at the moment |
@pliablepixels tested your new yolo.py. Works fine, no errors, object recognition as expected. |
Good job on finding which exact version! |
Fixes issue with OpenCV 4.5.4 changing API format ZoneMinder/mlapi#44
Same error "IndexError: invalid index to scalar variable" 08/11/22 20:42:06 zmesdetect_m1[4359] INF ZMLog.py:292 [Setting up signal handler for logs] |
The error shows up with opencv/contrib 4.6.0-dev only |
I'll post a link to the fix and how to apply it here shortly |
See this issue thread and apply the same fix |
After applying fix in ZoneMinder/zmeventnotification#416 now error "IndexError: invalid index to scalar variable" disapeared with opencv-contrib 4.6.0 But I experience now object_detect does not match anything. Not sure what it came from, but I tried delete /var/lib/zmeventnotification and install ES again by install.sh . It used to match/detect person pretty well before updated opencv 4.6.0 Is there anything alse to be reset ? 08/12/22 20:04:46 zmesdetect_m1[33801] INF ZMLog.py:292 [Setting up signal handler for logs] |
The only thing changed in the fix is how the opencv version is processed so there really shouldn't be any issues. Are you testing with an event that had previously detected objects? |
I will test more thorougly |
No, replacing yolo.py will not affect anything else and you will not need to change anything else. It's a rolling hot fix that shouldn't do anything but take care of the index error you were seeing before. |
Seems issue with detected objects is somehow connected with ZM only. |
So the fixed yolo.py is no longer working with ZoneMinder 1.36.32. OpenCV 4.6.0-dev Python 3.10.6. |
By the fixed yolo.py do you mean the one I uploaded or do you mean the the one using/not using the indices based on opencv version? |
Running mlapi 2.2.23 with opencv 4.5.4.
Following error on object detection:
`Nov 3 13:25:41 UNRAID /mlapi.py[1219]: INF [zm_mlapi] [Setting up signal handler for logs]
Nov 3 13:25:41 UNRAID /mlapi.py[1219]: INF [zm_mlapi] [Switching global logger to ZMLog]
Nov 3 13:25:41 UNRAID /mlapi.py[1219]: INF [zm_mlapi] [Switched to ZM logs]
Nov 3 13:25:41 UNRAID /mlapi.py[1219]: INF [zm_mlapi] [Reading config from: /var/lib/zmeventnotification/mlapiconfig.ini]
Nov 3 13:25:41 UNRAID /mlapi.py[1219]: INF [zm_mlapi] [Reading config from: /var/lib/zmeventnotification/mlapiconfig.ini]
Nov 3 13:25:41 UNRAID /mlapi.py[1219]: INF [zm_mlapi] [Reading secrets from: /etc/zm/secrets.ini]
Nov 3 13:25:41 UNRAID web_php[813]: 11/03/21 13:25:41.182655 web_php[813].INF [172.10.0.1] [Login successful for user "juan"] at /usr/share/zoneminder/www/api/app/Controller/AppController.php line 86
Nov 3 13:25:41 UNRAID web_php[813]: 11/03/21 13:25:41.185551 web_php[813].INF [172.10.0.1] [Creating token for "juan"] at /usr/share/zoneminder/www/api/app/Controller/HostController.php line 157
Nov 3 13:25:41 UNRAID /mlapi.py[1219]: INF [zm_mlapi] [--------| mlapi version:2.2.23, pyzm version:0.3.55 |--------]
Nov 3 13:25:41 UNRAID /mlapi.py[1219]: INF [zm_mlapi] [Using bjoern as WSGI server]
Nov 3 13:26:41 UNRAID /mlapi.py[1219]: ERR [zm_mlapi] [Error running model: invalid index to scalar variable.]
Nov 3 13:26:41 UNRAID /mlapi.py[1219]: INF [zm_mlapi] [Removing matches to past detections for monitor:6]`
If YoloV4 is set to 'enabled': 'no' in mlapiconfig.ini error disapears.
This error is not present with opencv 4.5.3
The text was updated successfully, but these errors were encountered: