# Semantic-Enhanced Foundation Model for Coastal Land Use Recognition from Optical Satellite Images
## 4 From Land Use Segmentation to Land Use Semantic Recognition
### Semantically Aware Land Use Similarity Analysis  
Assuming the \(n\)-dimension vector space of land cover classification forms and images are \(V\subseteq\{v_{1},\ v_{2},\ldots,v_{m}\}\) and \(I_{i}=(w_{i,1},\ w_{i,2},\ldots,w_{i,m})\), respectively, the category (term)-image (document) model creates a matrix that represents land cover forms and images as rows and columns (see Figure 4B). The similarity among land uses in two images, \(I_{i}\) and \(I_{j}\), is computed by the following five methods: Euclidean distance, inner product, cosine similarity, dice similarity, and Jaccard similarity. The similarity measured by the Euclidean distance and inner product is expressed by the following equation:  
\[\left\{\begin{matrix}sim\left(I_{i},I_{j}\right)=\sqrt{\sum_{x=1}^{m}\left(w_{ i,x}-w_{j,x}\right)^{2}}\\ sim\left(I_{i},I_{j}\right)=\left|I_{i}\cap I_{j}\right|=I_{i}\times I_{j}= \sum_{x=1}^{m}w_{i,x}\times w_{j,x}\end{matrix}\right. \tag{4}\]  
Neither the Euclidean distance nor inner product consider the category length or the total number of land cover forms included in an optical satellite image. For example, the inner product may equally measure a five-category image that contains three similar classes and a ten-category image that contains three similar classes. Then, cosine similarity, Jaccard similarity, and dice similarity were proposed to supportively measure the similarity between two images while considering the total number of land cover classes included in an image.  
The cosine similarity is computed as follows,  
\[sim\left(I_{i},I_{j}\right)=\frac{\left|I_{i}\cap I_{j}\right|}{\left|I_{i} \right|\times\left|I_{j}\right|}=\frac{\sum_{x=1}^{m}w_{i,x}\times w_{j,x}}{ \sqrt{\sum_{x=1}^{m}\left(w_{i,x}\right)^{2}}\times\sqrt{\sum_{x=1}^{m}\left( w_{j,x}\right)^{2}}} \tag{5}\]  
The Jaccard similarity is computed as follows,  
\[sim\left(I_{i},I_{j}\right)=\frac{\left|I_{i}\cap I_{j}\right|}{\left|I_{i} \cup I_{j}\right|}=\frac{\sum_{x=1}^{k}w_{i,x}\times w_{j,x}}{\sum_{x=1}^{k} \left(w_{i,x}\right)^{2}+\sum_{x=1}^{k}\left(w_{j,x}\right)^{2}-\sum_{x=1}^{k }w_{i,x}\times w_{j,x}} \tag{6}\]  
The dice similarity is computed as follows,  
\[sim\left(I_{i},I_{j}\right)=2\frac{\left|I_{i}\cap I_{j}\right|}{\left|I_{i} \right|+\left|I_{j}\right|}=\frac{\sum_{x=1}^{k}w_{i,x}\times w_{j,x}}{\sqrt{ \sum_{x=1}^{k}\left(w_{i,x}\right)^{2}}+\sqrt{\sum_{x=1}^{k}\left(w_{j,x} \right)^{2}}} \tag{7}\]  
The similarity between two land use forms in optical satellite images is measured differently from that between the two documents. If two optical satellite images contain different land covers, their land uses are distinct. Thus, the cosine, Jaccard, and dice similarity methods alone cannot distinctly, adaptively identify two images when they have different land covers: in other words, when \(w_{j,x}\
eq 0\) and \(w_{j,x}=0\). Thus, we modified Equation (5) to fit for image similarity:  
\[sim\left(I_{i},I_{j}\right)=\left\{\begin{matrix}\frac{\Theta_{x}\times\sum_{x =1}^{m}w_{i,x}\times w_{j,x}}{\sqrt{\sum_{x=1}^{m}\left(w_{i,x}\right)^{2}} \times\sqrt{\sum_{x=1}^{m}\left(w_{j,x}\right)^{2}}}\\ \Theta_{x}=\left\{\begin{matrix}1,w_{i,x}\times w_{j,x}\
eq 0\\ 0,\ w_{i,x}\times w_{j,x}=0\end{matrix}\right.  
In the example shown in Figure 4C, the image gridding scale is 2. Blue boxes denote the subregion that contains the sand class, and the normalized sand category frequency equals \(1/2^{2+1}+2/2^{1+1}=5/8\). Assuming that \(k_{max}\) is 2, the new sand category frequency (\(cf_{i,x}\)) is \(5/8\times 2^{2+2}=10\); then, the inverse image frequency (\(imf_{i,x}\)) for the sand class is \(\log(2^{2\times 2}/10)=0.2041\). Thus, \(\text{w}_{\text{i,x}}=10\times 0.2041=2.041\).