ZoneMinder / zmeventnotification

Machine Learning powered Secure Websocket & MQTT based ZoneMinder event notification server
408 stars 128 forks source link

Execution zmeventnotification and python 3.11 and workaround #431

Open GGilles46 opened 5 months ago

GGilles46 commented 5 months ago

Event Server version

6.1.29

Hooks version (if you are using Object Detection)

app:6.1.29, pyzm:0.3.64

Are you using MLAPI? (Y/N) N

The version of ZoneMinder you are using: 1.37.56

What is the nature of your issue

Bug

Details

Execution de zmeventnotification

Debug Logs (if applicable) 03/26/24 15:34:23 zmesdetect[5725] ERR detect_sequence.py:710 [Error running model: module 'PIL.Image' has no attribute 'ANTIALIAS'] 03/26/24 15:34:23 zmesdetect[5725] DBG2 detect_sequence.py:711 [Traceback (most recent call last): File "/usr/local/lib/python3.11/dist-packages/pyzm/ml/detect_sequence.py", line 707, in detect_stream _b,_l,_c,_m = m.detect(image=frame) ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/pyzm/ml/object.py", line 78, in detect b,l,c,_model_names = self.model.detect(image) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/pyzm/ml/coral_edgetpu.py", line 167, in detect _, scale = common.set_resized_input( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/pycoral/adapters/common.py", line 98, in set_resized_input result = resize((w, h)) ^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/pyzm/ml/coral_edgetpu.py", line 168, in <lambda> self.model, img.size, lambda size: img.resize(size, Image.ANTIALIAS)) ^^^^^^^^^^^^^^^ AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'

The workaround is to modify /usr/local/lib/python3.11/dist-packages/pyzm/ml/coraledgetpu.py line 168 , scale = common.set_resized_input(

self.model, img.size, lambda size: img.resize(size, Image.ANTIALIAS))

            self.model, img.size, lambda size: img.resize(size, Image.LANCZOS))

Thanks