# Automated Design of Salient Object Detection Algorithms with Brain Programming
## Appendix A
6:\(\mathit{forest}\): A pre-trained model for calculating the highest level characteristics. This model requires training the GBVS bulge maps or some other fixation prediction algorithm. 7:\(\mathit{imgName}\): Name of the image to use. 8:Output
9:\(\mathit{finalMask}\): Contains the proto-object. 10: gbvsParam \(\leftarrow\) makeGBVSParams()
11: gbvsResult \(\leftarrow\) gbvs_init(img, param.ind)
12: salMap \(\leftarrow\) gbvsResult.master_map
13:[masks,maskCCs,numSegs,mcg_feats] \(\leftarrow\) compute_mcg(img, 'accurate', imgName, param)
14:[curFeats\({}_{\sigma}\)maskIdx] \(\leftarrow\) computeFeatures(maskCCs, salMap, [], param)
15:masks \(\leftarrow\) masks(. ;.,maskIdx)
16:mcg_feats \(\leftarrow\) single(mcg_feats(maskIdx, :))
17:allFeats \(\leftarrow\) [curFeats, mcg_feats]
18:[labels, probs] \(\leftarrow\) forestApply(allFeats, forest)
19:[labels, index] \(\leftarrow\) sort(labels, 1, 'descend')
20:sizeK \(\leftarrow\) param.topK
21:if (sizeK > length(index)) then
22: sizeK \(\leftarrow\) length(index)
23:endif
24:index \(\leftarrow\) index(1:sizeK)
25:topMasks \(\leftarrow\) masks(;. ;.index)
26:scores \(\leftarrow\) reshape((labels(index)/param.nbins), [1 1 sizeK])
27:finalMask \(\leftarrow\) topMasks. * repmat(scores, [imgH, imgW, 1])
28:finalMask \(\leftarrow\) mat2 gray(sum(finalMask, 3))
29:return finalMask
```
**Algorithm A2** salobj_test_img
```
1:Purpose
2:Configuration of initial parameters of the GBVS and its execution. 3:Input
3:\(\mathit{img}\): Image or image path. 4:\(\mathit{ind}\): Mathematical model generated by the BP. 5:Output
6:\(\mathit{out}\): Contains the salience map. 7:params \(\leftarrow\) makeGBVSParams
8:params.channels \(\leftarrow\) 'DIDS'
9:params.gaborangles \(\leftarrow\) [ 0, 45, 90, 135 ]
10:params.levels \(\leftarrow\) 4
11:params.tol \(\leftarrow\) 0.003
12:params.salmapmaxsize \(\leftarrow\) round( max(size(img))/8 )
13:params.ind \(\leftarrow\) ind
14:params.gp \(\leftarrow\) 1
15:params.shapeWeight \(\leftarrow\) 1
16:out \(\leftarrow\) gbvs(img, params)
17:return out
```
**Algorithm A3** gbvs_initAlgorithm A3 is in charge of initializing the execution parameters of the GBVS and executing it. The default parameters of the algorithm (1) are stored in _param_. Next, the channels (dimensions for the GP) to be used are chosen (2). The Gabor angles to use, the subsampling levels, the tolerance level of the eigenvector equilibrium mechanism, and the minimum subsampling size are established (3-6). The individual generated by the GP is also stored as well as the control variables and weights (7-9). Finally, we obtain the GBVS result for the input image (10). ```
1:Purpose
2:Image segmentation and feature extraction. 3



Algorithm A5 is responsible for calculating the salience map of an image. Some constants necessary for executing the GBVS are established in the initial line, such as the weight matrix and the Gabor filters. This information is stored in a file for each image dimension to be processed and reused while keeping dimensions (1). In the following line, we extract the feature maps of the image. It is in this phase that the individual generated by the GP is used and stored _param_ (Algorithm A6) (2). Then the activation maps are calculated for each feature map (3). These maps are then normalized (4). Next, each channel's average of the feature maps is calculated (5). Next, the characteristics are added through the channels (6). Then the part of the individual corresponding to the integration of characteristics is added to the resulting salience map (33). This sum is blurred and finally returned (38). Algorithm A6 extracts the features from the input image using the individual generated by the GP. In the initial line, an array is established with the subsampling levels of the image starting at two because one would be the image with the original dimensions. The next 11 lines of the algorithm are dedicated to the subsampling of the different channels of three color spaces (RGB, CMYK, and HSV) (2-12).