A Novel Extension for e-Safety Initiative Based on Developed Fusion of Biometric Traits

Safety is one of the central elements of society functioning. The eSafety aims at increasing road safety through the use of intelligent integrated safety systems. This article presents the concept and PCB implementation of an on-board compact eCall device that can be installed at the owners’ request in a used vehicle. The prototype includes accident and rollover detection, passenger detection, and GSM communication with the eCall PSAP service center. Two accident detection algorithms are implemented: the first relates to the collision detection based on exceeding the threshold of acceleration using an accelerometer to measure the dynamic force caused by movement and the gravity force, the second – the rollover detection based on exceeding the threshold of the vehicle angle of inclination using data coming from the accelerometer and a gyroscope. The prototype was tested in eight different test scenarios using laboratory accident simulators as well as during driving. The proposed solution of passenger detection is based on images coming from a built-in 360° view camera. In the authors’ approach the obtained images were transformed into linear ones and subject to subsequent operations – initial processing, object detection and redundant detection filtering. The authors utilize biometric methods in object detection such as Viola-Jones and Single Shot MultiBox Detector for face localization, and You Look Only Once for whole body detection. An additional testing mechanism for passenger detection are seat pressure pads that are independent of camera detection. All necessary sensors and communication components verified by practical experiments have been integrated on the custom designed motherboard with the NVIDIA Jetson Nano processing module installed. The tests confirmed the performance is sufficient for rapid accident detection, real-time image analysis and all mandatory eCall communication functions. Results of experiments were promising, providing high accident and passenger detection rates.


I. INTRODUCTION
In transport the most important and relevant should be human health and passenger safety. In fact, transport entails not only cars or bicycles but also planes and ships. However, on the basis of the statistics it can be claimed that more people die The associate editor coordinating the review of this manuscript and approving it for publication was Marina Gavrilova . in roads accidents than in any other transport crashes (it is true even in the case of planes). Moreover, the data published by World Health Organisation (WHO) has shown that only in 2016, around 1,35 million people died on the roads, whilst another 50 million were seriously injured [1]. Due to these facts, European Commission (EC) created eSafety program for reducing the number of road accidents victims. Its main point, given in [2], was to create automatic system for sending VOLUME 8, 2020 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ information about serious road accidents or collisions. One might ask how such a system works. Its main goal is to detect collision. After that, it should send information about the accident (the location of the place where the event occurred) to the nearest Public Safety Answering Point (PSAP). Any of the passengers has a possibility to cancel the call if they are sure that the collision was not serious and no one needs emergency services help. After getting the information about the crash, the operator immediately sends rescue services to the scene. Due to the European Union directive, this system is mandatory for cars approved for sale after April 2018. There is still a problem however: the average age of motor vehicle in EU is about 11 years [3]. Because of that, the occupants of such cars seem to have smaller chances of avoiding serious consequences of accidents due to the fact that their vehicles are not equipped with the eCall notification system. To meet the needs of users of older vehicles, the authors created an on-board compact eCall-compliant device that can be easily used (in the form of additional unit) in cars that are not equipped with this system by default. The authors, in addition to meeting the eCall system requirements, i.e. detection of an accident and sending data using the eCall protocol, introduced an additional functionality -an indication of the number of the vehicle occupants at the time of the accident. This work is based on the authors' previous publications [4]- [7]. In this article those particular works and approaches are generalized and extended with further details, regarding among others: 1) details on experimental accident simulation and accident data gathering using mounted eCall prototype devices and two accident simulators, created by the authors, 2) extended state of the art for human presence detection (in a vehicle) and details on selected approaches as well as used hardware and excerpt of detection results obtained. This work is organized as follows: section II briefly describes the idea of compact eCall device. Section III analyses state of the art regarding accident detection. Section IV expounds developed laboratory environment for accident detection. The needed information regarding collisions are collected with two hardware accident simulators built by the authors. Section V presents current knowledge of human incar presence detection and the problem related to sending the number of passengers with eCall protocol. The experiments concerning detection of passengers in the car are recounted in section VI. Section VII describes the PCB prototype of the proposed device. The proposed solution consists of: passenger detection using single camera and seat pressure sensors; accident and rollover detection by the internal sensors; GSM communication with eCall service centre PSAP. Section VIII describes comparison with similar commercial (or possibly commercial) devices. Finally, conclusions and future work are presented in section IX.

