## 3 Fire Classification Based on FL with Image Clustering
### Obtaining GCI
#### 3.3.2 N Round  
For \(N\) rounds, the GCI is obtained by an ensemble based on the information obtained from each client. Algorithm 2 is a pseudocode representation of the ensemble algorithm for \(N\) rounds. The proposed algorithm works by adjusting the cluster information on the server side based on the style direction of each client in an FL structure.  
Here, cp_info_server is the cluster point information managed by the server. It is organized in the format dataFrame and contains each cluster point and its label. Further, style_direction is a value indicating the direction of style change for each client, and it is organized per client and sent by the client to the server. The alpha value is a client-specific weight that controls each client's contribution to updating the GCI. The parameter acc_info  
Figure 6: Initial GCI process.  
consists of two values, indicating the accuracy of the previous and current rounds; step is the step size used for the update; call_cnt is the number of times the function was called in the current round. The parameters step and call_cnt use the value passed in from the previous state, and call_cnt checks to identify the round that the algorithm is in. If we do nothing on the first call and present_acc is lower than before_acc, we increase the step by a factor of 1.1 because performance has worsened; conversely, we reduce it by a factor of 0.9 because performance has improved if present_acc is higher than before_acc. If present_acc is above 95%, we reduce the step by 0.1 because no significant change is needed.  
```
0:\(cp\_info\_server,style\_direction,alpha,acc\_info\)
1:Global Variables step:\(call\_cnt\gets call\_cnt+1\)
2:\(before\_acc\leftarrow acc\_info[0]\)
3:\(preset\_acc\leftarrow acc\_info[0]\)
4:\(preset\_acc\gets acc\_info[0]\)
5:ifcall\_cnt\(=1\)then
6:Do nothing
7:else if present\_acc \(<before\_acc\)then
8:\(step\gets step\times 1.1\)
9:else if present\_acc \(>before\_acc\)then
10:if present\_acc \(<0.95\)then
11:\(step\gets step\times 0.9\)
12:else
13:\(step\gets step\times 0.1\)
14:endif
15:endif
16:Print [\(Adjusted\) step] :\(step\)
17:\(model\_cp\leftarrow DataFrame\) with same index and columns as \(cp\_info\_server\)
18:\(model\_cp[Label^{\prime}]\gets cp\_info\_server[Label^{\prime}]\)
19:\(labels\leftarrow unique\_(cp\_info\_server[Label^{\prime}])\)
20:\(clients\leftarrow list[style\_direction\_logs()]\)
21:\(num\_clients\leftarrow len(clients)\)
22:for each label in labels do
23:\(weighted\_sent\leftarrow reset(768)\)
24:for\(df\_style\_info\_clients\)
25:\(df\_style\_fillan(\_alpha,\{\text{\emph{apache}}}=True)\)
26:\(weighted\_sent\gets weighted\_sent+df\_style[df\_style[Label^{\prime}]== label].loc[v_{i},-1]\times a\)
27:endfor
28:\(average\_vector\gets weighted\_sum/num\_clients\)
29:\(server\_style\gets cp\_info\_server[\_info\_server[Label^{\prime}]== label].loc[0,:-1]\)
30:\(new\_vector\gets server\_style+step\_vector\)
31:\(index\gets non\_encoder[index].cap[Label^{\prime}]== label].index[0]
32:\(moved\_cp[index,moved\_cp columns[:-1]\gets new\_vector\)
33:endfor
34:returnmoved_cp
```  
**Algorithm 2**\(N\)-round GCI  
The moved cluster point information is stored in moved_cp, and labels is a list of unique labels present in the dataset; clients is a list of clients, and num_clients is the number of clients. For each label, we weigh the style direction of the client by the value of alpha and compute the average vector. Then, we add the average vector to the cluster point style vector of the server, scaled by step, and compute the new vector. The cluster points are updated for the corresponding labels in moved_cp. Finally, the GCI is obtained in round \(N\) by returning dataFrame moved_cp for the moved cluster points. This value is passed to the client as a weight in round \(N\).