# Deep Learning Methods in Image Matting: A Survey
## 5 Evaluation Indicators
### Multi-Point Evaluation  
A single-point evaluation is a straightforward method to calculate but fails to reflect the relationship between the opacity differences of multiple pixels. Therefore, in specific cases, a multi-point evaluation is necessary. Multi-point evaluations take into account the differences between the ground truth alpha mattes and algorithm-generated alpha mattes from the perspective of a series of pixels, including gradient error and connectivity error [40], among others. The gradient error reflects the discrepancy in the transparency alteration between the ground truth alpha matte and the algorithm-generated alpha matte and is calculated as  
\[Grad=\sum_{i}(\bigtriangledown\hat{\alpha_{i}}-\bigtriangledown\widetilde{ \alpha_{i}})^{q}. \tag{4}\]  
where \(\bigtriangledown\hat{\alpha_{i}}\) and \(\bigtriangledown\widetilde{\alpha_{i}}\) denote the normalized gradient magnitude of the estimated alpha matte and ground truth alpha matte at pixel \(i\), respectively; they are calculated using the Gaussian first derivative. \(q\) is a custom parameter.  
The algorithmic matting performance is deemed superior when \(Grad\) attains a smaller value. The efficacious evaluation of algorithms in terms of details (e.g., hair, fur, etc.) can be achieved via the gradient error.  
The connectivity error represents the difference in connectivity between the ground truth alpha matte and the estimated alpha matte, and it is mathematically defined as  
\[Conn=\sum_{i}(\varphi(\hat{\alpha_{i}},\Omega)-\varphi(\widetilde{\alpha_{i}},\Omega))^{p}. \tag{5}\]  
where \(\Omega\) represents the largest connected region in both the ground truth alpha matte and the estimated alpha matte, which is the foreground. \(p\) is a custom parameter. \(\varphi\) is a function that characterizes the extent of connectivity between pixel \(i\) and \(\Omega\), which is calculated as  
\[\varphi(\hat{\alpha_{i}},\Omega)=1-(\lambda_{i}\cdot\delta(d_{i}\geq\theta) \cdot d_{i}). \tag{6}\]  
Pixels are fully disconnected when \(\varphi=0\) and fully connected when \(\varphi=1\). \(\lambda_{i}\) corresponds to the mean distance between pixel \(i\) and the nearest connected pixel to \(\Omega\): \(\lambda_{i}=\frac{1}{|K|}\sum_{k\in K}dist_{k}(i)\), \(K\) is the set of discrete values between \(l_{i}\) and \(\alpha_{i}\). The \(disk_{k}\) function computes the normalized Euclidean distance between pixel \(i\) and the nearest pixel connected to \(\Omega\) when using a threshold of \(k\). In the equation \(d_{i}=\hat{\alpha_{i}}-l_{i}\), \(l_{i}\) refers to the maximum binarization threshold that is needed to ensure four-connectivity between pixel \(i\) and \(\Omega\); \(\delta\) denotes the Dirac \(\delta\) function, which is used to ignore \(d_{i}\) being less than \(\theta\). \(\theta\) is a custom parameter where pixels are considered fully connected when \(d_{i}<\theta\), resulting in a more flexible error calculation. The smaller the \(Conn\), the smoother the surface changes of the foreground object, the clearer the boundaries, and the better the matting effect.  
However, as neither the gradient error nor the connectivity error alone can comprehensively assess the quality of the alpha matte, a combination of both indicators is often employed to evaluate the performance of a model.