Keywords

1 Introduction

In recent decades, human beings have managed to strengthen their capacities and adapt their different skills in the use of vehicles that allow them to be transported from one place to another immediately, which is why at the moment, the use of two-wheeled vehicles (motorcycles) has been recognized as an affordable means of transportation. However, the human being is subject to compliance and respect for road safety regulations, failing to comply with these guidelines impacts directly on the accident rate and the number of people killed for not respecting road safety regulations [1]. Another reason that impacts negatively on the accident rate is believing that this type of vehicle has been designed to work as a transportation service for passengers, as is currently the case in South American countries, particularly Perú. Nowadays, road safety in business and educational environments is the object of study, due to the impacts it has on fundamental pillars such as human behavior, institutional management, infrastructure, vehicles, and care for victims [2].

That is why, in recent decades, Traffic Accidents (TA) have been one of the ten causes of death worldwide, generating millions of deaths; without a doubt, the most predominant reasons for traffic accidents fall on vehicular congestion, inefficient use of the safety helmet, invasion of restricted lanes, maneuvers not allowed and speeding [3]. On the other hand, no less important, but of great consideration, is that the occurrence of a traffic accident often leads to the generation of road violence, characterizing it as another public health problem. In 2016, low -and middle-income countries accounted for approximately 93% of all road traffic deaths worldwide, the risks of which impacted on injuries and deaths, particularly in male adolescents and young adults [4].

Definitely, traffic accidents have a negative impact on society, the economy and the quality of people’s life. Each year, 1.23 million people die, and this type of events injures more than 50 million. Trends show that these figures may increase over the next 20 years if preventive measures are not taken. In Latin America and the Caribbean, collisions cause approximately 100,000 deaths per year [5], which generates a worldwide social phenomenon due to the high rates of morbidity and mortality that cause premature death due to different injuries and often leave the victims with consequences that temporarily or permanently interrupt their normal life. In this scenario, the occurrence of traffic accidents on motorcycles has stood out in relation to accidents that occur with other types of vehicles, where one of the characteristics with the highest occurrence index is traffic congestion and the inappropriate use of security helmets. Nowadays the number of motorcycles on the street is increasing because it is considered an alternative to fast transport and a means of greater ease of use and displacement. In addition to this, the economic terms have to be considered, its costs of acquisition and maintenance are low. The facts that directly affect the motorcycle fleet are the high accident rates in this type of transport, and the high mortality and morbidity rates that are considerable due to the weak protection mechanisms that the human being adopts while using it. This scenario represents a disadvantage for the motorcycle driver compared to the population that uses four-wheel vehicles, where a better characteristic of protection and integrity of the driver and passengers is expected. Finally, a great impact of two-wheeled vehicles could be capable of generating polytraumatized mirrors, a fact observed from the assistance to motorcyclists in emergency units [6].

It is essential to point out that this problem is highly impacted due to the lack of people awareness and authorities executing a poor application of good practices in road safety or not fully fulfilling their supervisory role. The production of motorcycles has been increasing more and more due to the great demand of South American countries, particularly Perú, Colombia and Ecuador, a situation that leads to proposing new strategies that contribute and enrich the knowledge of the driver in road safety, encouraging the driver to respect the rules, make proper use of a safety helmet and above all to understand that this type of vehicle should not be used as a means of public transport.

Information Technology (IT) must be an integrating link that articulates available means, such as Artificial Intelligence (AI). The application developed makes use of the OpenCV free artificial vision library and the learning algorithm called LinearSVC [7], achieving a globalized labelling in the entire object of a cyclist, both in the bicycle and in the person. The label of the cyclist should define if he wears a safety helmet or not, but this is a contribution that is limited to the current reality of the confluence of users who travel on motorcycles, therefore it is required a greater precision and mastery of the problem. In auditing activities mainly, IT can help to generate a higher rate of awareness in population.

