[tree_struc, tree_struc_detail, tree_info] = fn_make_tree_structure(superpixel_out_cell,level_list,option)
The function fn_make_tree_structure takes as input the field of superpixel indices and the level id of superpixel field, then outputs the tree structure created from the levels of interest controlled by the option.
tree_struc: A 1 x N_total structure array, where N_total denotes the total number of nodes in the network; both hidden and evidence. tree_struc contains the information about the connectivities of the network. There are three fields:
It is convenient to say that the child node tree_struc(j).node_id of type tree_struc(j).type connects to its parent tree_struc(j).parent.
tree_struc_detail: A 1 x N_total_hid_level structure array, where N_total_hid_level denotes the total number of hidden level from root to leaf in the network. The array contains information about the node indices and their number in each level. The field names are as follows:
tree_info: A structure containing the information about the overview of the tree including the indices and number of hidden and evidence nodes and the total number of the levels. The field names are
superpixel_out_cell: A (1 x # of superpixel scales) cell array each of whose level contains superpixel indices running from 1 to the # of superpixel in the level. The cell array can have as many level as needed, and we might not use all of them though. In fact, this is the output of the function fn_make_superpixel, so for more details please refer to the function page directly.
level_list: The list of level indices in superpixel_out_cell we are interested to build a tree from.
For instance, if superpixel_out_cell was build from the N_sup list
N_sup = [3 5 10 20 30 50 60 80 100 120 140 150 180 200 220 250];
hence, there will be 16 levels of superpixel available, and let's assume building a tree from parameters
option = {};
option.N_set = 0.01;
option.single_root = 1;
option.px_level = 1;
level_list = [4 8 14];
[tree_struc, tree_struc_detail, tree_info] = fn_make_tree_structure(superpixel_out_cell,level_list,option);
It would mean we will have 5 hidden-node levels
level#5 "root" containing 1 node because of option.single_root = 1;
level#4 having 20 nodes, coming from the 4th number in the superpixel list in N_sup.
level#3 having 80 nodes, coming from the 8th number in the superpixel list in N_sup.
level#2 having 200 nodes, coming from the 14th number in the superpixel list in N_sup.
level#1 "pixel-level" containing large amount of nodes depending on the sampling rate option.N_set = 0.01 which means randomly sampling 1% of pixels in a superpixel and because of option.px_level = 1;
There are several options to direct the function.
Add the single root node at the top level and add the pixel level at the bottom
option.single_root = 1;
option.px_level = 1;
The result may looks like the top-left figure, in which there are 5 levels, the top level (l=5) is the single root determined by option.single_root = 1. Level 2-5 are all superpixel nodes, but the bottom most level (l=1) is pixel level determined by option.px_level = 1. Note that only hidden nodes are plotted in this figure.
option.single_root = 1
option.single_root = 0
option.px_level= 1
option.px_level= 0
Note