II. THE CONCEPT OF COMPACT eCall DEVICE
The earliest notification of the emergency services of the event determines the survivability of the accident. However, European Parliament's regulation applies only to the newly produced cars. Hence, the authors of the paper's idea is to design a compact system that could be installed in any vehicle. This would allow every car user to rely on the extra safety that it provides, for a relatively small price. The scheme of the system depicted in Fig. 1 is a general view of the device's operating concept and design.
In case of serious road accident the device installed in vehicle automatically dials 112 and sends a 160 bytes package containing basic information about vehicle and accident location to Public Safety Answering Point (PSAP). This package, called Minimum Set of Data (MSD) [8], can also include other information previously gathered by specialized sensors installed inside the car. Such information can help rescue services locate and provide medical and life-saving assistance in shorter time.
The main and the most important module is the accident detection module. Its task is to launch the entire notification procedure for the relevant service in case of road accident.
The key problem here is determining how to define and how to identify the accident (the devices and parameters used). Manual triggering should be also possible. The following situations describe the use cases: (1) the accident is not serious enough to trigger the sensors, (2) there is no collision, but occupants gravely need help, (3) the occupants are witnessing an accident and want to inform the eCall services about it.
The next module is the communication module that sends gathered data, such as vehicle data, vehicle location and driving direction to the PSAP center upon request. Additionally, the device should enable establishing a voice call with the PSAP operators, allowing them to contact the victims.
Another module of the system is designed to recognize the situation inside the vehicle. Its main task is to detect presence and number of vehicle occupants. It could actually be performed before the accident occurs -registering when the passengers occupy or leave the seats -to know how many people were in the vehicle at the time of the accident. In addition, post-event monitoring may be provided to inform eCall operators when occupants have left the vehicle (or, for example, been thrown out if a collision has occurred and they have not fastened their seatbelts). Further work will examine the practicality of such a solution.
The proposed system should be equipped with a GPS vehicle positioning system, set of sensors such as accelerometers, gyroscopes, pressure sensors, temperature sensors and sound detectors (for accident detection), a set of sensors to detect vehicle occupants presence such as digital camera, speech recognition or pressure sensors. To increase the reliability of the information provided by the system, the number of individual sensors should be multiplied.

