YOLO: invalid index to scalar variable

Discussion topics related to mobile applications and ZoneMinder Event Server (including machine learning)
Post Reply
spottaaja1
Posts: 4
Joined: Thu Jul 07, 2022 6:30 pm

YOLO: invalid index to scalar variable

Post by spottaaja1 »

Hello!

I keep getting this "invalid index to scalar variable" with ZMES machine learning hooks on YOLO and don't know how to fix.

Code: Select all

DBG1 [zmesdetect] [|---------- YOLO (input image: 800w*450h, model resize dimensions: 416w*416h) ----------|]
DBG2 [zmesdetect] [Released pyzm_uid33_gpu_lock portalock]
07/07/22 21:25:48 zmesdetect[11243] ERR detect_sequence.py:713 [Error running model: invalid index to scalar variable.]

DBG2 [zmesdetect] [Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/pyzm/ml/detect_sequence.py", line 710, in detect_stream
    _b,_l,_c,_m = m.detect(image=frame)
  File "/usr/local/lib/python3.9/dist-packages/pyzm/ml/object.py", line 65, in detect
    b,l,c,_model_names = self.model.detect(image)
  File "/usr/local/lib/python3.9/dist-packages/pyzm/ml/yolo.py", line 168, in detect
    ln = self.get_output_layers()
  File "/usr/local/lib/python3.9/dist-packages/pyzm/ml/yolo.py", line 129, in get_output_layers
    output_layers = [
  File "/usr/local/lib/python3.9/dist-packages/pyzm/ml/yolo.py", line 130, in <listcomp>
    layer_names[i[0] - 1] for i in self.net.getUnconnectedOutLayers()
IndexError: invalid index to scalar variable.
]
Any suggenstions?

Versions:
ZM v1.36.18
ZMES v6.1.26
OpenCV 4.6.0-dev

Running on virtual machine:
Linux zoneminder-es 5.10.0-15-amd64 #1 SMP Debian 5.10.120-1 (2022-06-09) x86_64 GNU/Linux

Code: Select all

> lspci
00:00.0 Host bridge: Intel Corporation 82G33/G31/P35/P31 Express DRAM Controller
00:01.0 VGA compatible controller: Red Hat, Inc. QXL paravirtual graphic card (rev 05)
00:02.0 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
00:02.1 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
00:02.2 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
00:02.3 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
00:02.4 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
00:02.5 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
00:02.6 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
00:02.7 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
00:03.0 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
00:03.1 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
00:03.2 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
00:03.3 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
00:03.4 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
00:03.5 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
00:03.6 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
00:03.7 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
00:04.0 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
00:1f.0 ISA bridge: Intel Corporation 82801IB (ICH9) LPC Interface Controller (rev 02)
00:1f.2 SATA controller: Intel Corporation 82801IR/IO/IH (ICH9R/DO/DH) 6 port SATA Controller [AHCI mode] (rev 02)
00:1f.3 SMBus: Intel Corporation 82801I (ICH9 Family) SMBus Controller (rev 02)
01:00.0 PCI bridge: Red Hat, Inc. Device 000e
02:01.0 System peripheral: Intel Corporation 6300ESB Watchdog Timer
03:00.0 Ethernet controller: Red Hat, Inc. Virtio network device (rev 01)
04:00.0 SCSI storage controller: Red Hat, Inc. Virtio SCSI (rev 01)
05:00.0 Ethernet controller: Red Hat, Inc. Virtio network device (rev 01)
06:00.0 USB controller: Red Hat, Inc. QEMU XHCI Host Controller (rev 01)
07:00.0 Unclassified device [00ff]: Red Hat, Inc. Virtio RNG (rev 01)
09:00.0 Communication controller: Red Hat, Inc. Virtio console (rev 01)
0a:00.0 Unclassified device [00ff]: Red Hat, Inc. Virtio memory balloon (rev 01)

Code: Select all

> lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: YOLO: invalid index to scalar variable

Post by Magic919 »

Anyone running opencv 4.6+ will need a fixed yolo.py FYI
https://raw.githubusercontent.com/baudn ... er/yolo.py

This was posted on Slack.
-
spottaaja1
Posts: 4
Joined: Thu Jul 07, 2022 6:30 pm

Re: YOLO: invalid index to scalar variable

Post by spottaaja1 »

Ok that did it. Thanks!!
Post Reply