Social Distancing is purposely expanding the actual space between individuals to try not to spread ailment. Remaining at any rate six feet from others decreases your odds of contracting COVID-19. We can utilize OpenCV and YOLO to screen/break down if individuals are keeping up social removing.
OpenCV is a library of programming capacities for the most part focused on constant PC vision.it’s an allowed to use for PC vision assignments. OpenCV(Open Source PC Vision Library) is an open source library for PC vision in python. It’s have a different capacity for controlling and work with the Pictures and recordings in python programming language.
It has a many very much improved calculations which incorporates a numerous PC vision and AI calculations. It basically centers around picture handling, video catch and investigation including highlights like face discovery and item location.
YOLO(You Just Look Once) is a continuous item discovery calculation for PC vision. YOLO is a sharp convolutional neural organization (CNN) for doing protest discovery progressively. The calculation applies a solitary neural organization to the full picture, and afterward isolates the picture into areas and predicts bouncing boxes and probabilities for every district.
YOLO is extremely mainstream due to its high precision and the Solitary LOOK ONCE implies that it requires just one forward pass proliferation through the neural organization to make expectations.
- Importing library functions
- Writing “detect_people “ function to identify people
- Parsing arguements and accessing inputs file
- Working with yolo, accesssing the webcam and predicting
1.Importing library function:
Import this lib and modules
2. Writing “detect_people “ function to identify people
Here’s a function called “detect_people” which will take a contentions like edge, net, and ln(layer name). Concentrate the measurements from the casing of a video and make a mass of the casing.
Here, Mass represents Parallel Huge Item and alludes to a gathering of associated pixels in a paired picture. This mass will pass to the CNN organization and afterward yields forecast. Presently set this mass to as a contribution of the neural net and forward one spread pass. Introduce rundown of the containers, centroids and certainty.
Now, extract the all the confidences, classID and centroids from the output. filter out the people class detection from the output. then extract box dimension. Append all to the above list.
Apply the non-max supression for feeble bouncing boxes and return the outcome
3. Parsing arguements and accessing the input file :
A Data parsing library is a set of commands that tells the scarper what to do- how to get the required data and transform it into a convenient ,human-readable format
4.Working with YOLO,Accessing the webcam and Predicting :
- Load YOLO weights from YOLO directory
- Start the video capturing…
- Get the result from detectPeople function
- Get the centroids and measure the Euclidian distance
- Find out if the distance less then some value then put them in the list of unsafe person
- Now put the bounding box of red if the person in unsafe list otherwise green.
- Now display the detection using cv2.imshow() method.
5. Output :
Social Distance detection Using OpenCV and YOLO | Analytics Vidhya (medium.com)