ZoneMinder / zmeventnotification

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

Missed license plates due to incorrect polygon comparison #294

Closed neillbell closed 4 years ago

neillbell commented 4 years ago

Event Server version

5.15.6

Hooks version

For reasons I don't understand, printing the version gives me:

python3 -c "import pyzm; print (pyzm.ml.__version__)"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: module 'pyzm' has no attribute 'ml'

I'm using pyzm-0.1.19.

The version of ZoneMinder you are using:

1.35.5

What is the nature of your issue

Bug

Details

Some license plate detections are ignored. In zmesdetect_m6.log and mlapi.log it is clear that a license plate was detected. However, in zmesdetect_m6.log we see the lines:

08/11/20 19:35:57 zmesdetect_m6[10188] DBG1 image_manip.py:351 [valid plate: polygon in process=[(407, 681), (487, 681), (487, 723), (407, 723)]]
08/11/20 19:35:57 zmesdetect_m6[10188] DBG1 image_manip.py:355 [valid plate: mask in process=[(0, 0), (1200, 0), (1200, 675), (0, 675)]]
08/11/20 19:35:57 zmesdetect_m6[10188] DBG1 image_manip.py:377 [plate:******* at POLYGON ((407 681, 487 681, 487 723, 407 723, 407 681)) does not fall into any polygons, removing...]

It looks like the license plate polygon is being compared to a polygon representing the scaled 1200px image instead of the full image.

This may be too deep in the detection stuff for consideration, but it seems like it should be an obvious issue to someone who is smarter than me.

Debug Logs mlapi.log zmesdetect_m6.log

pliablepixels commented 4 years ago

All the ML code has moved to pyzm. You probably have an old version (I haven't yet released the master code - there are many breaking changes to ES) I don't quite remember why alpr.py is rescaling the image. It is already done by zm_detect.py What happens if you do a return (1,1) right at the top in getscale()? https://github.com/pliablepixels/pyzm/blob/master/pyzm/ml/alpr.py#L48

pliablepixels commented 4 years ago

I think I fixed this with the latest update - please test. (pyzm needs to be updated as well, which will be taken care of by install.sh)

neillbell commented 4 years ago

Works with the latest update. Thanks!