III. STATE OF THE ART IN ACCIDENT DETECTION
The key element of the described system is a mechanism which determines whether an accident has occurred or not. The mechanism turns on other components of eCall system and also initializes the rescue operation. The whole structure should be highly reliable i.e. no false notifications.
However, the most crucial task of the whole system is to protect human health and life; therefore system is allowed to notify Public Safety Answering Point (PSAP) in case of a minor accident. In this case, a voice connection between PSAP staff and accident participant is established [9]. Based on the voice conversation PSAP operator determines whether rescue operation has to be conducted or not. However, fundamentally, data transfer in eCall system must be automatic. Therefore accident detection mechanism is the obligatory part of the system. It consists of two parts: hardware, which consists of broadly understood motion sensors and software, which consists of data analysis algorithms and decision algorithms.
Authors of this article decided that their mechanism can work independently from on-board systems of the car. That particular approach creates possibility to equip with such mechanism cars of a different age (even very old), not only those newest ones which are fitted up with advanced sensors. Such versatility complicates selection of hardware platform and complexity of algorithms because it is crucial to note that accident detection decision must be made without any information gathered from on-board systems of the car such as belt fastening or airbag release status.
Considering the aforementioned, the authors decided to consider to use a vast range of sensors and data fusion algorithms. As a source of the information, the following types of devices and sensors are selected: accelerometers, gyroscopes, pressure sensors, temperature sensors and sound detectors.
Accelerometers are the most common components of collision detection systems [10]. They respond to sudden/rapid changes in the rate of movement (acceleration and/or delay) by measuring them in units g -the magnitude of the acceleration. It has been assumed that they would be placed in several places of the vehicle. The use of a single element can generate unwanted activation of an alarm signal caused by, for example, a point strike near a sensor or a sudden strong shake of a vehicle when it got on an obstacle on the road (hole or bump). Accelerometers are useful to determine whether the vehicle is struck by a permanent obstacle or another vehicle. But there are many possible accident scenarios [11], including the situation of vehicle overturning/rollover or being flipped on its roof. Delays occurring in such cases are considerably shorter than on impact and the decision based on the data provided by accelerometers can be false (the accident would be not noticed). The proper sensor in such situation is the gyroscope [12], which identifies the phenomenon of rotation of the vehicle in each of the axes of the classical reference system x, y, z.
In most publications [13], [14], accident detection systems are based on the use of the accelerometers and gyroscopes. Due to the diversity of accident situations, in practice unpredictable, the authors have decided to use additional pressure sensors and sound detectors. Pressure sensors are useful during rapid increase of pressure in the cabin. This phenomenon is accompanied by explosions. Such situation may occur when accident was not serious (neither high values of delays nor the rotation of the vehicle appear), however, fuel tank might have been damaged and fuel may have been ignited. That might lead to an explosion that pressure sensors and temperature sensors easily detect. Car structure deformation is the result of a vast number of car accidents. Detection of this deformation can be performed by a specialized sound detector aimed at detecting the specific sound of crashed metal.
The paper [15] proposes a deep learning based Internet of Vehicles (IoV) system called DeepCrash, which includes a collision detection sensor consisting of an accelerometer and a gyroscope, a camera, a cloud-based deep learning server and management platform. When a vehicle collision is detected, an information with visual data is transmitted to the cloud-based database server for vehicle accident recognition and a related emergency notification is provided. In paper [16], a multi-sensor decision fusion algorithm for collision detection and airbag deployment in a vehicle was presented. The accelerometer was mounted on vehicle engine as well as a load-cell located on the driver shoulder-belt. Crash detection is based on Kalman filters and a Cumulative Sum Control Chart (CUSUM).
The methods of accident detection using smartphones were developed in [17]- [22]. In [17] data from an accelerometer was combined with gyroscopic information and sound samples from microphone. It was shown that high-amplitude sound wave can be indicated when the energy triggered by an impact is converted to the vehicle body damage. In [18] an accident detection method was proposed which utilizes speed variations, vibration and acoustic waves monitored by the smartphone. In addition, it uses an analytical model to detect accident. After incident detection, mobile application VOLUME 8, 2020 informs the rescue teams, police and relatives. In work [19] an Android application was designed for the detection of accidents. After detection, a plan of action is initiated including locating a nearby hospital using GPS and notifying the emergency department and the family contacts of the victim. The main problem considered in this paper is using fog computing system built from IoT nodes as a proxy to cloud system to reduce the latency from accident detection time to the emergency notification. The works [20] and [21] present a smartphone applications for crash detection based on visual information and image and video processing. The main disadvantages of these approaches are significant increase of the overall processing time and noticeable level of false positive and false negative results. An intelligent system which uses mobile edge computing to detect traffic accidents using a smartphone was proposed in [22]. The acceleration and speed of vehicle are analysed and images showing accident scenes are identified. However, smartphone utilizes existing datasets and is vulnerable to errors.
The vehicle rollover is a very serious traffic safety problem, which is responsible for the large amount of total passenger fatalities. For that reason, detection of rollover occurrence is a very important issue especially when determining the scale of an accident. In the paper [23], the rollover detection metric labeled LTR d is described, which is a dynamic approximation of LTR (load transfer ratio). The LTR can simply be defined as the difference of vertical force between the right and left wheels of the vehicle normalized by the total load. This parameter varies between -1 and 1, and for a perfectly symmetrical vehicle that drives in a straight line it is equal to zero. The minimum and maximum are achieved when the wheel is unilaterally detached, in which case the LTR becomes 1 or -1 depending on the tear-off side.
All above mentioned sensors only gather information that is later used to determine whether accident happened or not. Sensors are not programmed to invoke alarm notification to the PSAP. Hence, it is crucial to develop decision mechanism, which can analyze information gathered with the use of sensors and generate information (MSD) about accident that is sent to PSAP. Such algorithms are used in newer cars for airbags and air curtains systems, however, they cannot be directly used for eCall system. It is because they are programmed to be used before accident [24] (to prevent passengers from being hurt) but eCall demands information after the accident. The objective of the proposed compact eCall-compliant device is to be used after accident. The simplest way to use sensor data is to set threshold values that determine if an accident has occurred. However, vast number of articles points out that such method is inaccurate. The authors undertook the task of creating accurate data analysis and decision algorithms which will use data from different types of sensors with the use of data fusion techniques. The expected outcome are algorithms that can be used to determine with a high accuracy if accident occurred in immense number of circumstances.

IV. LABORATORY ENVIRONMENT FOR ACCIDENT DETECTION SIMULATION
Laboratory accident simulators were built for acquisition of sensor data, which could help in selection of most suitable sensors. The second purpose of building the simulators was to test algorithms for the accident detection in terms of impact and rollover.

A. EARLY STAGE ACCIDENT SIMULATOR
The first impact simulator has two main parts: a pendulum and a trolley. The operation consists in rising the pendulum to a fixed angular position (10 -90 • ). Adjusting the pendulum position allows changing the impact force in the rear of the trolley, where the tested device is placed. After the hit the trolley achieves rapid acceleration and moves along the sliding mechanism. This machine allows only simulation of impact in a non-moving car, but it was sufficient at the early stage of sensors and accident detection testing. This impact simulator was precisely described in paper [4].