These new challenges of the described reality are closely related to the development of an intelligent system that allows taking advantage of the available data and information sources. Classical statistical models, which were useful for making predictions a few decades ago, have limitations in this new context. Computational intelligence methods have shown excellent prediction accuracy in different areas in recent years. [8]. These methods are robust and tolerant to uncertainty, and can learn the most relevant features of the considered data to provide an accurate forecast, thus providing excellent results by excluding non-relevant information and focusing on the most useful data [9]. Currently there are security cameras that perform easy recognition and even reading of the license plates of vehicles that circulate through the streets of a city, however, it has not been seen this strategy used on the motorcycle driver to determine if he carries or makes proper use of a safety helmet, allowing the user to analyze, evaluate and determine clearer and more specific factors on the increase in accidents or people killed by driving this type of vehicle.

The identification of motorcycle drivers who make adequate and inappropriate use of safety helmets will contribute to propose new educational strategies in road safety, as well as carrying out immediate control through the detection of offenders who drive motorcycles without a safety helmet. However, the educational institutions must help to generate better habits of commitment and safe behavior on the road, because road safety is transversal in any sociocultural context. The detection of objects that contribute to road safety has become increasingly popular, however, images with visible light require stable lighting conditions to guarantee good performance, on the contrary, night images can represent certain limitations as well as long-distance detection, so we believe that YOLOv4 could fill these gaps and have effective results [10].

This research aims to make use of artificial intelligence through YOLO (You Only Look Once), an emerging image detection algorithm [11] through which motorcycle drivers who drive with and without a safety helmet will be identified. YOLO can be considered a fast, modern and economical tool [12] with a technological impact that contributes to society and particularly to public and private institutions that promote road safety and carry out inspections for identifying people who doesn’t comply with the regulations established.

2 Related Work

Previous research has been carried out with the purpose of identifying offenders who don’t comply road safety regulations, by using deep learning algorithms and in their context, applying artificial intelligence.

Valencia et al. developed a study whose purpose was the detection of infractions and license plates on motorcycles, through artificial vision, with the purpose of providing a tool for traffic officers in the detection of three types of infractions by motorcyclists: not wearing a helmet of protection; circulate in prohibited areas; and using racks in places where it is not allowed. The results expressed an accuracy of 87.5%, in addition to proposing for future work the creation of a classifier using YOLO for the detection of helmets, seeking to train the algorithm so that it can identify them and thus optimize the detection method by mean of [13].

Espinosa et al. designed EspiNet V2: a deep learning model, which is also used for the detection of motorcycles in urban environments, where there is some level of occlusion. EspiNet V2 outperforms popular models like YOLO V3 and Faster R-CNN. However, it is vital to keep in mind that YOLO has evolved with new performance patterns, so it is necessary to carry out tests on versions higher than YOLO V3 in order to know the response capacity in this type of scenario [14].

Zheng et al. conducted a research called an approach to moving vehicle counting and short-term traffic prediction from video images based on deep learning. The results express that the activation function of YOLOv4 demonstrates smooth, non-monotonic characteristics and no upper limit, considering that the computational complexity is higher than the complexity of ReLu in YOLOv3, its detection effect is improved [15].

Rodriguez et al. evaluated the analysis of statistical and artificial intelligence algorithms for real-time speed estimation based on vehicle detection with YOLO, which has proven to be part of the machine learning methods with acceptable performance compared to statistical algorithms [16].

Previous work show that the YOLO v4 application provides reliable application characteristics for this type of study and for the various scenarios that are linked to road safety.

3 Methodology

For the identification of motorcycle drivers who drive with and without a safety helmet, seven phases have been proposed, as shown in Fig. 1.

Fig. 1.
figure 1

Methodology

3.1 Determine the Data Source

In recent years, humanity has witnessed the great proportionality of data that travels through the network, where many of them are usually effective and helpful, especially for the development of applied and basic research that contributes to the knowledge management. However, there is a piece of information known as infotrash, which generally produces biases in the great diversity of research work. The abilities of the human being have been strengthened every time better, that in principle it has been possible to learn to discern and value the information that surrounds us, however, to determine the source of data, a slow and permanent search was carried out through different search engines, particularly Google, where photographs of people who are driving a motorcycle have been identified and among them the state of use of the safety helmet can be differentiated. In addition to this, photographic shots have been taken in the region, province and district of Piura in Perú, with the aim of strengthening the data source and being able to effectively and accurately detect people who drive a motorcycle with or without a helmet.

