Research Article

Safety Helmet-Wearing Detection System for Manufacturing Workshop Based on Improved YOLOv7

Algorithm 1

Algorithm of helmet-wearing detection.
Input: Input video monitored from a camera
Output: Result =Hemlt / Head (Alarm sounds)
Begin
for each clip in video do
Result=’Hemlt’ # set default value
objects=getDetectionBox(clip) # get getDetectionBox by YOLOv7_ours
for xywh,conf, cls in objects # conf is the confidence of bounding box
   objectname =“
   warningtext=“
   if cls=’Head’ and conf >0.7 then
     face =getFaceLocation(xywh) # Calculate face coordinates
     objectname= faceRecognition(face)
     warningtext=createWarningText(objectname) #generate alert message
     textToSpeech(warningtext) # broadcast warning
     Result=’Head’
   end if
   writeLogAndDatabase(clip , xywh , conf , cls , objectname , warningtext)
  end for
end for each
End