B. ADVANCED ACCIDENT SIMULATOR
The advanced accident simulator was shown in Figure 2. The main parts of the second laboratory set are: a steel frame (13) on blocked wheels (14), rubber expanders (3), a sliding mechanism (4), a trigger (2) that releases a pusher element (1), a trolley (5) with rotating platform (6) and a crash wall (7). All potentially dangerous parts of system are protected by covers (15) during a test. The first operation is mounting the prototype device (10) on platform. Next operation is manual tensioning of the expanders and immobilizing them in the trigger mechanism. The force can be adjusted by increasing or decreasing the number of expanders or attaching expanders to different handles (12). After releasing the trigger, the pusher element starts to accelerate rapidly along the sliding mechanism towards the impact wall. The trolley is accelerated together with the pusher and moves forwards (11). The simulation of the accident can be extended by the rollover effect caused by automatic triggered rotation of the platform with the tested device. It is achieved using a swivel bar (8) mounted on the protection construction (9) which can release the rotating platform. Next, the trolley hits the wall with impact force which depends on number of used expanders. The advanced impact simulator was more precisely described in work [7].

C. ACCIDENT DETECTION SYSTEM
Two detection algorithms were implemented in described system. The first one is an algorithm for collision detection, the second one -for rollover detection. The first algorithm uses an accelerometer to measure the dynamic force caused by movement and the gravity force. For reader's convenience the acceleration obtained from the sensor mounted to a rigid body can be described with following equation: where a -acceleration, m -mass of body, F -total force, F g -gravity force. Proposed algorithm is based on exceeding the threshold of acceleration (deceleration) for collision detection. When the magnitude of acceleration is higher than the threshold, device indicates an accident. The magnitude can be expressed using the following formula: where: M -magnitude of acceleration vector in two axes, a y -x-axis acceleration, a y -y-axis acceleration. The second implemented algorithm is dedicated to rollover detection. The method is based on exceeding the threshold of the vehicle's angle of inclination. The two continuous measurements of the vehicle inclination angle are performed in two axes: X and Y for the rollover detection. The data used in calculations comes from the accelerometer and gyroscope.
The data derived from the accelerometer is converted to the angle values using the following formulas based on atan2 function: where: α x -roll angle, α y -pitch angle, a x , a y , a z -acceleration values in three axes and function atan2(y,x) returns the argument of the complex number x+iy.
In case of data derived from gyroscope, the angular position is calculated using angular velocity integration over time as in the following formula: where: α -angle, ω -angular velocity.
In numerical calculations, the gyroscope data is converted to the inclination angle using following formulas: where: α x -current roll angle, α y -current pitch angle, α xn−1 -previous roll angle, α yn−1 -previous pitch angle, G x -current x-axis angular velocity, G y -current y-axis angular velocity, f -the frequency of sampling. Finally, for each axis, the calculated angles are combined with each other using the following first order filter: where: α G -angle derived from gyroscope data, α A -angle derived from accelerometer data. The main problem of the second method is the gyroscope drift, which generates an error increasing over time because of integration. For this purpose it is planned to apply the Kalman filtering instead of simple low-pass and high-pass combined first order filter.
For the final version of the system two sensor devices were applied. The first one was a large range accelerometer H3LIS331 (up to 200 g) and the second one was the IMU LSM6DS3 chip which includes an accelerometer with a small measuring range (up to 8 g) and a gyroscope. Single accelerometer with a small measuring range does not give real acceleration values in real high impact collisions because the results will exceed the measurement range. On the other hand, the scale of the accident will be determined using the maximum value of acceleration, so the large range sensor will provide correct data in case of exceeding the range of the first accelerometer. The large range accelerometer at rest position and during normal drive indicates a large value noise (although close to measurement uncertainty) and it could activate a false alarm. For the above reasons, an accelerometer with a small measuring range is used in the case of normal driving, but if the threshold of accident detection is exceeded -a large-scale sensor must be used to determine the accident severity. To establish the scale of the accident the Acceleration Severity Index (ASI) [25] can be used in the future research.
The data acquisition process and sensor handling procedure in developed detection system are presented in figure 3. The main step of the procedure is a measurement request, which is related to the communication with the sensors. After new data occurrence, the appropriate flag is activated to inform the system about new data received and procedure goes to the acceleration and angle calculation step. After calculations performed with above described formulas, when the calculated values exceed the thresholds, the procedure appropriate for accident detection is started -information about the accident is queued to the external application and the appropriate flags in memory are set.
The main loop in the algorithm maximizes the frequency of measurement updates provided by sensors. In current detection system version, it was possible to achieve a frequency above 400 Hz using two sensors connected with I2C bus. The higher frequency of data acquisition is possible; however, it requires additional work on optimization of the current communication procedures.