3.2 Photos Sorting

In this section, it was carried out the classification of the photographs obtained through field trips in the district of Piura, Perú and it was complemented with photo-graphs located in search engines and social networks. Criteria such as 1) adequate approach, 2) visibility of the safety helmet, 3) schedule and 4) traveling through streets or avenues have been taken into account. This classification will make it possible to carry out a first test on the identification of motorcycle drivers at peak hours in the city, taking as a reference the peak hour of the motorized flow that normally occurs in the hours from 07:00 to 07:30, 12:30 to 2:00 p.m., 3:30 p.m. to 4:30 p.m. and 6:00 p.m. to 8:00 p.m.

3.3 Photos Categorization

The categorization of the photographs is one of the fundamental phases, because at this point the manual, visual and own criterion identification is carried out through the Labellmg tool, as it is considered as the means of graphic annotation that allows labeling delimited boxes of an element or object. Therefore, LabelImg will contribute to the categorization of the images that will be used in the YOLO model, as shown in Fig. 2.

Fig. 2.
figure 2

Image categorization

Figure 2, through segment (a), represents the categorization of motorcycle drivers who use safety helmets, while segment (b) characterizes two people who do not use safety helmets, activity that has had to be carried out continuously and according to criteria in the evaluation process of each of the photographs available for this investigation.

After the categorization of the images, the coding of a Python script was devised, whose stages are represented in Fig. 3.

Fig. 3.
figure 3

Coding phases for image segmentation

The stages defined in Fig. 3 allow for a segmentation of 287 images whose characteristics are represented in Table 1.

Table 1. Characteristics of the images

60% of the images were for training, 35% for validation and 5% for testing, as shown in the script in Fig. 4.

Fig. 4.
figure 4

Python script to segment data

It is essential to make use of programming techniques to be able to segment the data [17], taking into consideration that, if this activity would be carried out manually, there would be no impartiality, being judge and party in the ordering of the data, that is why it was believed convenient that this action be carried out through computational methods, the same ones that they are described in Table 2, on the interpretation of Fig. 4, for a better reason on the use and application.

Table 2. Interpreting the image segmentation script flags

3.4 Development Environment

As a development environment, it was determined to use the Google Colab online platform, due to its accessibility and ease of writing Python code through the web browser [18], being the only requirement to have a gmail email account.

In this context, it is important to mention that other features that enrich this plat-form is that it is possible to analyze, visualize and import a data set in real time in order to train the classifier and evaluate the model. Colab notebooks run code on Google cloud servers, this means that regardless of the capacity of the computer, the power of Google hardware can be used, including Graphics Processing Units [19] and Tensor Processing Units (TPU), in order to perform various activities through a simple browser [20].

3.5 Model Coding

The proposal was framed in making use of version 4 of YOLO, whose algorithm al-lows to effectively simplify the parameters of a model and achieve a more precise detection [21], that is why this research proposes a novel identification method because it is light and fulfills the principle of deep learning [22]. For the successful encoding of the model, seven phases were established, as shown in Fig. 5.

Fig. 5.
figure 5

Phases for model coding

The execution of Fig. 5, starts by accessing the Google Colab platform and then establish the permissions so that the Notebook created in Colab can access the data source that is stored in Google Drive, the space where the segment was made according to Fig. 4. The execution environment was in GPU mode, a special feature for graphic purposes and that contributes to the process of downloading and configuring the objects that will allow the detection of the established symbology and the identification of motorcycle drivers who use the safety helmet correctly and incorrectly, as shown in Fig. 6.

Fig. 6.
figure 6

Coding of the key phases of the model

