nguyendodangquang / Social-distancing-and-facemask-detection

Social Distancing and face mask detection in real-time using Yolov4 & Yolov4-tiny. Come with a management website (using Streamlit). Can send alert to SMS and email.
0 stars 0 forks source link

ValueError: attempt to get argmax of an empty sequence #1

Open kt140899 opened 2 years ago

kt140899 commented 2 years ago

ValueError: attempt to get argmax of an empty sequence Traceback: File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\streamlit\script_runner.py", line 354, in _run_script exec(code, module.dict) File "c:\Users\Admin\Desktop\1\Social-distancing-and-facemask-detection\app.py", line 187, in classID = np.argmax(scores) File "<__array_function__ internals>", line 5, in argmax File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\numpy\core\fromnumeric.py", line 1195, in argmax return _wrapfunc(a, 'argmax', axis=axis, out=out) File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\numpy\core\fromnumeric.py", line 57, in _wrapfunc return bound(*args, **kwds) can you help me pls !

nguyendodangquang commented 2 years ago

Hi, you get ValueError: attempt to get argmax of an empty sequence because if there is no object in the picture/camera, the score will be empty. You can deal with it with Try and Except wrap around it or use condition if scores: to get argmax if only scores value is not empty.

kt140899 commented 2 years ago

Chào a, e rất thích đề tài này mà bị lỗi phần như trên. A có thể giúp e fix bug phần này đc k ?. E cảm ơn ạ !

kt140899 commented 2 years ago

You can download weights for face mask detection here: https://drive.google.com/file/d/1rVnBIqvlinL2BUONjOaFDj8PM9Yw4k1q/view?usp=sharing

A ơi file bị lỗi a có thể reupload đc k ?