D. ACCIDENT AND ROLLOVER DETECTION RESULTS
The prototype device was tested in various test scenarios. Eight test scenarios were prepared and several tests were performed for each of them: • low speed (5 expanders) front impact without rollover, • high speed (9 expanders) front impact without rollover, • low speed (5 expanders) rear impact, then front impact without rollover, • high speed (9 expanders) rear impact, then front impact without rollover, • low speed (5 expanders) front impact with rollover, • high speed (9 expanders) front impact with rollover, • low speed (5 expanders) rear impact, then front impact with rollover, • high speed (9 expanders) rear impact, then front impact with rollover. The data from all the sensors, such as acceleration values from two sensors (with large and small scale) and the calculated rotation angles around the X axis (roll angle) and the Y axis (pitch angle), was monitored during all test time. The correct operation of the system has been determined using impact and rollover indicators. As the threshold values, an acceleration of 4.5 g was set for the impact detection and a roll angle of 60 • for rollover situation. The experimental results from considered scenarios were shown in tables 1 and 2, where M 1 and M 2 are average magnitudes of deceleration during impact (measured in g), accordingly obtained from H3LIS331 and LSM6DS3 sensors, roll and pitch angles of rotations are measured in degrees and Acc.det. and Roll.det. are the numbers of indicated accidents and rollovers.
In all examined test scenarios (39 cases), the collision was correctly detected. All cases of rollover (18 cases among the 39 cases) were also correctly detected. The maximum value of the acceleration during impact depends on the initial speed (the number of expanders used), so this parameter can be used for accident scale estimation. The gyroscope correctly determines the angle of rotation, but the calculated rotation angle is also disturbed by drift. For that reason it is suggested to perform an accurate calibration of the gyroscope during system initialization. The drift can also be reduced with more advanced filtering method like Kalman filter combined with moving measurement window. These methods will be implemented in the next version of detection system. The next step was to examine the detection system behavior during normal road conditions with a detection system installed on board. Twelve performed tests included the driving in different road conditions and at different speeds: stop, slow speed (30 kph), city driving (50kph), out of city driving (up to 90 kph), driving on an bumpy road and emergency braking (from 60 kph to 0). The tests showed that the threshold value was never exceeded (maximum deceleration magnitude was about 1.8 g). The alleged accident was not detected, even in the situations of emergency braking or bumpy surface driving.

V. STATE OF THE ART IN HUMAN PRESENCE DETECTION
As described in [7] very important part of data sent to the eCall center is number of passengers inside the vehicle during the collision. This subsection contains the literature review of the algorithms connected with human presence detection and our idea how to solve this problem.
In general, human presence detection can be performed in two ways: using extrinsic or intrinsic traits. Extrinsic traits are connected to applications installed on devices such as smart-phones or smart-bands while intrinsic traits are based on physical phenomena that can be detected using various types of sensors. These include cameras, thermal imagery, radars, microphones and pressure sensors. Taking into consideration the fact that proposed device should be self-sufficient, we decided to use only such devices that can be installed inside the vehicle as an integral part of the environment.
The solution of detecting number of occupants presented in this work is partially based on camera installed inside the vehicle. The main advantage of such approach is automatic detection without need for any user actions. Relatively low cost and wide availability of different types of cameras are also significant.
Detecting and counting people in an image is not a simple task and this problem has been widely studied in many works in the field of computer vision. However, only few studies in the literature are directly related to the detection of people in vehicles.

A. CLASSIC APPROACH
The authors of [26] proposed the system based on Gaussian Mixture Model detecting moving objects in a complex background. Conducted experiments resulted in the detection rate equal to 98,61%.
The concept presented in [27] concerns the problem of monitoring the number of occupants getting in or out of public transportation in order to improve vehicle's door control. This approach combines stereo video system that acquires a pair of images with Disparity Image computation and 3D filtering.
The authors of [28] achieved satisfactory results in detecting the presence of a person seated on the rear bench of a vehicle. They used an EMFI sensors, designed to detect mechanical vibration, focusing on the extraction of vital signs (respiration and heart beat) from the acquired signals. This approach avoided confusion between humans and objects such as bags or child seats. The method was based on a physiological pattern extracted using a wavelet denoising algorithm and on the Mahalanobis classifier.

B. VIOLA-JONES ALGORITHM
One of the most widely used solutions for face detection is the Viola-Jones method [29], as in [30] where it was applied to the human detection inside the vehicle in images from thermal camera. The main advantages of this algorithm contains small computation power requirements and ability to work with monochrome images. The Viola-Jones method uses Haar-like features computed as a scalar product of analyzed image and the selected masks. The basic classifier used in the method is based on a committee of, so called, weak classifiers, where each one makes decisions based on a single feature.
The choice of features and the construction of the classifiers for individual stages are performed during training by means of AdaBoost [31], where the training set contains both positive and negative examples. At the detection phase the classifier is applied at each position in an input image to detect face presence. The method may be also used for images of different scales by scaling masks selected during training.

