## 3 Fully Intelligent Accident Liability Determination Method Based on Collision Detection
### Responsibility Determination Method Based on Multimodal Large Language Model
#### 3.4.1 Key Frames Extraction Based on K-Means Algorithm  
Considering that an accident responsibility determination relies on comprehensive process information from the event, we employed a key frame extraction method based on K-means clustering. This method utilizes each frame in the video as a sample to comprehensively describe the motion process, thus avoiding the oversight of overall motion patterns by not merely focusing on local features.  
For each video frame, we extracted a feature vector that captured its essential visual information. Specifically, the feature vector originated from the color histogram of the frame, computed in the HSV color space. This space is more perceptually uniform than the RGB color space and less sensitive to lighting variations.  
Let \(f_{i}\) represent the \(i\)-th video frame, then the calculation steps for the feature vector of this frame are outlined as follows:  
\[F_{HSV,i}=HSV(f_{i}) \tag{18}\]  
where \(F_{HSV,i}\) represents the frame \(f_{i}\) converted to the HSV color space.  
Next, calculate the color histogram \(h_{HSV,i}\) of \(F_{HSV,i}\):  
\[h_{HSV,i}=Hist(F_{HSV,i},bins=(bH,bS,bV)) \tag{19}\]Here, \(h_{HSV,\ i}\) is the histogram of the frame \(f_{i}\), with \((bH,bS,bV)\) representing the number of bins for the hue, saturation, and value channels, respectively. In our implementation, we used \(bH=bS=bV=8\), resulting in a 512-dimensional histogram.  
This histogram \(h_{HSV,\ i}\) was normalized to ensure that the feature vector was invariant to the number of pixels in the frame, and then flattened into a one-dimensional vector \(V_{i}\).  
\[V_{i}=\frac{h_{HSV,\ i}}{\left\|h_{HSV,\ i}\right\|^{2}} \tag{20}\]  
Figure 3 illustrates a schematic diagram of the described process.  
Given a feature set \(\{V_{1},V_{2},...,V_{N_{v}}\}\) of video frames, where \(N_{v}\) is the total number of frames in the video, these frames are divided into \(K\) clusters to maximize intra-cluster similarity and minimize inter-cluster similarity. Define the center of each cluster as \(C_{k}\), where \(k=1,2,...,K\). To minimize the sum of the distances between the frame features and their corresponding centers within a cluster, the objective function is defined as:  
\[J=min\sum_{k=1}^{K}\sum_{V_{i}\in C_{k}}\left\|V_{t}-C_{k}\right\|^{2} \tag{21}\]  
where \(\left\|V_{t}-C_{k}\right\|^{2}\) represents the square of the Euclidean distance between the feature vector \(V_{i}\) of frame \(t\) and the center \(C_{k}\) of its cluster.  
In the solution process, the cluster center \(C_{k}\) is initialized and iteratively updated until convergence is achieved. Each frame feature \(V_{i}\) is assigned to the nearest cluster by minimizing the squared Euclidean distance to the corresponding cluster center \(C_{k}\). The mean of the feature vectors from all frames in each cluster is recalculated to define the new cluster center \(C_{k}\).  
Upon the completion of clustering, each cluster represents a \"scene\" or a collection of frames with similar content in the video. The frame closest to the cluster center \(C_{k}\) in each cluster w selected as the representative of that cluster, designated as the key frame.