In the fifth phase, the configuration of the environment for the execution of YOLO was carried out, a characteristic that must be established in a uniform way, knowing how to assess the patterns of the GPU for a standardized training execution. For this reason, in the sixth phase, the model was trained and according to the number of images it consecutively generated a series of interactions, which took from 6 to 8 h to have an effectively trained model. For this study, the waiting time demand was 4 h and 49 min, reaching 3,200 thousand interactions and a training exchange of 17,200 images.

Hosting the images through Google Drive has been fundamental for the training of the model, due to its easy access and fast start-up and execution process, considering that stable and permanent access to the internet service must be available to channel a successful training. In addition to this, it is important to note that the Google Colab platform has free access for daily handling that goes from 6 to 12 h, so it is necessary to take into account that if we have a large volume of data (images) to carry out the training, we must anticipate that the execution time does not exceed the time provided, otherwise a Google Colab Pro package must be obtained, in order to access to a greater execution capacity and a better time for the development of this type of activities related to computational vision. YOLO v4 has shown to have the capacity to develop this type of activities, particularly about the training of the model that has a fast recognition speed in initial tests and a high accuracy [23].

As it is known there are different versions of YOLO, but in this context YOLO v4, shows an excellent role compared to YOLO-D model which also has great potential for accurate detection, but the speed is slightly slower than YOLOv3, YOLOv4 and YOLOv5 [24].

3.6 Quality Control

To determine the efficiency of the model, quality control was carried out where the information scenario corresponds to 5% of the images used as a test, characterized in 14 images. However, 30 additional images were considered, the same ones that have been considered as “foreign” because they were obtained through field activities, which allowed reaching a total of 44 images evaluated through the script encoded in Fig. 7.

Fig. 7.
figure 7

Coding for the execution of quality control

This activity allows us to know a certain degree of efficiency of the model, in this specific research with the 44 images has provided very promising results. However, the sharpness of the images plays a fundamental role for the model to make the appropriate identification and do not confuse objects that might look similar to a safety helmet, such as hats. In Fig. 8, we observe some of the images evaluated with results that demonstrate a high coincidence and efficiency index of the trained model, this can still be improved in order to perform remote or real-time detections through digital media connectivity as video surveillance cameras that are installed in the most transitable areas of a city [25], knowing that YOLO is a scalable single-stage object detection algorithm and has good real-time performance [26].

Fig. 8.
figure 8

Quality control results

3.7 Validation and Deployment

In this last phase, 44 images were validated, taking into account that 14 of them are motorcycle drivers who are not wearing a safety helmet, 18 with a safety helmet and 12 with mixed qualities, where the pilot wears a safety helmet and the passenger does not have the aforementioned accessory. Figure 9 expresses an average precision of 89.88%, Fig. 10 of 90.5% and Fig. 11 of 90.87%.

Fig. 9.
figure 9

Accuracy of 14 images validated without a safety helmet

Fig. 10.
figure 10

Accuracy of 18 validated images that have a safety helmet

Fig. 11.
figure 11

Accuracy of 12 mixed images with and without safety helmet

In this context, the validated images have showed satisfactory results; however, Fig. 12 has an accuracy of 89.5% because in the recognition of the image, it is possible to detect a person who uses a green cap green and there is also agglomeration by people, resulting as dispersion that weakens the results of the model.

Fig. 12.
figure 12

Comparative on the result of a validated image

4 Results

As part of the main training results, it is demonstrated that the model has an accuracy of 89.5% for the detection of motorcycle drivers who wear the safety helmet correctly. Nevertheless, the model’s accuracy for the detection of drivers who do not use a safety helmet while riding a motorcycle is 87.8%. In this context, the model ex-presses an average accuracy of 88.65% regarding the efficiency on the identification of motorcycle drivers who make or not an adequate use of safety helmets while moving around a city. It is important to keep in mind that the author seek to improve the conditions of the model not only in time, but also in more accurate results,

The OpenCV and sklearn technologies have showed good results in similar investigations; however, one of the shortcomings is the precision in identification of elements and objects, because if we need to recognize the face of a person we would need images that only involve this type of composition, yet through YOLO and the use of the LabelImg tool, it is carried out the label and framing of the object or element to be classified, which demonstrates a better dosage of time and optimization of resources. For this reason, this research seeks to demonstrate that there are new technologies as alternatives to local resources for the development of products that could contribute to society and the management of economic proposals that could easily be implemented by small cities that seek to integrate models that articulate their ser-vices and contribute with them to decision making in real time.