C. CONVOLUTIONAL NETWORKS APPROACH
In recent years, most of the proposed techniques for object detection are based on deep learning and convolutional neural networks. The results obtained by those methods surpassed previous attempts by a large margin and achieved level that is comparable to human performance.
The object detection incorporates classification and regression tasks: the method should both classify an object and output its position in an image, usually in form of a boundary box. There are many methods for object detection that use ConvNets. In our work we focused on two solutions due to their relatively high accuracy and low processing time in test mode: You Only Look Once (YOLO) method [32] and The Single Shot Detection (SSD) algorithm [33].
In both YOLO and SSD methods there might be multiple detections of the same objects. Spurious detections can be pruned using Non-Maximum Suppression algorithm. The basic versions of YOLO and SSD methods were based on plain convolutional networks. However, one may also find modifications that use other types of networks, such as ResNets [34] or DarkNets.
In [35] the authors used a lightweight M7 network model to count people traveling by public transport. This optimized model is suitable for the vehicle system. Thanks to reducing the number of parameters, the detection speed the authors achieved was 4 times faster than the previous survey but with nearly the same detection accuracy.

VI. HUMAN PRESENCE DETECTION EXPERIMENTS
For the preliminary experiments on passengers' detection and counting, the authors selected a method based on face and object detection in images from camera installed inside a vehicle. For the purposes of this work three experiments using three approaches and three types of cameras were conducted: (1) Viola-Jones face detection algorithm with photos taken with LG G5 mobile phone camera, (2) SSD with video material taken with IP HD HC-255W camera, and (3) YOLO with video recording taken with SJCAM 360 • camera. In the first two cases camera was mounted using a holder on the windshield, in the place of the rear view mirror of the car, covering the interior of the cabin. Various possible seatings were examined from one to four persons (driver and three passengers), while various positions occupied by those present in the vehicle were tested. The experiment with the SJCAM 360 • camera was conducted inside a driving car with three persons on board -the driver and two passengers and camera was placed on the roof of the vehicle, close to its center.
To perform the first experiment the implementation of the Viola-Jones method available in OpenCV was used. 1 Due to the camera position in the vehicle, two detectors: trained with frontal face exposure and left profile face exposure were utilized. In order to obtain the right profile, the classifier for the left profile was applied to an image flipped around Y axis. The final result was determined by combining regions from individual detectors (frontal, left profile and right profile). In total, 113 photos were collected and the algorithm correctly recognized people with 66.1% efficiency.
The second experiment was conducted on the basis of 4 minutes (246 frames) video recording from inside of the vehicle. There were between 0 and 5 people in the car at that time. The material was divided into 25 intervals, assuming that the number of people will be determined based on the analysis of frames from 10 seconds of recording. The OpenCV implementation of Single-Shot MultiBox Detector with Deep Residual Network architecture was used. The algorithm correctly recognized objects in 72% of cases.
Compared to the first test, the method works correctly on a larger exposure range and has a much smaller number of false detections. Unfortunately, also in this approach, the face may not be detected when a significant part of it is covered. When recording the video for testing, the camera was installed in front of the front row. As a result, in some frames the faces of people on the rear row were obscured by the head restraints of the front seats or the people sitting in front. The benefit of video frame analysis was that it was possible to determine the correct number of people in the vehicle without precise detection in each frame tested.
In the third experiment object detection was used to count the number of persons in a car using images from 360 • camera installed in a vehicle. The video material was divided into 32 intervals, each 10 seconds long. The first step was to convert the spherical images to regular ones. This was done by transforming the spherical image into 2D space. After the transformation, depending on the position, it may turn out that one of the objects in the frame will be cut and appear on the left and right of the output image. This can lead to the person not being detected or being doubly detected. The problem is solved by widening the image and copying the slice from left to right. The width of the copied slice was assumed to be 10% of the image width. To avoid detecting a person twice, a filtration step has been added to eliminate such situations. As part of the pre-processing, the CLAHE [36] (Contrast Limited Adaptive Histogram Equalization) technique was used to normalize the histogram. This made it possible to compensate for the uneven lighting of the car's interior.
Then the DarkNet of YOLO algorithm implementation 2 was used to determine the number of passengers. Because the detector can return more than one location of the same object, there was a necessity to filter them. For this purpose, the NMS [37] (Non-maximum suppression) method was used, extended by deleting the copy of the object that could have emerged as a result of copying a fragment of the image. The algorithm correctly recognized objects with 85% efficiency. Figure 4 presents an example frame from the inside of the vehicle in good (a) and low (b) lighting conditions. 2 https://pjreddie.com/darknet/ The boxes indicate the positions of people found by the detector, together with the certainty of the classifier.
In the above-mentioned studies, calculations were performed on Raspberry Pi 3, NanoPi and nVidia Jetson microcomputers. This allowed testing the scenario of running the algorithms on the target device (at the time of the experiment only various prototype versions were available). Each time a satisfactory processing speed was obtained, allowing operation in real conditions in real time.
One of the elements of the human presence detection subsystem could be a set of pressure pads mounted in passenger seats. The experiments used FSR406 type sensors. They are simple elements that change their resistance under pressure. It was necessary to design a circuit that operates them and to create software that reacts to changing the state of the sensor. Tests have shown that when mounted on seats and properly calibrated, sensors reliably detect human pressure. Only when, for example, heavy luggage is placed in the passenger seat, they may cause incorrect indication of the presence of an additional person in the vehicle. In this situation it is necessary to confirm the result with the data from the camera. Because the solution has low computational requirements, it does not significantly load the CPU.
The authors also considered speech recognition [38] communication for the purpose of occupants detection. However, due to low practicality and language dependence of the solution the case was dropped for the time being.

