## 3 Fire Classification Based on FL with Image Clustering
### Client Model Training Process  
Figure 7 details the behavior of a client operating in the FL structure. The client takes in and processes its own local images, such as fire, smoke, and normal. The data are used entirely locally and are never shared externally. After preprocessing the input image, the client extracts features using the ViT model. ViT works by dividing the image into small patches, which are then analyzed, and only the important information is extracted. The feature vector for each image extracted in this process is 768-dimensional, which encapsulates the important patterns and characteristics of the image. After the client processes the data, it receives global cluster information from the server. This information consists of the cluster centroids that the server obtained as a result of processing data from other clients. The client uses these global cluster centroids as a basis for local clustering to  
determine how to classify its data. This process serves to help clients compare their data to global data. The client clusters its data based on the global cluster centroids it receives from the server. It places each data point in the appropriate cluster, calculating the distance between data points and assigning them to the closest cluster centroid. Based on these assignments, the client estimates how the data are distributed within each cluster. Density estimation, which calculates the degree to which data are clustered, is used to assess how densely the data are clustered within each cluster. Density estimation is an important step in clustering because it determines the relationship between data within a cluster by calculating how close or far apart they are. In this process, the client clusters data points that fall below a threshold distance and analyzes their relationships. By doing so, the client calculates how evenly distributed the data are, or if they are concentrated in certain areas. The client extracts a style vector that reflects the characteristics of the data in each cluster. The style vector indicates how the client data differ in direction from the global data on the server. For example, it indicates whether the client's data are more concentrated in certain classes or have stronger characteristics compared to the server's data. The style vector numerically calculates these differences and helps improve the global model when it is passed to the server. In this step, the client calculates the KL divergence. KL divergence is a mathematical measure of how different two probability distributions are, and it is used in associative learning to measure the difference between the client's data distribution and the server's global data distribution. First, the client computes a distribution for its local data. This determines the proportion of data points in each class. Next, the global data distribution received from the server is compared to the client's local distribution. The server knows the overall proportion of each class by aggregating the data it receives from all clients. KL divergence compares these two distributions and calculates the difference, which is mathematically the logarithm of the odds ratio between the local and global data distributions, weighted by the proportion of the local distribution. This allows you to measure how closely the client data match the global data on the server. A larger KL divergence value means that the data on the client and server are very different, while a smaller value means that the data are similar. The result of this KL divergence calculation is converted to an alpha value. The alpha value quantifies how much the client can contribute to the server's model. A high alpha value indicates that the client's data are having a significant impact on the global model. Finally, the client sends the calculated cluster centroid, style vector, alpha, and density values to the server. This allows the server to update the global model based on the information it receives from each client.