pageauc / speed-camera

A Unix, Windows, Raspberry Pi Object Speed Camera using python, opencv, video streaming, motion tracking. Includes a Standalone Web Server Interface, Image Search using opencv template match and a whiptail Admin Menu Interface Includes picam and webcam Plugins for motion track security camera configuration including rclone sync script. watch-app allows remotely controller camera configuration from a remote storage service name. Uses sqlite3 and gnuplot for reporting. Recently added openalpr license plate reader support.
Apache License 2.0
967 stars 170 forks source link

after upgrade speed-cam seems to crash every time a car comes by #112

Closed johncohnvt closed 10 months ago

johncohnvt commented 2 years ago

Hi.. I just did an upgrade on speed-camera . No the speed-camera.py seems to crash every time a car goes by. Eg. If I have the opencv window open, ever time a car comes into view and is recognized, the opencv window abruptly closes and the spaeed_camer.py service needs to be restarted. If I understand the upgrade I did, it did not overwrite my config.py.. . My old config. says I was at ver 11.20 before the upgrade, the config.py.new installed during upgrade also says ver 11.20 .. which means I was already at ver 11.20 before the upgrade . Any idea what may be causing this.. or how to debug whats up ? Thanks ! -jc

pageauc commented 2 years ago

I have released speed-cam.py ver 11.23. The problem may be due to a revised version of user_motion_code.py. You can try deleting/renaming the existing user_motion_code.py and performing an UPGRADE. Sorry for the delay but Internet was out for a while. Let me Know Results

johncohnvt commented 2 years ago

Claude,

Thanks as always for the quick response. That does seem to have fixed things.. It no longer crashes on each observation. I am noticing a few other things which are a little off. I notice that that my attempot to start the speed-camera service in /etc/rc.local is not working anymore.. I have changed the call there to su pi -c "/home/pi/speed-camera/speed-cam.sh start >> /home/pi/sc.log"

and see the following in the log /home/pi/speed-camera/speed-cam.sh ver 6.00 written by Claude Pageau

STATUS - speed-cam.py is Running ... STATUS - PID is 854 INFO - To Stop speed-cam.py execute command below INFO - /home/pi/speed-camera/speed-cam.sh stop Done

I have to start the service manually in ./menubox.sh .. or start it as a service via /home/pi/speed-camera/speed-cam.sh start

The other thing I’m noticing is that it appears to be missing some vehicles as they traverse the field when I watch using the OpenCV screen. I think it may be due to some mounded snow near the edge of the viewing box.. might be confusing the image recognition.

Anyway.. things are looking pretty good. Thanks so much for this excellent project ! -jc

-- John Cohn | team member BETA TECHNOLOGIES (802) 578-0985 1150 Airport Drive South Burlington, VT 05403