VII. PRESENTATION OF PORTABLE eCall PROTOTYPE
This section presents the pre-production version of the device prototype. Laboratory solutions were initially covered by Raspberry Pi [39] with externally attached communication modules and sensor modules. The conducted experiments allowed checking the proof of the concept, and also showed too low performance of the Raspberry Pi microcomputer CPU. Therefore, it was decided to change the base processing module to NVIDIA Jetson Nano [40] which is characterized by the Quad-core ARM A57 @ 1.43 GHz CPU and 128-core Maxwell GPU. It works under the control of the Ubuntu 16.04 LTS operating system. This module is connected with an edge connector to the custom-developed motherboard (Fig. 5).  All necessary sensors and communication components verified by practical experiments have been integrated on the motherboard. Main parts are low-power high performance 3-axis linear accelerometer H3LIS331DL [41], additional 3D digital accelerometer and a 3D digital gyroscope LSM6DS33 [42] as well as -for communication -Cinterion PHS8 HSPA+ cellular machine-to-machine (M2M) module. The operating system has been modified to work with selected sensors and to implement CNNs (Convolutional Neural Networks). The conducted tests have confirmed the sufficient performance for quick detection of an accident, real-time image analysis and all obligatory eCall communication functionalities. Table 3 presents comparison with other aftermarket eCall equipment (of current or possible commercial use).

VIII. COMPARISON WITH SIMILAR SOLUTIONS
The data on the first three devices is based on [15] describing two commercially available solutions and a deep-learning based emergency detection of possible commercial employment. Dashcam is the commercially available driving recorder that additionally provides collision detection based, most probably, on an internal accelerometer. The device represents increasingly popular class of relatively simple driving recording devices. FreeWay FRA-6212S is a smart navigation entertainment system with Internet of Vehicles (IoV) connectivity. IoV is a distributed network, combining car-related hardware and software that allows communication with human driver, pedestrians, vehicles in vicinity, roadside infrastructure and fleet management in real time. It allows for cooperation of devices and cloud processing.
DeepCrash is a hybrid Internet of Vehicles (IoV) system proposed to detect high-speed head-on and single-vehicle accidents and provide an emergency alert mechanism. Its Sensing Layer consists of front camera (for visual accident detection based on DNN assessment cloud solution), collision detection sensors (6-axis acceleration sensor), OBD-II connection for obtaining vehicle speed and GPS module.
S-CarCrash [21] is the smartphone software system for detection of abnormal driving situations. Due to large number of sensors in modern smartphone devices (threeaxis accelerometer, gyroscope, microphone) the software is capable of obtaining vast amount of data to analyze. The limitations of such solution, as reported in the above-mentioned publication, seem to be the relatively low quality of accelerometers (most devices detect the range ±8g or ±16g while accident accelerations may exceed 50g), and therefore even dropping the phone could result in the maximum measurable acceleration and false positive detection. S-CarCrash combines the data from various smartphone sensors to avoid that. It is important to note that such systems are softwarebased, rather cheap to install, considering high smartphone popularity. On the other hand such application consumes significant battery life or may require user attention.
The market-ready product called Telematics eCall plug has been developed by the Bosch company [43]. It is effectively a smart sensor device designed for crash detection and the analysis of driving behavior, connected to dedicated smartphone application with Bluetooth. The main advantage is that the plug fits into a conventional 12V automobile auxiliary power outlet and is independent of the vehicle systems, being very easy to install and use. To work effectively, it should be connected to the phone at all times, however Bosch claims to use low-power Bluetooth connection. Crash detection is based on an acceleration sensor, which is a three-axis accelerometer and a temperature sensor. Both of them provide data that is constantly analyzed to assess whether a traffic accident has occurred. In the event of a large overload (high risk of accident), the module will transmit the signal to the smartphone application. This will immediately try to send the information to the alarm center.
Possibility to run the features separately and combined [44]: • crash detection reporting severity of the impact on the vehicle only (impact on passengers cannot be detected and may deviate from impact on vehicle), • Start/Stop and Driving Event detection for acceleration, braking and cornering only. The last column presents the capabilities of the device developed by the authors. Being custom made PCB with built-in sensors and software based on Ubuntu OS, it provides both versatility and quality. Accident detection is based on H3LIS331 accelerometer with range up to 200g and IMU LSM6DS3 chip which includes more precise but small measuring range accelerometer (up to 8 g) and a gyroscope. Such a tandem grants both precision and susceptible range (as described in details in section IV-B) most probably incomparable to the most smartphones. Important advantage of the proposed device is direct connection and communication with PSAP center, with MSD information on the accident transmitted digitally (in-band over voice call). The device preferably cooperates with external video camera of 360 • view, primarily for occupants' detection. Placed under the roof it may record the accident as well, both for severity assessment (currently under further studies) and juridical purposes. Important functionality inaccessible for the competitors solutions is occupants detection, provided in cross-fire by using video-based DNN detection as well as individual seat pressure pads that are a relatively cheap and effective solution.