On the other hand, one of the most important factors has been to know the behavior of the model for images that have been taken at different times of the day, such as morning, afternoon and night, that is why Fig. 13 shows that this type of scenarios has not been an obstacle for detection because good results have been obtained. It is necessary to recognize and consider that this type of vehicle can be seen at any time of the day on the streets, allowing to project an identification and evaluation in real time [27].

Fig. 13.
figure 13

Results of photographs at different times of the day

The method used in this study was able to obtain a better balance between detection performance and detection speed, by making use of platform services with greater hardware capacity such as Google Colab Pro [28]. In addition, the classification accuracy on the correct use of the safety helmet can be greatly improved with the help of transfer learning [29].

The identification proposed in this research is key to reduce the risk of death by accidents caused while motorcycle driving, as reflected in the country of Thailand which permanently monitors trafficability on the roads of the city as an essential process for the intelligent management and control of highway traffic. With the wide-spread use of surveillance cameras, it is possible to strengthen a wide library of images not only referring to the subject addressed, but also to monitor the possible behavior of the driver [30].

In recent years, with the rapid development of deep learning, computer vision (CV) has been widely used in facial expression recognition, disease diagnosis [31] and even in cattle counting by making use of unmanned aerial vehicles However, deep learning has not been immersed in the development of capacities that promote road safety and good information technology practices that will generously contribute to strengthening a city's transit system. At the same time, it is important to note that CV techniques have boomed and many classic object detection methods have emerged, including one-stage, two-stage, and non-anchoring algorithms such as Faster RCNN [32], RetinaNet, YOLOv3, YOLOv4, YOLOv5 and YOLOv5x. Still, we should know that the existing algorithms for detection are divided into two classes, where one is the real-time detection method that pursues fast inference speed, and the other is the high-performance detection method that prioritizes accuracy of the image or video [33].

After having experimented with YOLOv4, the author is working on new proposals in order to seek the safety and precision of the model, being the main reason why the use of the YOLO-V5x version has the highest average detection per image among the models before mentioned by having a greater number of layers in its network model [34].

5 Conclusions

In the present research, the YOLOv4 algorithm was used to detect motorcycle drivers who wear a safety helmet and those who do not use a safety helmet while traveling in their vehicle. The results show us that the trained model has a detection efficiency of 88.65%.

Regarding the use of images used for model training, it is emphasized that, in order to strengthen the model, it is necessary to train the model with a greater number of images, taking into account that in this research it was carried out with 287 images, where 60% of the images have been for training, 35% for validation, 5% for tests and additionally 30 images were considered as part of the foreign tests, having a total of 331 images that allowed knowing the development of the model in its precisions and inaccuracies.

The 44 test images have represented a greater precision and approach in their results, which allows to know more closely the behavior of the model, especially when images are available at different times of the day, particularly at night where it evades the use of a safety helmet, due to the limited visibility of the human being. It is necessary that, during the process of categorizing the images, those people who use caps and hoods that can limit the veracity and precision of the model are also valued.

YOLOv4, responds very well in the detection of objects on images that are taken at different times of the day, an achievement that favors the authorities and above all to promote the use of these computer vision techniques, strengthening through information technologies the compliance with safety standards that allow guidance and supervision of motorcycle drivers who make inappropriate use of this means of personal transportation.

Future research related to road safety are invited to make use of YOLOv5x, as it is a more flexible version and allows integration with technologies that lead to the development of an online platform that integrates the inspection service for bad drivers and this is one of the main factors to the development of smart city, improving the cultural habits and quality of life of the population that resides in a geographic space. The management of new methods and strategies that exploit local technology and that contribute to the road safety sector should be promoted, which by lukewarm measures, daily impacts people's lives who don’t respect the rules and laws established by the authorities.