# Car-Sense: Vehicle Occupant Legacy Hazard Detection Method Based on DFWS
## 4 Method Design
### Personnel Status Identification  
For the detection of the problem of stranded people in the car mentioned in this paper, and considering the limited computing power of the side device ESP32 itself, we choose to determine whether there are children or other people stranded in the car from the number of people, their location, and temperature sensing. Specifically, in the first part, the data collected in the offline stage is used to train the model with the labeled data after data cleaning and feature extraction and sent to the cloud platform. In the second part, when the device detects the CSI data signal, it first performs the subcarrier processing locally and then sends the data to the cloud platform, and uses the powerful computing power of the cloud platform to derive the recognition results and return them in time, as shown in Figure 7.  
With the above steps, Car-Sense can use the collected wireless data to determine the status of the vehicle occupants. After inputting the necessary parameters into the program, the results of the two tests are obtained separately, and the final determination of the personnel status is made in a comprehensive manner. The pseudo-code is shown in Algorithm 1. ``` Input: CSI Feature Vectors feature = [\(m\), \(v\), \(s\)], RSSI s, Temperature t Output: Personnel Status \(\delta\)
1. \(\mathrm{NOP}=\mathrm{NumberOfPeople}\) (feature) // Determine the number of personnel
2. \(\mathrm{FO}=\mathrm{FingerprintOrientation}\) (\(s\)) // Determine the location of personnel
3. The use of three indicators to determine the combination of people left in car \(\delta\)
4. function NumberOfPeople (feature)
5. group, labels, k // Test sample, test sample label, K-value
6. result = knn_classify (feature, group, labels, k)
7. return result
8. end function
9. function FingerprintOrientation (\(s\))
10. \(S\) // Off-line Fingerprint Library
11. for j = 1, 2,..., m do
12. Iterate over all data objects S = {RSSI_1, RSSI_2,..., RSSI_m};
13. if |RSSI_j-s| Smallest of all results
14. end if
15. end for
16. return j
17. end function

Figure 7: Edge-side computing + cloud co-computing. #### 4.3.1 Personnel Quantity Detection

The number of people identified using CSI is based on the following principle: the activities of people in the car will have a certain impact on the propagation of Wi-Fi signals, and when the number of people in the car increases, the impact on Wi-Fi signals becomes more obvious, which in turn generates a specific pattern in the channel state information. Therefore, the key to using CSI for headcount identification is to find the relationship between CSI amplitude fluctuations and the number of active people in the vehicle. In the offline model training phase, 500 sets of data are collected for each type of vehicle occupant, and different CSI magnitudes for different numbers of people are used to train the number of people recognition model and the location fingerprint detection model using machine learning methods, respectively, SVM, KNN, and multilayer perceptron MLP. The parameters of the three models are shown in Table 1:

In the online phase, after the data is obtained locally, the optimal subcarrier is first selected according to the PCA principal component analysis algorithm mentioned above in the feature extraction phase, and simple operations such as filtering of the data are performed, and then the processed data feature values are sent to the cloud for the relatively more computationally intensive model identification. This allows for a timelier response. #### 4.3.2 Wi-Fi Fingerprint Positioning

The core idea of Wi-Fi fingerprinting is to associate a location in the physical environment with a certain \"fingerprint\", a location that corresponds to a unique fingerprint. This fingerprint can be a feature or multiple features of this signal (most often the signal intensity). The establishment of the correspondence between location and fingerprint is usually performed in the offline phase.