# Plant Disease Diagnosis in the Visible Spectrum
## 3 Materials and Methods
### Segmentation with Probabilistic Saliency
#### 3.3.2 Obtain the Saliency Map  
A saliency map is a representation in which to any pixel of an image that has a probability that the pixel is salient assigned, the pixels with high probabilities could be considered salient while the ones with low values may not be considered. In order to begin, a probability of 0.15 is assigned to all of the pixels.  
In order to update those values, a group of windows are used to compare the salient and non-salient regions, arranged in a 15-saliency windows grid that is centered in the average x coordinate and y coordinate of all of the pixels that were considered a priori salient as a result of the codification with the neural net; this step is crucial in the reduction of processing time as we are incorporating the assumption that the place with the higher concentration of a priori salient pixels may contain the overall salient object. The dimension of each side of the grid is 65% of the largest side of the image, and the separation between the center of a window and the next one is 15% of the largest side of the image.  
As mentioned earlier, a saliency window is used to contrast the value that a pixel has related to the rest of the pixels inside of the saliency windows vs. the values outside of the saliency window; in this research, we consider local and global saliency. Figures 3 and 4 offer a visual representation of the mentioned concepts.  
K is considered to be the salient region, W is considered to be the non-salient local region of the window, and I is considered to be the non-salient global region.  
The model is the following.  
Figure 4: Illustration of local and global saliency.  
Figure 3: Grid of saliency windows.  
* \(h_{0}:\) The pixel is not considered salient; it is associated with I and W,
* \(h_{1}:\) The pixel is considered salient; it is associated with K.  
Therefore, for the case of local saliency, the salient probability is calculated as follows.  
\[p_{l}(h_{1}|x)=\frac{p(x|h_{1})p(h_{1})}{p(x|h_{0})p(h_{0})+p(x|h_{1})p(h_{1})}, \tag{15}\]  
where  
\(p(h_{0})\) is the a priori probability that the pixel is not salient;  
\(p(h_{1})\) is the a priori probability that the pixel is salient;  
\(p(x|h_{0})\) is the probability to observe the specific value of the pixel given that it is not salient;  
\(p(x|h_{1})\) is the probability of observing the value of the pixel given that it is salient.  
The conditional probabilities are expressed and calculated in the following way.  
\[p(x|h_{0})=\frac{W_{1}}{W_{T}}, \tag{16}\]  
\[p(x|h_{1})=\frac{K_{1}}{K_{T}}, \tag{17}\]  
where  
\(W_{1}\) is the number of pixels with codification 1 in W;  
\(W_{T}\) is the total number of pixels in W;  
\(K_{1}\) is the total number of pixels with the codification 1 in K;  
\(K_{T}\) is the total number of pixels in K.  
For the case of the global saliency, \(p_{g}(h_{1}|x)\) the process is the similar, but for the calculation of the conditional probabilities, the region I is taken into account.  
Therefore, the updated saliency value after a specific window is the following.  
\[p(h_{1}|x)=0.8*p_{l}(h_{1}|x)+0.2*p_{g}(h_{1}|x). \tag{18}\]  
The process is repeated for the total of 15 saliency windows that are part of the grid, and it is important to overlap the saliency windows, so the values of a specific pixel are updated several times.  
It is important to state that only the pixels that were codified with \"1\" by the the HSV thresholds are updated. The idea is to take those a priori pixels that may be part of the segment that represents the plant and to discard those that do not belong to the salient object. By doing so, the computational efforts are vastly reduced, as all the pixels codified with a \"0\" are not considered and will not likely be part of the salient object.