From: Claude Pageau @.> Reply-To: pageauc/speed-camera @.> Date: Saturday, February 5, 2022 at 6:10 PM To: pageauc/speed-camera @.> Cc: johncohnvt @.>, Author @.***> Subject: Re: [pageauc/speed-camera] after upgrade speed-cam seems to crash every time a car comes by (Issue #112)

I have released speed-cam.py ver 11.23. The problem may be due to a revised version of user_motion_code.py. You can try deleting/renaming the existing user_motion_code.py and performing an UPGRADE. Sorry for the delay but Internet was out for a while. Let me Know Results

— Reply to this email directly, view it on GitHubhttps://github.com/pageauc/speed-camera/issues/112#issuecomment-1030712256, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AWR3VSAUJWMTNGTCVSPSUGTUZWU7DANCNFSM5NUFRARQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.Message ID: @.***>

pageauc commented 2 years ago

Did you delete/rename user_motion_code.py before the upgrade. Install script will not overwrite existing user_motion_code.py so you need to delete/rename for it to get updated. I suspect this was the problem you were having. New user_motion_code.py has more parameters passed to the function so I added a try except TypeError so it would not crash with an older user_motion_code.py. This is just for those that want to execute something after image taken when motion tracking is triggered

BTW using the opencv window will slow processing loop down somewhat

Claude ...

On Sun, Feb 6, 2022 at 11:57 AM johncohnvt @.***> wrote:

Claude,

Thanks as always for the quick response. That does seem to have fixed things.. It no longer crashes on each observation. I am noticing a few other things which are a little off. I notice that that my attempot to start the speed-camera service in /etc/rc.local is not working anymore.. I have changed the call there to su pi -c "/home/pi/speed-camera/speed-cam.sh start >> /home/pi/sc.log"

and see the following in the log /home/pi/speed-camera/speed-cam.sh ver 6.00 written by Claude Pageau

STATUS - speed-cam.py is Running ... STATUS - PID is 854 INFO - To Stop speed-cam.py execute command below INFO - /home/pi/speed-camera/speed-cam.sh stop Done

I have to start the service manually in ./menubox.sh .. or start it as a service via /home/pi/speed-camera/speed-cam.sh start

The other thing I’m noticing is that it appears to be missing some vehicles as they traverse the field when I watch using the OpenCV screen. I think it may be due to some mounded snow near the edge of the viewing box.. might be confusing the image recognition.

Anyway.. things are looking pretty good. Thanks so much for this excellent project ! -jc

-- John Cohn | team member BETA TECHNOLOGIES (802) 578-0985 1150 Airport Drive South Burlington, VT 05403

From: Claude Pageau @.> Reply-To: pageauc/speed-camera @.> Date: Saturday, February 5, 2022 at 6:10 PM To: pageauc/speed-camera @.> Cc: johncohnvt @.>, Author @.***> Subject: Re: [pageauc/speed-camera] after upgrade speed-cam seems to crash every time a car comes by (Issue #112)

I have released speed-cam.py ver 11.23. The problem may be due to a revised version of user_motion_code.py. You can try deleting/renaming the existing user_motion_code.py and performing an UPGRADE. Sorry for the delay but Internet was out for a while. Let me Know Results

— Reply to this email directly, view it on GitHub< https://github.com/pageauc/speed-camera/issues/112#issuecomment-1030712256>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/AWR3VSAUJWMTNGTCVSPSUGTUZWU7DANCNFSM5NUFRARQ

. Triage notifications on the go with GitHub Mobile for iOS< https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android< https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . You are receiving this because you authored the thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/pageauc/speed-camera/issues/112#issuecomment-1030882176, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNPKZGPR2MS2H3MTYRAFNTUZ2ZAHANCNFSM5NUFRARQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

-- YouTube Channel at https://www.youtube.com/user/pageaucp http://www.youtube.com/user/pageaucp GitHub Repository at https://github.com/pageauc

johncohnvt commented 2 years ago

Yes.. I renamed both the .py and .pyc for user_ motion _code . That seemed to fix the crash

I turned off the preview once the crash was debuged.. I womder if the slowdown was what was making it miss a few cars.. all seems good now with the remaining mytery of why its not staying running after bring up at boot

Get Outlook for iOShttps://aka.ms/o0ukef


From: Claude Pageau @.> Sent: Sunday, February 6, 2022 1:19:49 PM To: pageauc/speed-camera @.> Cc: johncohnvt @.>; Author @.> Subject: Re: [pageauc/speed-camera] after upgrade speed-cam seems to crash every time a car comes by (Issue #112)

Did you delete/rename user_motion_code.py before the upgrade. Install script will not overwrite existing user_motion_code.py so you need to delete/rename for it to get updated. I suspect this was the problem you were having. New user_motion_code.py has more parameters passed to the function so I added a try except TypeError so it would not crash with an older user_motion_code.py. This is just for those that want to execute something after image taken when motion tracking is triggered

BTW using the opencv window will slow processing loop down somewhat

Claude ...

On Sun, Feb 6, 2022 at 11:57 AM johncohnvt @.***> wrote:

Claude,

Thanks as always for the quick response. That does seem to have fixed things.. It no longer crashes on each observation. I am noticing a few other things which are a little off. I notice that that my attempot to start the speed-camera service in /etc/rc.local is not working anymore.. I have changed the call there to su pi -c "/home/pi/speed-camera/speed-cam.sh start >> /home/pi/sc.log"

and see the following in the log /home/pi/speed-camera/speed-cam.sh ver 6.00 written by Claude Pageau

STATUS - speed-cam.py is Running ... STATUS - PID is 854 INFO - To Stop speed-cam.py execute command below INFO - /home/pi/speed-camera/speed-cam.sh stop Done

I have to start the service manually in ./menubox.sh .. or start it as a service via /home/pi/speed-camera/speed-cam.sh start

The other thing I’m noticing is that it appears to be missing some vehicles as they traverse the field when I watch using the OpenCV screen. I think it may be due to some mounded snow near the edge of the viewing box.. might be confusing the image recognition.

Anyway.. things are looking pretty good. Thanks so much for this excellent project ! -jc

-- John Cohn | team member BETA TECHNOLOGIES (802) 578-0985 1150 Airport Drive South Burlington, VT 05403

From: Claude Pageau @.> Reply-To: pageauc/speed-camera @.> Date: Saturday, February 5, 2022 at 6:10 PM To: pageauc/speed-camera @.> Cc: johncohnvt @.>, Author @.***> Subject: Re: [pageauc/speed-camera] after upgrade speed-cam seems to crash every time a car comes by (Issue #112)

I have released speed-cam.py ver 11.23. The problem may be due to a revised version of user_motion_code.py. You can try deleting/renaming the existing user_motion_code.py and performing an UPGRADE. Sorry for the delay but Internet was out for a while. Let me Know Results

— Reply to this email directly, view it on GitHub< https://github.com/pageauc/speed-camera/issues/112#issuecomment-1030712256>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/AWR3VSAUJWMTNGTCVSPSUGTUZWU7DANCNFSM5NUFRARQ

. Triage notifications on the go with GitHub Mobile for iOS< https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android< https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . You are receiving this because you authored the thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/pageauc/speed-camera/issues/112#issuecomment-1030882176, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNPKZGPR2MS2H3MTYRAFNTUZ2ZAHANCNFSM5NUFRARQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

-- YouTube Channel at https://www.youtube.com/user/pageaucp http://www.youtube.com/user/pageaucp GitHub Repository at https://github.com/pageauc

— Reply to this email directly, view it on GitHubhttps://github.com/pageauc/speed-camera/issues/112#issuecomment-1030886301, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AWR3VSF7WMZCLX5MVLKVAEDUZ23ULANCNFSM5NUFRARQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.Message ID: @.***>

pageauc commented 2 years ago

I have found sometimes vehicles are hard to track. Eg white vehicle with snow background, green with green background, Birds, squirrels, pets moving around Etc. setting min area can sometimes help. I have trees that are in the tracking window so if it is windy they can cause tracking issues. There are several config.py timeouts in the loop to avoid tracking problems like a few movements due to trees that do not result in a completed track. These get timed out but can also mean a legitimate movement gets missed due to the prior delay. Also remember that sometimes contours can move around due to reflection, lighting, Etc.

Regards Claude ..

On Sun, Feb 6, 2022 at 12:23 PM johncohnvt @.***> wrote:

Yes.. I renamed both the .py and .pyc for user_ motion _code . That seemed to fix the crash

I turned off the preview once the crash was debuged.. I womder if the slowdown was what was making it miss a few cars.. all seems good now with the remaining mytery of why its not staying running after bring up at boot

Get Outlook for iOShttps://aka.ms/o0ukef


From: Claude Pageau @.> Sent: Sunday, February 6, 2022 1:19:49 PM To: pageauc/speed-camera @.> Cc: johncohnvt @.>; Author @.> Subject: Re: [pageauc/speed-camera] after upgrade speed-cam seems to crash every time a car comes by (Issue #112)

Did you delete/rename user_motion_code.py before the upgrade. Install script will not overwrite existing user_motion_code.py so you need to delete/rename for it to get updated. I suspect this was the problem you were having. New user_motion_code.py has more parameters passed to the function so I added a try except TypeError so it would not crash with an older user_motion_code.py. This is just for those that want to execute something after image taken when motion tracking is triggered

BTW using the opencv window will slow processing loop down somewhat

Claude ...

On Sun, Feb 6, 2022 at 11:57 AM johncohnvt @.***> wrote:

Claude,

Thanks as always for the quick response. That does seem to have fixed things.. It no longer crashes on each observation. I am noticing a few other things which are a little off. I notice that that my attempot to start the speed-camera service in /etc/rc.local is not working anymore.. I have changed the call there to su pi -c "/home/pi/speed-camera/speed-cam.sh start >> /home/pi/sc.log"

and see the following in the log /home/pi/speed-camera/speed-cam.sh ver 6.00 written by Claude Pageau

STATUS - speed-cam.py is Running ... STATUS - PID is 854 INFO - To Stop speed-cam.py execute command below INFO - /home/pi/speed-camera/speed-cam.sh stop Done

I have to start the service manually in ./menubox.sh .. or start it as a service via /home/pi/speed-camera/speed-cam.sh start

The other thing I’m noticing is that it appears to be missing some vehicles as they traverse the field when I watch using the OpenCV screen. I think it may be due to some mounded snow near the edge of the viewing box.. might be confusing the image recognition.

Anyway.. things are looking pretty good. Thanks so much for this excellent project ! -jc

-- John Cohn | team member BETA TECHNOLOGIES (802) 578-0985 1150 Airport Drive South Burlington, VT 05403

From: Claude Pageau @.> Reply-To: pageauc/speed-camera @.> Date: Saturday, February 5, 2022 at 6:10 PM To: pageauc/speed-camera @.> Cc: johncohnvt @.>, Author @.***> Subject: Re: [pageauc/speed-camera] after upgrade speed-cam seems to crash every time a car comes by (Issue #112)

I have released speed-cam.py ver 11.23. The problem may be due to a revised version of user_motion_code.py. You can try deleting/renaming the existing user_motion_code.py and performing an UPGRADE. Sorry for the delay but Internet was out for a while. Let me Know Results

— Reply to this email directly, view it on GitHub<

https://github.com/pageauc/speed-camera/issues/112#issuecomment-1030712256 , or unsubscribe<

https://github.com/notifications/unsubscribe-auth/AWR3VSAUJWMTNGTCVSPSUGTUZWU7DANCNFSM5NUFRARQ

. Triage notifications on the go with GitHub Mobile for iOS<

https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675

or Android<

https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub

. You are receiving this because you authored the thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub < https://github.com/pageauc/speed-camera/issues/112#issuecomment-1030882176 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/ABNPKZGPR2MS2H3MTYRAFNTUZ2ZAHANCNFSM5NUFRARQ

. Triage notifications on the go with GitHub Mobile for iOS < https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675

or Android < https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub .

You are receiving this because you commented.Message ID: @.***>

-- YouTube Channel at https://www.youtube.com/user/pageaucp http://www.youtube.com/user/pageaucp GitHub Repository at https://github.com/pageauc

— Reply to this email directly, view it on GitHub< https://github.com/pageauc/speed-camera/issues/112#issuecomment-1030886301>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/AWR3VSF7WMZCLX5MVLKVAEDUZ23ULANCNFSM5NUFRARQ

. Triage notifications on the go with GitHub Mobile for iOS< https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android< https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . You are receiving this because you authored the thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/pageauc/speed-camera/issues/112#issuecomment-1030886892, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNPKZGZHEM3QUECUIQD5FDUZ24BNANCNFSM5NUFRARQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

-- YouTube Channel at https://www.youtube.com/user/pageaucp http://www.youtube.com/user/pageaucp GitHub Repository at https://github.com/pageauc