IX. CONCLUSION AND FUTURE WORK
This article presents the concept and PCB implementation of compact eCall device. The authors described accident detection algorithms using various sensors and developed laboratory model based on H3LIS331 and IMU LSM6DS3. Simulated accident data was gathered using two accident simulators, both built by the authors, the first based on gravitation accelerated pendulum, whilst the second on trolley accelerated by expanders. Experimental results are promising as the authors failed to achieve a false positive result, neither in simulations nor in test driving.
Another issue was sending the number of passengers using eCall connection. A selection of human detection approaches was described along performed experiments in this matter. Detection of passengers using 360 • camera installed in the approximate center of vehicle with YOLO algorithm gave 85% correct detection. Additional mechanism proposed and tested for passenger detection are seat pressure pads that could be implemented independently of camera detection.
The authors also considered communication based on speech recognition for the purpose of occupants detection. They made use of and followed their earlier achievements in speech and speaker recognition [38]. However, due to some factors like language dependence the speech communication was left for future consideration.
Most viable mechanisms required by the task are incorporated in PCB prototype of compact eCall device, developed in cooperation with the authors. The prototype incorporates (1) passenger detection using single camera and seat pressure sensors, (2) accident and rollover detection using internal sensors and (3) GSM communication with eCall service center PSAP in accordance to the standard.
The main feature of the proposed solution is that it can be used in any passenger vehicle that the owner wants to benefit from the eCall safety system. And because of the fact that such a ready-to-install device has to be generic, some compromises had to be made. Moreover, one of the assumptions of the created system was the lack of any interference in the vehicle systems. The factory-installed system, integrated with vehicle subsystems and adapted to the specific vehicle model, will certainly have an advantage over the proposed solution. Of course, in the case of cars not equipped with the eCall system by default, the only solution is to use devices similar to the proposed one. The advantage of the proposed product is also its low cost. It requires neither additional devices nor an Internet access (as in the case of some solutions implemented in smartphones).
Future works include exploration of accident detection problem and implementation of more efficient algorithms for passenger detection, with possible upgrade to more powerful CPU. Speech communication which had given very good results in spoken text verification [38] will also be reconsidered in the near future studies so that more information can be eCall-sent by audio channels. MARCIN  Since 2001, he has been a Research Assistant with the Computer Systems Department, BUT, where he has been an Assistant Professor, since 2013. He is the author or coauthor of more than 60 works, including two books, journals articles, peer-reviewed conference papers, and book chapters. He is also a coauthor of the ZUBR package for supporting the design process of FPGA-based digital systems. His scientific research interests include design of embedded systems based on field programmable gate arrays and microcontrollers, design of hardware digital RF signal processing systems, and methods of synthesis of combinational and sequential circuits based on CPLD/FPGA devices. His research interests include biometrics, pattern recognition, advanced data processing and analysis, musical structure discovery, and syntax and semantics of music information.
MACIEJ SZYMKOWSKI (Member, IEEE) was born in Bialystok, Poland, in 1994. He received the B.Sc. and M.Sc.Eng. degrees, in 2017 and 2018, respectively.
Since 2018, he has been working as a Scientific Assistant with the Faculty of Computer Science, Białystok University of Technology in Biometrics Laboratory under the supervision of Professor Khalid Saeed. He is also a Software Developer. He published 25 research works in peer-reviewed journals and conference proceedings. His main research interests are connected with biometrics, medical image processing, and artificial intelligence. LUKASZ ZIENKIEWICZ received the M.Sc. degree in computer science from the Faculty of Computer Science, Bialystok University of Technology (BUT). He was an Embedded Developer in industrial automation and semiconductors. His scientific research interests include physics, acquisition and analysis of data, automobiles, driving, and racing simulation.