Full text
UNIVERSITAT POLITÈCNICA DE CATALUNYA Universitat Polit ` ecnica de Catalunya Teoria del Senyal i Comunicacions European Master of Research on Information and Communication Technologies Tools for Image Retrieval in Large Multimedia Databases Master’s Final Project Dissertation by Carles Ventura Royo Advisors: Ver´ onica Vilaplana Besler Xavier Gir´ o Nieto Barcelona, September 2011
Abstract One of the challenges in the development of an image retrieval system is to achieve an efficient indexing scheme since both developers and users, who are used to make requests in order to find a multimedia element in a large database, can be frustrated due to the long computational time of the search. The traditional indexing schemes neither fulfill the dynamic indexing requirement, which allows to add or remove elements from the structure, nor fit well in high dimensional feature spaces due to the phenomenon so called “the curse of dimensionality.” After analyzing several indexing techniques from the literature, we have decided to implement an indexing scheme called Hierarchical Cellular Tree (HCT), which was designed to bring an effective solution especially for indexing large multimedia databases. The HCT has allowed to improve the performance of our implemented image retrieval system based on the MPEG-7 visual descriptors. We have also made some contributions by proposing some modifications to the original HCT which have resulted in an improvement of its performance. Thus, we have proposed a redefinition of the covering radius, which does not consider only the elements belonging to the cell, but also all the elements holding from that cell. Since this consideration implies a much more computationally costly algorithm, we have proposed an approximation by excess for the covering radius value. However, we have also implemented a method which allows to update the covering radius to its actual value whenever it is desired. In addition to this, the pre-emptive insertion method has been adapted as a searching technique in order to improve the performance given by the retrieval scheme called Progressive Query, which was originally proposed to be used over the HCT. Furthermore, the HCT indexing scheme has been also adapted to a server/client architecture by using a messenger system called KSC, which allows to have the HCT i
ii loaded on a server waiting for the query requests which are launched for the several clients of the retrieval system. In addition to this, the tool used to request a search over the indexed database has been adapted to a graphic user interface, named GOS (Graphic Object Searcher), which allows the user to order the retrievals in a more friendly way.
Acknowledgments I would like to express my greatest appreciation to my advisors, Ver´onica Vilaplana and Xavier Gir´o, and my tutor, Ferran Marqu´es, for their support, stimulating suggestions and encouragement throughout the course of this research work. I would also like to thank all my colleagues and friends for their help and useful suggestions, in particular Jordi Pont and Albert Gil. Moreover, I am very grateful to my family for cheering me up constantly. iii
Contents Abstract i Acknowledgments iii Contents v List of Figures vii 1 Introduction 1 2 State of the Art 5 2.1 Spatial Access Methods . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.2 MetricAccessMethods........................... 9 2.3 Locality Sensitive Hashing . . . . . . . . . . . . . . . . . . . . . . . . . 13 3 Hierarchical Cellular Tree 15 3.1 CellStructure................................ 17 3.2 LevelStructure............................... 19 3.3 HCTOperations .............................. 20 3.4 Retrieval scheme over HCT . . . . . . . . . . . . . . . . . . . . . . . . 24 4 Modifications to the original HCT 27 4.1 Coveringradius............................... 27 4.2 HCTbuilding................................ 29 4.3 Searching techniques over HCT . . . . . . . . . . . . . . . . . . . . . . 30 5 Implementation 33 5.1 CellImplementation ............................ 34 5.2 Level Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 v
vi CONTENTS 5.3 HCTImplementation............................ 38 5.4 Write/Read HCT operations . . . . . . . . . . . . . . . . . . . . . . . 47 5.5 A tool for image database indexing . . . . . . . . . . . . . . . . . . . . 49 5.6 A tool for image retrieval over HCT . . . . . . . . . . . . . . . . . . . 53 5.7 HCT over a server/client architecture . . . . . . . . . . . . . . . . . . 55 6 Experimental results 61 6.1 Setting the experiments . . . . . . . . . . . . . . . . . . . . . . . . . . 61 6.2 HCT building evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . 63 6.3 Retrieval system evaluation . . . . . . . . . . . . . . . . . . . . . . . . 69 6.4 Query request examples . . . . . . . . . . . . . . . . . . . . . . . . . . 83 7 Conclusions and Future Work 93 Bibliography 97
List of Figures 3.1 HCTexample.................................. 16 3.2 MST Formation (a) and possible candidates for Cell Nucleus (b) . . . . . 18 3.3 Sample mitosis operation over a mature cell . . . . . . . . . . . . . . . . . 19 3.4 Sample Pre-Emptive cell search . . . . . . . . . . . . . . . . . . . . . . . . 21 3.5 Sample HCT Construction . . . . . . . . . . . . . . . . . . . . . . . . . . 23 3.6 QP formation on a sample HCT body . . . . . . . . . . . . . . . . . . . . 25 4.1 Coveringradius................................. 28 5.1 Updating covering radius . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 5.2 Scheme of the KSC messaging system . . . . . . . . . . . . . . . . . . . . 56 5.3 Our KSC architecture scheme . . . . . . . . . . . . . . . . . . . . . . . . . 59 5.4 Configuration of the HCT parameters in the GOS . . . . . . . . . . . . . 60 6.1 Sample images from CCMA database . . . . . . . . . . . . . . . . . . . . 63 6.2 HCT building time for original covering radius . . . . . . . . . . . . . . . 66 6.3 HCT insertion time for original covering radius . . . . . . . . . . . . . . . 67 6.4 HCT building time for proposed covering radius . . . . . . . . . . . . . . 68 6.5 HCT insertion time for proposed covering radius . . . . . . . . . . . . . . 68 6.6 HCT building time comparison for update method of the covering radius 70 6.7 HCT insertion time for original covering radius when the update method of the covering radius is applied after 200,000 elements have been inserted 70 6.8 Comparison between the results obtained by using or not the indexing structure .................................... 84 6.9 Comparison between rankings from an anchorperson query image . . . . . 85 6.10 Comparison between rankings from a soccer match close-up query . . . . 86 6.11 Comparison between rankings from a soccer match pan shot query . . . . 86 vii
6CHAPTER 2. STATE OF THE ART node represents a subset of the records in the database and a partitioning of that subset. The root of the tree represents the entire database. Each nonterminal node has two sons or successor nodes which represent the two subsets defined by the partitioning. The terminal nodes represent mutually exclusive small subsets of the data records, which collectively form a partition of the record space. In the case of one-dimensional searching, a record is represented by a single key and a partition is defined by some value of that key. All records in a subset with key values less than or equal to the partition value belong to the left son, while those with a larger value belong to the right son. Thus, the key variable becomes a discriminator for assigning records to the two subsets. In kdimensions, a record is represented by kkeys. Any one of these can serve as the discriminator for partitioning the subset represented by a particular node in the tree. Thus, the discriminating key number can range from 1 to k. The k−dtree is optimized by choosing at every nonterminal node the key with the largest spread in values as the discriminator and to chose the median of the discriminator key values as the partition. •R-tree [Gut84]. An R-tree is a height-balanced tree with index records in its leaf nodes containing pointers to data objects. A spatial database consists of a collector of tuples representing spatial objects, and each tuple has a unique identifier which can be used to retrieve it. Leaf nodes in an R-tree contain index record entries of the form (I, tuple−identifier) where tuple−identifier refers to a tuple in the database and Iis an n-dimensional rectangle which is the bounding box of the spatial object indexed I= (I0, I1, ..., In−1). Here nis the number of dimensions and Iiis a closed bounded interval [a, b] describing the extent of the object along dimension i. Non-leaf nodes contain entries of the form (I, child −pointer) where child −pointer is the address of a lower node in the R-tree and Icovers all rectangles in the lower node’s entries. •R*-tree [BKSS90]. The R*-tree is a R-tree variant which incorporates a combined optimization of area, margin and overlap of each enclosing rectangle in the directory. It provides a consistently better performance by introducing a policy called “forced reinsert”. Thus, the R*-tree forces entries to be reinserted during the insertion routine in order to achieve dynamic reorganizations. Furthermore, forced reinsert changes entries between neighboring nodes and thus decreases the overlap which results in a decrease in the number of paths to
2.1. SPATIAL ACCESS METHODS 7 be traversed. As a side effect, storage utilization is improved. Higher storage utilization will generally reduce the query cost as the height of the tree will be kept low. In addition to this, less splits occur due to more restructuring. Furthermore, since the outer rectangles of a node are reinserted, the shape of the directory rectangles will be more quadratic. Thus, clustering rectangles into bounding boxes with only little variance of the lengths of the edges reduces the area of directory rectangles, which improves performance since decisions which paths have to be traversed can be taken on higher levels. •TV-tree [LJF94]. The basis of the TV-tree is to use dynamically contracting and extracting feature vectors. As more objects are inserted to the tree, more features might be needed to discriminate among the objects. Thus, the TV-tree is based on the telescopic problem, which can be described as follows. Given an n×1 feature vector ~x and an m×n(m≤n) contraction matrix Am, the m×1 vector Am~x is an m-contraction of ~x. A sequence of such matrices Am, with m= 1, ... describes a telescoping function provided that the following condition is satisfied: If the m1-contractions of two vectors, ~x and ~y, are equal, then so are their respective m2-contractions, for every m2< m1. In most applications, transforming the given feature vector will achieve good ordering. Ordering the features on the basis of importance is exactly what the Karhunen Lowe (KL) transform achieves. KL transform is optimal if the set of data is known in advance, thus, for static databases. In a dynamic case, dataindependent transforms sucs as Discrete Cosine Transform and the Discrete Fourier Transform are used instead. Each node in the TV-tree represents the Minimum Bounding Region (MBR) of all its descendents. Each region is represented by a center, which is a vector determined by the telescoping vectors representing the objects, and a scalar radius. Since the center of the region is also a telescopic vector, the term Telescopic Minimum Bounding Region (TMBR) is used to denote the MBR with such a telescopic vector as a center. •X-tree [BKK96]. The X-tree (eXtended node tree) is an index structure supporting efficient query processing of high-dimensional data. The X-tree avoids overlap whenever it is possible without allowing the tree to degenerate; other-
8CHAPTER 2. STATE OF THE ART wise, the X-tree uses extended variable size directory nodes, so-called supernodes. The X-tree may be seen as a hybrid of a linear array-like and a hierarchical R-tree like directory. The X-tree consists of three different types of nodes: data nodes, normal directory nodes, and supernodes. The basic goal of supernodes is to avoid splits in the directory which would result in an inefficient directory structure. The alternative to using larger node sizes are highly overlapping directory nodes which would require to access most of the son nodes during the search process. This, however, is more inefficient than linearly scanning the larger supernode. Supernodes are created during insertion only if there is no other possibility to avoid overlap. In many cases, the creation or extension of supernodes may be avoided by choosing an overlap-minimal split axis. •NV-Tree [LJA11]. The NV-Tree is a disk-based data structure, which builds upon a combination of projections of data points to lines and partitioning of the projected space. By repeating the process of projecting and partitioning, data is eventually separated into small partitions which can easily be fetched from disk with a single disk read, and which are highly likely to contain all the close neighbors in the collection. For each pair of adjacent partitions, an overlapping partition, covering 50% of each partition, is created for redundant coverage of partition borders. During query processing, the search first traverses the hierarchy of inner nodes of the NV-Tree. At each level of the tree, the query descriptor is projected to the projection line associated with the current node. The search is then directed to the sub-partition with center-point closest to the projection of the query descriptor. This process of projection and choosing the right sub-partition is repeated until the search reaches a leaf node. Then, the query descriptor is projected onto the projection line of the leaf node. The two descriptor identifiers on either side of the projected query descriptor are returned as the nearest neighbors, then the second two descriptor identifiers, etc. Thus, the k/2 descriptor identifiers found on either side of the query descriptor projection are alternated to form the ranked kapproximate neighbor of the query descriptor. Therefore, since no distance calculations are required, little CPU cost is incurred even for large collections.
2.2. METRIC ACCESS METHODS 9 In addition to the indexing techniques detailed above, several other SAM variants were proposed such as SS-tree [WJ96], SR-tree [KS97], S2-Tree [WP01], Hybrid-Tree [CM99], A-tree [SYUK00], IQ-tree [BBJ+00], Pyramid Tree [BBK98], NB-tree [FJ03], etc. However, SAMs have significant drawbacks for the indexing of large-scale multimedia databases. The applicability of SAMs is limited by the fact that the items have to be represented by the points in an N-dimensional feature space and the (dis)similarity measure between two points has to be based on a distance function in Lpmetric such as Euclidean distance. Furthermore, SAMs do not scale up well to high dimensional spaces and become less efficient than sequential indexing for dimensions higher than ten [WSB98]. 2.2 Metric Access Methods MAMs give a more general approach than SAMs since they employ the indexing process by assuming only the availability of a similarity distance function that is a norm. Therefore, multimedia databases with several multidimensional features are indexed according to this similarity distance function which is usually treated as a “black box”. Researchers have proposed several MAM-based indexing techniques: •VP-tree [Yia93]. The vantage point tree (vp-tree) is based on partitioning the feature vectors (data points) into two groups according to their similarity distances with respect to a reference point, a so-called vantage point. In vptrees, at every node of the tree, a vantage point is chosen among the data points, and the distances of this vantage point from all other points (the points which will be indexed below that node) are computed. Then, these points are sorted into an ordered list with respect to their distances from the vantage point. Next, the list is partitioned at positions to create sublists of equal cardinality. The structure of a binary vp-tree is very simple. Each internal node is of the form (Sv, M, Rptr, Lptr), where Svis the vantage point, Mis the median distance among the distances from Svto all the points indexed below that node, and Rptr and Lptr are pointers to the right and left branches. Left branch of the node indexes the points whose distance from Svare less than or equal to M, and right branch of the node indexes the points whose distances from Svare
10 CHAPTER 2. STATE OF THE ART greater than or equal to M. In leaf nodes, instead of the pointers to the left and right branches, references to the data points are kept. •MVP-tree [BO97]. Similar to the vp-tree, the mvp-tree partitions the data space into spherical cuts around vantage points. However, it creates partitions with respect to more than one vantage point at one level and keeps extra information for the data points in the leaf nodes for effective filtering of non qualifying points in a similarity search operation. Unlike the strategy followed in vp-trees, the vantage point does not have to be from inside the region. This means that we can use the same vantage point to partition the regions associated with the nodes at the same level. The mvp-tree takes this approach and uses more than one vantage points in the nodes for higher utilization. In the construction of the vp-tree structure, for each data point in the leaves, the distances between that point and all the vantage points on the path from the root node to the leaf node that keeps that data point are computed. In vptrees, such distances are not kept. However, the mvp-tree keeps these distances for the data points in the leaf nodes in order to provide further filtering at the leaf level during search operation. •GNAT [Bri95]. The Geometric Near-neighbor Access Tree (GNAT) is based on the philosophy that the data structure should act as a hierarchical geometrical model which reflects the intrinsic geometry of the underlying data. A knumber of split points are chosen at the top level. Each one of the remaining points are associated with one of the kdatasets (one for each split point), depending on which split point they are closest to. For each split point, the minimum and maximum distances from the points in the datasets of other split points are recorded. The tree is recursively built for each dataset at the next level. •M-tree [CPRZ97]. The M-tree is a balanced and dynamic tree, which is built from bottom to top, creating a new root level only when necessary. This tree organizes the objects into fixed-size nodes, which correspond to regions of the metric space. Nodes of the M-tree can store up to Mentries, which is the capacity of the nodes. For each indexed database element, one entry with format entry(Oj) = [Oj, oid(Oj), d(Oj, P(Oj))]
2.2. METRIC ACCESS METHODS 11 is stored in a leaf node. In entry(Oj), oid(Oj) is the identifier of the object which resides on a separate data file, Ojare the feature values of the object and d(Oj, P(Oj)) is the distance between Ojand P(Oj), which is the parent object of Oj. An entry in an internal (non-leaf) node stores a feature value, Or, also called arouting object, and a covering radius,r(Or)>0. The entry for a routing object Orincludes a pointer to the root of sub-tree and the distance from the parent object. The covering radius of a routing object Orsatisfies the inequality d(Oj, Or)≤r(Or) for each object Ojstored in the covering tree of Or. As any other dynamic balanced tree, M-tree grows in a bottom-up fashion. The overflow of a node Nis managed by allocating a new node, N0, at the same level of N, partitioning the M+ 1 entries among the two nodes, and then promoting relevant information to the parent node, Np. When the root splits, a new root is created and the M-tree grows by one level. •Slim-tree [TTSF00]. The Slim-tree is a dynamic tree for organizing metric datasets in pages of fixed size. It shares the basic data structure with other metric trees like the M-tree where data is stored in the leaves and an appropriate cluster hierarchy is built on top. The Slim tree differs from previous MAMs in the following ways. First, a split algorithm based on the Minimum Spanning Tree (MST) is used which performs faster than other split algorithms without sacrificing search performance of the MAM. Second, a new insertion algorithm which leads to considerably higher storage utilization is applied to guide an insertion of an object at an internal node to an appropriate subtree. Third, an algorithm called Slim-down makes the metric tree tighter and faster in a postprocessing step. This algorithm uses the “fat-factor” and the “bloat-factor” to measure the degree of overlap and improves the performance by minimizing overlaps between nodes. •M+-tree [ZWYY03]. The M+-tree is a tree dynamically organized for large datasets in metric spaces which takes full advantages of M-tree and MVP-tree, with a new concept called key dimension, which effectively reduces response time for similarity search. It inherits M-tree’s promotion mechanism, triangle inequality and the branch and bound technique. Furthermore, M+-tree fully utilizes the filtering twice idea used in MVP-tree and adopts the similar ideas of key dimension and the key dimension shift used in TV-tree in a novel way based
12 CHAPTER 2. STATE OF THE ART on the following concepts: (i) dimension can be ordered by their significance in a metric-space, and (ii) the active dimensions can be shift for enhancing the efficiency. •PM-tree [TSS04]. The Pivoting M-tree (PM-tree) is an extension of the M- tree which explotes pivot-based ideas for metric region volume reduction. Each metric region of M-tree is described by a bounding hyper-sphere (defined by a center object and a covering radius). However, the shape of a hyper-spherical region is far from optimal since it does not bound the data objects tightly together thus the region volume is too large. In order to build the PM-tree, a set of ppivots Pt, which belong to the database, must be selected. This set is fixed for all the lifetime of a particular PM-tree index. Furthermore, a new attribute called HR is also included in the routing entry. This attribute is an array of phr hyper-rings (phr ≤p) where the t-th hyper-ring HR[t] is the smallest interval covering distances between the pivot Pt and each of the objects stored in leaves of the subtree. For the ground entries, a new attribute called PD is also included. This attribute stands for an array of ppd pivot distances where the t-th distance PD[t] = d(Oi,Pt). Since each hyper-ring region defines a metric region containing all the object stored in the subtree, an intersection of all the hyper-rings and the hyper-sphere forms a metric region bounding all the objects as well. This new region is always smaller than the original M-tree region defined just by a hyper-sphere and bounds the indexed objects more tightly which, in turn, significantly improves the overall efficiency of similarity search. However, the existing MAMs present several drawbacks for similarity-based indexing of multimedia databases. The static MAMs, for instance, do not support dynamic changes such as new insertions or deletions, whereas this is an essential requirement during the incremental construction of a multimedia database. Even though M-tree and its variants provide dynamic database access, the incremental construction of the indexing tree could lead, depending on the order of the objects or the choice of its pre-fixed parameters, to significantly varying performances during the indexing and querying phases.
2.3. LOCALITY SENSITIVE HASHING 13 2.3 Locality Sensitive Hashing Locality Sensitive Hashing (LSH) [AI08] is an efficient indexing method to organize and query large-scale and high-dimensional database. The LSH algorithm relies on the existence of locality-sensitive hash functions. Let Hbe a family of hash functions mapping Rdto some universe U. For any two points pand q, consider a process in which a function hfrom His chosen uniformly at random, and analyze the probability that h(p) = h(q). Then, His called (R, cR, P1, P2)-sensitive if for any two points p, q ∈RdHsatisfies the following conditions: •if ||p−q|| ≤ Rthen PrH[h(q) = h(p)] ≥P1, •if ||p−q|| ≥ cR then PrH[h(q) = h(p)] ≤P2 In order for a locality-sensitive hash family to be useful, it has also to satisfy P1> P2. To put it simply, the principle of LSH is that nearby data points are hashed into the same bucket with a high probability while points faraway are hashed into the same bucket with a low probability. An LSH family Hcan be used to design an efficient algorithm for approximate near neighbor search. However, one typically cannot use Has is since the gap between the probabilities P1and P2could be quite small. Instead, an amplification process which consists in concatenating several hash functions is needed in order to achieve the desired probabilities of collision. In particular, for parameters kand L(specified later), Lfunctions gj(q)=(h1,j(q), ..., hk,j(q)) are chosen, where ht,j (1 ≤t≤k, 1≤ j≤L) are chosen independently and uniformly at random from H. These are the actual functions used to hash the data points. The data structure is constructed by placing each point pfrom the input set into a bucket gj(p), for j= 1, ..., L. To process a query q, we scan through the buckets g1(q), ..., gL(q) and retrieve the points stored in them. Then, we compare their distance to the query point and report any point which is a valid answer to the query. Larger values of klead to a larger gap between the probabilities of collision for close points (pk 1) and far points (pk 2). The benefit of this amplification is that the hash functions are more selective. At the same time, if kis large then pk 1is small, which means that L must be sufficiently large to ensure that an R-near neighbor collides
14 CHAPTER 2. STATE OF THE ART with the query point at least once. On the other hand, a larger number of hash tables results in a heavier memory consumption, which is the significant drawback of LSH. We want to give a solution to the KNearest Neighbor (KNN) problem. Let qbe the image query, i.e. the image used as example for searching the elements which are most similar to q. Then, the KNN problem consists in retrieving the kmost similar elements from the database to the image query given. However, LSH, by its nature, does not solve the KNN problem but the -near neighbor problem. Therefore, it answers a range search, gathering points within a predefined -distance from the query point. In order to adapt LSH for Knearest neighbor retrieval it has to be configured with a significantly large , which occasionally leads to a very large number of false positives [LJA11].
Chapter 3 Hierarchical Cellular Tree In [KG07], a novel indexing technique, called Hierarchical Cellular Tree (HCT), is presented and has been designed to bring an effective solution for indexing large multimedia databases. The elements are partitioned depending on their relative distances and stored within cells on the basis of their similarity. As its name implies, HCT is a hierarchical structure, which consists of one or more levels, and each level in turn holds one or more cells. Each cell has an element as a representative or nucleus, which is contained in a cell in the upper level except for the cell held by the top level. Figure 3.1 shows an HCT example extracted from [KG07] over a database containing 18 elements. In this example, the database elements have been divided into 6 different cells (A, B, C, D, E, F) on the ground level. Each cell’s representative (d for cell A, c for cell B, e for cell C, etc.) have been clustered in 3 different cells (A, B, C) on the first level in turn. Finally, the top cell from the top level consists of each cell’s nucleus (c for cell A, a for cell B and b for cell C) from the lower level. Furthermore, HCT is a self-organized tree, which basically means that the operations (item insertion, removal, etc.) are not externally controlled, but they are carried out according to some internal rules. The indexing structure is created in a bottom-up fashion, which means that the elements are always inserted in the ground level and, due to these insertions, the cells may suffer from mitosis or their nucleus may change, so these alterations are spread towards the top of the tree. The HCT is a MAM-based indexing technique which was developed in order to provide efficient solutions to the aforementioned shortcomings of the indexing algorithms in Chapter 2. Among all indexing structures presented, M-tree shows the highest 15
22 CHAPTER 3. HIERARCHICAL CELLULAR TREE retrieved in the target level (ground level for external insertions) presents the closest nucleus item with respect to the item to be inserted. Once the element is appended to the retrieved cell, this cell becomes subject to a generic post-processing check. First, the cell is examined for a mitosis operation. If the cell is mature, i.e. it contains a minimum number of elements, and its compactness is above the compactness threshold, then it is split into two newborn child cells. Therefore, the parent cell must be removed from that level and the two new child cells are inserted instead. Furthermore, the old nucleus (of the parent cell) must be removed from the upper level. The two new representatives of the child cells must be also inserted in the upper level by using the same insertion method based on the Pre-Emptive cell search but having the upper level as the target level instead of the current one. In case mitosis is not performed, it is necessary to check if the nucleus has changed due to the insertion. In such a case, the old nucleus is removed from the upper level and the new one is inserted by using the same pre-emptive technique. The HCT construction over an entire database is the result of inserting dynamically each of its elements one after the other in the ground level. As new elements are inserted some cells may be split, resulting in a tree that grows in a bottom-up way. Whenever the top cell is split, a new top level is created above it with a new cell containing the two new nucleus items resuting from the division of the old top cell. Figure 3.5 shows an illustrative example of HCT construction, extracted from [KG07], where the elements are represented by colored circles and the similarity between two elements is given by how similar in color they are. First, all the elements are inserted in the unique cell of the HCT, which is created in the ground level, until this becomes mature and not compact enough. In this example, this happens when the yellow ball labeled as 1 is inserted. As a result, the cell is split into two new cells and a new top level is created. The new nuclei of each child cell are computed (yellow ball labeled as 1 and red ball labeled as f) and inserted in the new top cell. For each new element to be inserted, the most similar cell is retrieved by using the Pre-emptive cell search algorithm. Therefore, balls labeled as 2, 3 and 5 are inserted in the “red-blue” cell and the ball labeled as 4 in the “yellow” cell. As a result of the insertion of the ball labeled as 5, the nucleus have changed, so the old nucleus is removed from the upper level and the new one is inserted. Then, when the new element labeled as 6 is inserted in the “red-blue” cell, this is split because it is mature and not focused enough. Therefore, two newborn child cells are created and the parent cell is removed
3.3. HCT OPERATIONS 23 Figure 3.5: Sample HCT Construction from the ground level. The old nucleus is removed from the upper level and the new ones are inserted instead. This process continues until all the elements of the database are inserted.
24 CHAPTER 3. HIERARCHICAL CELLULAR TREE 3.3.2 Item Removal This is an operation that does not require any cell search algorithm. When some elements of the cell have to be removed, they are taken out of the cell and then the cell becomes subject to a generic post-processing check. As a result of the items removal, three cases are possible: 1. The cell is depleted (No elements remain in the cell). In this case, if the owner cell is the top cell, it is removed and the top level is also removed from the HCT. On the contrary, if the cell to be removed does not belong to the top level, then the old nucleus must be removed from the parent cell in the upper level. 2. The cell is split. An item removal can result in a cell split if the cell is still mature but no longer compact enough once the element has been removed. In this case, the old nucleus must be taken out from the upper level, and the two representatives of the two newborn child cells have to be inserted in the upper level by using the insertion algorithm explained in Section 3.3.1. 3. The cell is not split. In this case, it is necessary to verify the need for the cell nucleus change. In such a case, the old nucleus has to be removed from the upper level and the new representative must be inserted instead by also using the insertion algorithm from Section 3.3.1. 3.4 Retrieval scheme over HCT In [KG07] a retrieval scheme called Progressive Query (PQ) [KG05] is proposed to be used over the Hierarchical Cellular Tree. This searching technique consists in performing periodical sub-queries over subsets of database items and allows the user to interact with the ongoing query process. The size of each subset is determined with respect to a suitable unit such as time to human perception. The order in which the comparisons are done is given by the Query Path (QP), which consists of the several subsets which the database has been divided into. Although the PQ can work within nonindexed database, the most advantageous way to perform PQ is to form the QP according to an indexing structure such as the Hierarchical Cellular Tree since an indexing scheme allows to form a QP in which the most relevant elements can be retrieved by earlier sub-queries. Next, the Query Path formation process is detailed by using an example extracted from [KG07] which is illustrated in Figure 3.6. In this
3.4. RETRIEVAL SCHEME OVER HCT 25 Figure 3.6: QP formation on a sample HCT body example, the element bfrom the top cell is the most similar element to the query item, so we visit the cell Cfrom the lower level. Then, the two elements hosted by this cell are compared with respect to the query item and since element bis the most similar again, the cell Efrom the ground level is appended to the query path. Then, we come back to the cell Cfrom the upper level and we visit the following most similar element, i.e. element f. Therefore, the cell Ffrom the ground level is appended to the query path. Since there are no elements left in the current cell, we come back to the top cell and visit the following most similar element, i.e. element c. Therefore, we visit cell Afrom the lower level. Since element cis again the most similar element, cell Bfrom the ground level is appended. This process goes on until all the ground level are appended to the query path. In such a way, cells C,Aand Dfrom the ground level would form the QP tail.
Chapter 4 Modifications to the original HCT In this chapter we present some modifications to the original Hierarchical Cellular Tree. First of all, we propose a redefinition of the covering radius cell value and a procedure to estimate it which are detailed in Section 4.1. Furthermore, we propose to use the Preemptive Cell Search algorithm at any level in order to make the HCT building more robust (see Section 4.2). Finally, we propose a few searching techniques and establish a criteria for determining the number of cells to be considered when an element retrieval is performed in Section 4.3. 4.1 Covering radius The covering radius is defined in [KG07] as the distance from the nucleus to the furthest element in the cell. However, we consider that we should take into account not only the elements belonging to the corresponding cell, but also all the elements belonging to its subtree, i.e. all the elements from the ground level cells that are hanging on the afore-mentioned cell. Thus, the covering radius defined in [KG07] is an approximation by defect, i.e. the covering radius value computed is always less than or equal to its actual value. Figure 4.1 presents an example in which all the elements in the cells C1,C2, and C3should be considered in order to compute the covering radius for the cell C9, instead of using only the elements belonging to the cell C9. Since the computation of the exact covering radius, i.e. the distance from the nucleus to the furthest element in the subtree, can have a high computational cost 27
28 CHAPTER 4. MODIFICATIONS TO THE ORIGINAL HCT C1 A BC D C2 E F C3 G HI C9 BEH C4 J KL C5 M N C10 K M C6 O P C7 Q RS C8 T U C11 ORT C12 E KR Figure 4.1: Covering radius during the dynamic HCT construction, we have decided to approximate it according to the following equation: rC=max(rC(SN), d(O1, ON) + rC(S1), ..., d(OM, ON) + rC(SM)) (4.1) where rC(Si) refers to the covering radius of the son cell of element Oiwith 1 ≤ i≤M,Mare the number of elements in the cell, and ONrefers to the nucleus object. Equation 4.1 gives an approximation by excess of the covering radius value, i.e. the covering radius computed is always greater than or equal to the actual covering radius value. This approximation has been also used in [CPRZ97] for M-tree and allows to keep the covering radius updated after new elements insertions with a low computational cost due to its recursivity. Each covering radius only depends on the graph of the own cell and the covering radius of its son cells from the lower level. For the cells belonging to the ground level, the covering radius is computed as the distance to the furthest element in the cells from the nucleus instead of using the approximation given by Equation 4.1. Using the same example as before (see Figure 4.1), the covering radius for the cell C9is computed as: rC(C9) = max(d(B, E) + rC(C1), rC(C2), d(E, H) + rC(C3))
4.2. HCT BUILDING 29 With this change in the covering radius definition, in spite of using the proposed approximation by defect, we can guarantee that no HCT branch will be wrongly discarded since we are using an approximation by excess for the covering radius. Therefore, the most suitable cell will be found whenever a new element is inserted. As we will see in Chapter 6, a better HCT building will result in a better performance of the image retrieval system over the HCT. 4.2 HCT building In [KG07] it is proposed to adopt a hybrid approach to build the HCT, using the Preemptive Cell Search algorithm only in a certain number of the uppermost levels and the Most Similar Nucleus technique for the lowest ones. However, we have decided to build the HCT by using the Preemptive Cell Seach algorithm over all the levels, since we consider that the HCT construction is a keystone to guarantee the quality of the results for the future query requests to be launched on the indexed database. That is the reason why we have also considered in Section 4.1 that the covering radius for any cell has to take into account all the elements holding to that cell, not only the elements belonging to the afore-mentioned cell. Furthermore, we propose a method for updating the covering radius to its actual value for all the cells of the HCT in order to improve the search time of the query requests based on the Preemptive Cell Search algorithm. In this way, since the covering radius is no longer an approximation by excess represented by Equation 4.1, the number of cells which will be visited is granted to be less or equal than when the approximation by excess is used. As a consequence, the number of comparisons between the query element and an element from the database is minimized, so the searching time will be also reduced. However, the approximation by excess is used again when a new element has to be inserted in order to compute the covering radius for the cells affected by the insertion process. This update method proposed for the covering radius can be performed not only after the HCT construction to reduce the retrieval times, but also during it in order to reduce the insertion time of future elements to be indexed. However, using this method every a few number of insertions results on a worse global HCT building time.
30 CHAPTER 4. MODIFICATIONS TO THE ORIGINAL HCT 4.3 Searching techniques over HCT We want to give a solution to the KNearest Neighbor (KNN) problem. Let qbe the image query, i.e. the image used as example for searching the elements which are most similar to q. Then, the KNN problem consists in retrieving the kmost similar elements from the database to the image query given. As seen in Section 3.4, the Progressive Query (PQ) is proposed in [KG07] as a retrieval scheme over the HCT. As it will be shown in Chapter 6, the K most similar elements do not belong to the Query Path (QP) initial part and, therefore, too many progressive sub-queries are necessary to be performed in order to achieve satisfactory results. As a consequence, these progressive sub-queries result in a too much high searching time. Thus, PQ fails in solving the KNN problem in an efficient way. That is the reason why we have implemented the following searching techniques in order to improve the PQ performance: •Most Similar Nucleus: This technique consists on descending through the HCT branch which gives the most similar element at each level. Therefore, the nearest element to the query image from the top cell is search and its son cell from the lower level is visited discarding the rest of cells of that level. This methodology is followed until a ground level cell is reached. The advantage of this searching technique is that the image retrieval is performed very fast. On the other hand, the Most Similar Nucleus can lead us to a local optimum far away from the optimal retrieved elements. This is because descending through the HCT branch which gives the most similar element at a given level does not guarantee that the ground level cell whose nucleus is the most similar one to the query image among all the ground level cell nuclei will be reached. •Preemptive Cell Search: This searching technique is based on the same idea as the insertion algorithm is. Therefore, the covering radius cell value is used to discard any HCT branch in which we can guarantee that the most similar element to the query image will not be found through it. It is for this searching technique that the covering radius redefinition proposed in Section 4.1 becomes essential, as well as the method for updating the covering radius to its exact value in order to minimize the number of visited cells and, therefore, reduce the searching time. By using this searching technique, the ground cell whose
4.3. SEARCHING TECHNIQUES OVER HCT 31 nucleus is the nearest one to the query image is always found. However, this fact does not mean than the most nearest element from the database will be retrieved since this element can belong to another cell. Anyway, this problem is inherent to any clustering algorithm, but the probability of not retrieving the most similar elements can be reduced by considering not only one cell but a few cells. On the other hand, regarding the searching time, the Preemptive Cell Search performance can never be better than the Most Similar Nucleus performance since the number of HCT branches analyzed is always greater than or equal to the number when the Most Similar Nucleus is applied, which only descends for one of the HCT branches. Therefore, since more cells are visited at each level, more comparison operations are also necessary, which results in a worse retrieval time. It is only when at each level all the cells except the one with the nearest nucleus can be discarded by using the covering radius that both searching techniques gives the same performance. •Hybrid: This searching technique is a hybrid of the two afore-mentioned techniques: (i) the Most Similar Nucleus and (ii) the Preemptive Cell Search. This technique tries to take advantage of the strong points of each one, i.e. the searching time of the Most Similar Nucleus and the retrieved results of the Preemptive Cell Search. With this objective, the latter technique is performed over the uppermost levels, in which an error can be critical for the search performance, whereas the Most Similar Nucleus is applied on the lowest levels, in which the cells are expected to be more focused and, therefore, their nucleus are expected to lead to the cell hosting the most similar elements to the query image. When this technique is used, the number of levels over which the Preemptive Cell Search algorithm will be performed must be specified. •Exhaustive: The exhaustive search technique consists in a linear search over all the elements of the database. Only this technique can guarantee that all the nearest elements to the query image will be found. On the other hand, this technique also would result in a linear search time (with respect to the number of images in the database) and, therefore, cannot be considered for large databases unless the user does not mind the retrieval time. In such a case, we would not take advantage of the hierarchical clustering. However, this searching technique can also be used on an given level and be combined with other techniques on the lowest levels as in the Hybrid approach.
38 CHAPTER 5. IMPLEMENTATION A constructor with the maturity size as an input parameter has been implemented. This constructor is called each time the top cell is split and a new top level is to be created. There is also a method that allows changing the maturity size of the level since in [KG07] it is proposed to have a different value for the top level. Therefore, each time a new top level is created, the maturity size of its lower level, i.e. the former top level, must be changed. There is no need of an insertion or removal method since the STL container set has its own methods (insert and erase) which are used whenever a cell must be either inserted or removed from a level. 5.3 HCT Implementation The Hierarchical Cellular Tree has been implemented as a vector (STL container) of Level objects. The HCT constructor has only two input parameters: (i) the maturity size of an inner level (m_size), and (ii) the maturity size of the top level (m_size_top_level): HCTree(uint64 m_size = 7, uint64 m_size_top_level = 7) This section has been divided into four subsections according to the different operations which can be performed over an HCT: (i) the insertion methods, (ii) the removal methods, (iii) the fitness check operations, and (iv) the proposed update method for the covering radius. 5.3.1 Insertion methods Once the HCT object has been created, the Hierarchical Cellular Tree is built by calling an insertion method in a dynamic way for each element of the database to be indexed. However, we have to differentiate between two insertion methods: •A public method used for inserting new elements to be indexed. The element is inserted in a cell from the ground level. The syntaxis is the following one: void insert(typename CellType::VDType& new_elem, std::string uri_name, std::string key = "-")
5.3. HCT IMPLEMENTATION 39 where new_elem is the new element to be indexed, uri_name is the pathname of the element inserted, and key is the element identifier. •A private method which cannot be controlled externally. This method is called automatically when a cell nucleus has to be inserted in the upper level due to either a cell split or a nucleus change. The syntaxis is the following one: void insert(typename CellType::VDType& new_elem, std::string uri_name, uint64 level_num, CellTypePointer son, std::string key = "-") where new_elem,uri_name, and key are the same parameters as before, level_num is the level number in which the element is to be inserted, and son is a pointer to the cell from the lower level whose nucleus is the element being inserted. The insert methods (both public and private) are based on the Preemptive Cell Search algorithm proposed in [KG07]. This algorithm consists in searching the optimal cell from a given level (the ground level if it is an external insertion) for the new element to be inserted. The optimal cell, which will be called owner cell, is considered as the cell whose nucleus is the nearest one to the element being inserted. Beginninng from the top level, the most similar element at the current level is found, which is dmin far from the new element. Then, for each element, if the distance to the new element minus the covering radius of the son cell is greater than dmin the son cell and the whole subtree can be discarded. In this way, we have the certainity that the optimal cell will be found and the computational cost is expected to be lower than an exhaustive search. As said in Section 4.1, we proposed an approximation by excess for the covering radius instead of using the exact value. This approximation has as advantage that the optimal cell is never discarded and that the computational cost of keeping updated an approximated value for the covering radius is much lower than doing it with the exact value. On the other hand, using this approximation by excess can result in an increment of the visited cells during future insertions or query requests. Next, there is how the Preemptive Cell Search algorithm is called from the insert method:
40 CHAPTER 5. IMPLEMENTATION //! Type to refer to a pointer to CellModel typedef CellModel* CellTypePointer; CellTypePointer owner_cell; std::vector<CellTypePointer > cells; for(typename std::set<CellTypePointer >::iterator it= _tree_container[top_level_num].cells.begin(); it!=_tree_container[top_level_num].cells.end(); ++it) { cells.push_back(*it); } owner_cell = _preemptive_cell_search(cells, new_elem, top_level_num, level_num); where _tree_container is the STL container vector of Level objects, cells is a parameter which consists of the cells we have to consider from the current level during the search (in this case, since the search starts on the top level, only the top cell is pushed back), new_elem is the element being inserted, top_level_num is the level on which the search starts, and level_num is the level on which the owner cell for the new element has to be found. The searching process for the optimal cell will not be necessary when the element has to be inserted on the top level or on a level that is above the top one. In the former case, there is only one cell on the top level so the element will be inserted on it: owner_cell = *(_tree_container[top_level_num].cells.begin()); This happens when the HCT consists of only one level or when a cell from the second top level has changed its nucleus or has suffered from a mitosis operation and the new nucleus or nuclei has to be inserted on the top level. In the latter case, when the top cell is split due to an insertion, then a new top level is created where the two nuclei from the two newborn cells are inserted on it:
5.3. HCT IMPLEMENTATION 41 Level<CellType> new_top_level(_maturity_size_top_level); CellTypePointer new_top_cell = new CellType(new_elem, uri_name, key, son); new_top_level.cells.insert(new_top_cell); _tree_container.push_back(new_top_level); _tree_container[level_num].num_insertions = 1; Once the owner cell is found, if the pointer to the son cell is not NULL, i.e. the insert method has been called internally for promoting a new nucleus on the upper level, then the parameter parent cell from the son cell will be pointing to the owner cell. Then, the element is appended to this cell by calling the insert method from the cell object and the parameter num insertions from that level is incremented: if(son!=NULL) { son->parent_cell = owner_cell; } owner_cell->insert(new_elem, uri_name, key, son); _tree_container[level_num].num_insertions++; Once the element has been appended to the owner cell, this cell is submitted to a post-processing check: _post_processing(owner_cell, old_nucleus, level_num); where old_nucleus is the cell nucleus before being post-processed and level_num is the level which the owner cell belongs to. First of all, it is checked if the compactness threshold has to be updated by comparing the number of insertions performed on the current level with the updating period, i.e. every kinsertions the compactness threshold is updated, where khas been set to 10 in our experiments. The compactness threshold is computed by using Equation 3.1 from Section 3.2, where k0has been set to 1.25 since this value is recommended in [KG07]. Then, the number of elements which belong to owner cell is compared with the mature size of the level level num to check if the cell is mature. On that point, we can have two different cases:
42 CHAPTER 5. IMPLEMENTATION •Case 1: The cell is not mature or the cell is mature but compact enough. Therefore, the cell is not split. We have to check if the owner cell’s nucleus has changed. In that case, if we are not at the top cell, the old nucleus is removed from the upper level and the new representative is inserted in it: _remove(old_nucleus, owner_cell->parent_cell, level_num+1); insert(new_desc, new_uri, new_key, level_num+1, owner_cell); where new_desc is the new nucleus to be inserted in the upper level (level_num+1) with new_uri pathname and new_key identifier, and owner_cell is the pointer to the son cell. On the other hand, if the nucleus has not changed we have to check if the covering radius has been modified. In such a case, the parent cell’s covering radius may have also changed. We check it by calling the function: _check_parent_covering_radius(owner_cell, level_num); which is called recursively until either the top cell or a parent cell whose covering radius has not changed is reached. This function updates the covering radius for the visited parent cells. •Case 2: The cell is mature but not compact enough. We look for the edge with the largest weight by iterating through the edges of the owner cell’s graph. Two newborn cells (left_cell and right_cell) will be constructed by splitting the MST at the retrieved edge. In order to know to which cell belongs each vertex, the edge is removed from the MST and from each one of its two vertices (one will belong to the left_cell and the other one to the right_cell) we iterate through the edges of the MST and add each new vertex to the respective newborn cell. When we visit an MST edge we can have two different cases: (i) none of its two vertices belongs to one of the two newborn cells yet or (ii) one of its vertices belongs to one of the two newborn cells. In the former case, the edge is skipped for the time being. In the latter case, if one vertex of the edge in which we are belongs to, let’s say, the left_cell, then the other vertex is also appended to the left_cell and the edge is erased from the MST. We go on iterating through the MST edges until there is no edge left. Once all the vertices have been appended to either the left_cell or the rigth_cell, the two new graphs are built. The edge weights of the two new graphs are not recomputed
5.3. HCT IMPLEMENTATION 43 but they are got from the owner cell’s graph. Then, the update parameters cell method is called for both cells in order to update the different parameters which characterize a cell (mean weight, var weight, max weight, covering radius and compactness). Next, the two newborn cells are appended to the set (STL container) of cells belonging to the level given by level_num. In addition to this, the parent cell parameter of the son cells pointed by the property index1 from every vertex of the two new cells are updated by pointing the respective cell instead of the original owner cell. Then, if we are not at the top cell, the owner cell’s nucleus (old_nucleus) is removed from the upper level: _remove(old_nucleus, owner_cell->parent_cell, level_num+1); Finally, the cell pointer to the owner cell is erased from the set of cells of the current level, the content pointed by the owner cell is deleted and the two nucleus from the newborn cells are inserted in the upper level: _tree_container[level_num].cells.erase(owner_cell); delete owner_cell; insert(desc_left, uri_left, key_left, level_num+1, left_cell); insert(desc_right, uri_right, key_right, level_num+1, right_cell); where desc_left and desc_right are the two nucleus to be inserted in the upper level (level_num+1) with the respective pathname (uri_left and uri_right), identifiers (key_left and key_right) and the pointer to the son cell (left_cell and right_cell). 5.3.2 Removal methods The Hierarchical Cellular Tree construction also allows the removal of items from the indexing structure. As in the insertion case, we also have to differentiate between two removing methods: •A public method used for removing an element from the indexed database. The syntaxis is the following one: void remove(std::string elem_to_remove)
44 CHAPTER 5. IMPLEMENTATION where elem_to_remove is the pathname of the element to be removed. •A private method which cannot be controlled externally. This method is called automatically when a cell nucleus has to be removed from the upper level due to a cell split, a nucleus change or a item removal from the indexed database. The syntaxis is the following one: void _remove(std::string uri_name, CellTypePointer owner_cell, uint64 level_num, bool from_depleted_cell = false) where uri_name is the pathname of the element to be removed, owner_cell is the cell which hosts this element, level_num is the level number from which the element has to be removed, and from_depleted_cell is a boolean value which indicates whether the son cell from the lower level had become depleted after the previous item removal. The public remove method is called whenever an element from the database is not wanted to belong to the indexing structure any longer. We have two different cases depending on the number of elements belonging to the cell from which the element will be removed: •Case 1: There is only one element. Therefore, the cell will be depleted after the element removal. If there is only one level which only contains the top cell, then the cell is erased from the ground (and top) level’s set of cells and the level is also pop back from the HCT’s vector of levels ( tree container). In such a case, the whole HCT would be depleted. On the other hand, if there is more than one level, it means that the cell from which the element has to be removed does not belong to the top level. In such a case, the vertex is cleared and removed from the graph, the cell pointer is erased from the current level and the element, which was the nucleus of the depleted cell, must be removed from the upper level by calling the private remove method with the parameter from_depleted_cell set to true: _remove(parent_uri, parent_cell, 1, true);
5.3. HCT IMPLEMENTATION 45 where parent_uri is the same pathname as elem_to_remove and parent_cell is the cell from the level 1 (level above the ground level) to which the parent_uri belongs. •Case 2: There is more than one element. Therefore, the cell will not be depleted after the item removal. In this case, the vertex is cleared and removed from the graph and the MST is recomputed. Next, the cell parameters are updated by calling the cell method update parameters. Finally, the cell is subject to a generic post processing as the explained before in the description of the method post processing, which is also called by the insertion algorithm. As said before, an element has to be removed from a cell not only when it has been removed from the database. There are other situations in which an element is removed internally due to the dynamic approach for the HCT building. The cells can split and, therefore, the old nucleus has to be removed from the upper level where the two new representatives will be inserted. Or simply a cell nucleus may have changed and it is necessary to change it in the upper level. These cases can occur after both an item insertion and removal. The way to proceed of the private remove method is very similar to the public one. The main differences are detailed next: •If an element is removed from the top cell and this cell becomes depleted, then the new top level is the lower level and, therefore, its maturity size has to be changed. •If an element is removed from the top cell which has only two elements and the element to be removed is the nucleus of a depleted cell from the lower level, then the whole top cell has to be removed since we have the certainity that the element has not been removed due to a nucleus change and, therefore, only one element would belong to the top cell. 5.3.3 Fitness Check operations We have also implemented one of the fitness check operations proposed in [KG07] which is called Outliers Check. The objective of this operation is to minimize the corruption, which might have occurred due to the order in which the elements have been inserted, by reinserting the elements which belong to minor cells, i.e. cells with
46 CHAPTER 5. IMPLEMENTATION only one or a few items in it. So what we expect is that some mature or not minor cells may host these elements. However, if the element insertion in the most suitable cell results in a significant degradation on the cell compactness the cell may suffered from a mitosis operation and the reinserted element may be hosted by a minor cell again. In such a case, this means that the given element is an actual outlier and belongs to a minor cell not due to the insertion order of the items. This operation is performed for all levels in decreasing order from top to bottom except for the top level since there is only one cell in it and can be performed periodically during or after the HCT building. We have implemented this method only for minor cells hosting one element, but not for cells hosting a few items, since we consider that this is the worst case. The way to proceed is the following one: 1. We iterate through the cells of the current level until a minor cell hosting only one element is found. If there are no minor cells, we descend to the lower level. 2. Once a minor cell is found, its element is removed from the cell (so is the cell, since becomes depleted) and is reinserted in the HCT at the current level. The identifier of the reinserted element is stored in a temporal vector in order to detect the possible real outliers. 3. We go on iterating through the cells and repeating Step 2 until there are no minor cells or all the existing minor cells host elements which have been already reinserted. Then, if we are at the ground level the algorithm has finished. Otherwise, we descend to the lower level and go back to Step 1. 5.3.4 Update method for covering radius Finally, the update covering radius method presented in Section 4.2 has been implemented. This method consists in searching, for each nucleus of each cell and at each level, the farthest element which is hosted by a ground level cell which belongs to the subtree which has the afore-mentioned cell as root. To illustrate it better, let us suppose that we have the HCT represented in Figure 5.1. If the update covering radius method is called over this HCT, the covering radius will be updated for the cells C9, C10,C11 and C12. When the covering radius for the cell C9has to be updated, a method which returns the ground level cells belonging to the subtree which has the
5.4. WRITE/READ HCT OPERATIONS 47 C1 A BC D C2 E F C3 G HI C9 BEH C4 J KL C5 M N C10 K M C6 O P C7 Q RS C8 T U C11 ORT C12 E KR Figure 5.1: Updating covering radius cell C9as root is called. Therefore, this method returns the cells C1,C2and C3. Then, the elements from these cells are compared to the nucleus of the cell C9, i.e. the element E, and the distance given by the farthest element becomes the covering radius. For the covering radius of the cell C10 and C11, the elements from the cells C4and C5, and C6,C7and C8are compared with the elements K and R respectively. Finally, the elements from all the ground level cells are all compared with K in order to update the covering radius for the top cell C12. 5.4 Write/Read HCT operations The HCT building over a large database is a high cost operation. That is the reason why the implementation of input and output operations for storing the indexing structure in the hard disk and for reading the HCT from it is essential. Otherwise, any modification on the HCT or any unpredicted query request would imply to rebuild the HCT from scratch as long as we are not working over a server/client architecture. In such a case, we would have a process which would be continously listenning for possible query requests, new element insertions or element removals. However, if the HCT was not stored at disk we would also run the risk of a server failure and the HCT would need being rebuilt again from scratch. The WriteHCTree class allows to write the Hierarchical Cellular Tree at disk by calling
54 CHAPTER 5. IMPLEMENTATION GOS (Graphic Object Searcher) [CY09] to visualize the results in a handier way. Argument type. •num results: Number of retrieved images expected to be retrieved for the user. Option type. Its default value is 10. •PreviousHCTreeColorStructure: TXT filename containing an HCT which has been built according to the Color Structure descriptor and is wanted to be loaded in order to perform query requests over it. Option type. Its default value is “-”. •PreviousHCTreeColorLayout: TXT filename containing an HCT which has been built according to the Color Layout descriptor and is wanted to be loaded in order to perform query requests over it. Option type. Its default value is “-”. •PreviousHCTreeDominantColor: TXT filename containing an HCT which has been built according to the Dominant Color descriptor and is wanted to be loaded in order to perform query requests over it. Option type. Its default value is “-”. •PreviousHCTreeEdgeHistogram: TXT filename containing an HCT which has been built according to the Texture Edge Histogram descriptor and is wanted to be loaded in order to perform query requests over it. Option type. Its default value is “-”. •VDColorStructure: Whether Color Structure descriptor is considered or not for the search. If this parameter is used, then an HCT based on that descriptor must be loaded by using the PreviousHCTreeColorStructure option. Flag type. •VDColorLayout: Whether Color Layout descriptor is considered or not for the search. If this parameter is used, then an HCT based on that descriptor must be loaded by using the PreviousHCTreeColorLayout option. Flag type. •VDDominantColor: Whether Dominant Color descriptor is considered or not for the search. If this parameter is used, then an HCT based on that descriptor must be loaded by using the PreviousHCTreeDominantColor option. Flag type. •VDEdgeHistogram: Whether Texture Edge Histogram descriptor is considered or not for the search. If this parameter is used, then an HCT based on that
5.7. HCT OVER A SERVER/CLIENT ARCHITECTURE 55 descriptor must be loaded by using the PreviousHCTreeEdgeHistogram option. Flag type. •ColorStructureWeight: Weight for Color Structure descriptor. It is used when more than one visual descriptor is considered. It is a float number. Option type. Its default value is 1. •ColorLayoutWeight: Weight for Color Layout descriptor. It is used when more than one visual descriptor is considered. It is a float number. Option type. Its default value is 1. •DominantColorWeight: Weight for Dominant Color descriptor. It is used when more than one visual descriptor is considered. It is a float number. Option type. Its default value is 1. •EdgeHistogramWeight: Weight for Texture Edge Histogram descriptor. It is used when more than one visual descriptor is considered. It is a float number. Option type. Its default value is 1. •interactive: Mode in which the user can perform a new retrieval by changing some configuration parameters once the original query request has been completed. Flag type. Next, we give an example of an hct query tool call: hct_query /imatge/.../image-vd.xml /imatge/.../results/ --num_results=20 --PreviousHCTreeColorStructure=/imatge/.../tree-cs.txt --VDColorStructure where the HCT based on the Color Structure descriptor and stored in the tree-cs.txt file is loaded and the 20 most similar images to the query image (its descriptor is read from the image-vd.xml file) retrieved by the preemptive search technique are stored in an XML file of the results directory. 5.7 HCT over a server/client architecture The image retrieval system based on the Hierarchical Cellular Tree indexing technique has been also implemented over a server/client architecture which can support several
56 CHAPTER 5. IMPLEMENTATION clients who are allowed to launch query requests over an image database. Therefore, a daemon program which loads an indexed database and is constantly running waiting for new query requests is necessary. Furthermore, we also need a means of communication between the receiver of the query requests (the server) and the sender (the client). With this purpose, a messaging system called KSC (Keni Socket Communication) [Jor09] has been selected. This system emerged from the need of an asynchron messaging system which allowed different modules to communicate each other in the CHIL (Computers in the Human Interaction Loop) European project [Chi]. In a KSC system, there is only one server and several clients. The objective of the server is to control the registration of the clients, to find out to which message type the clients subscribe and to forward the messages to the subscribed clients. There are two kinds of clients: (i) writers and (ii) readers. There can be only one writer for each message type whereas there is no restriction on the number of readers. When a writer creates a message, this message is sent to the server since the writer does not know which clients are subscribed to this message type. That is the reason why the server establishes the communication between the writer and the readers by forwarding the messages and manages the subscription queries. In Figure 5.2, a scheme of the KSC messaging system extracted from [Jor09] is represented. Figure 5.2: Scheme of the KSC messaging system
5.7. HCT OVER A SERVER/CLIENT ARCHITECTURE 57 Based on this scheme, two tools have been implemented: (i) the hct building tool and (ii) the query request tool. The former is the responsible for indexing the image database and carry out the query requests sent by the query request tool. Thus, once the image database has been indexed, the hct building subscribes as a receiver to a message type named SearchKSCMessage. It is the query request tool which subscribes as a sender to this kind of message in order to communicate with the hct building tool trough the KSCenter and define the parameters of the search. The SearchKSCMessage has the following structure: class SearchKSCMessage { public: char query[256]; char results[256]; uint64 num_results; bool VDColorStructure; bool VDColorLayout; bool VDDominantColor; bool VDEdgeHistogram; bool fusion; float64 ColorStructureWeight; float64 ColorLayoutWeight; float64 DominantColorWeight; float64 EdgeHistogramWeight; bool exhaustive; bool preemptive; uint64 exhaustive_level; char file_type[256]; }; where each SearchKSCMessage member has the same meaning as the configuration parameters of the hct query tool. These parameters are set by the user through the query request tool input parameters, which are used in the same way as the hct query tool. There are two additional parameters in order to establish the communication with the KSCenter:
58 CHAPTER 5. IMPLEMENTATION •host: the host where the KSC server has been launched. Option type. Its default value is the local host. •port: the port on which the KSC server is listening for requests. Option type. Its default value is 4444. These two parameters allow our architecture to have different servers communicated with several clients each one. In this way, we can have different image database indexed each one on a different host or port. Thus, the user can perform his query requests over different image database as long as they have been indexed by the hct building tool each one on a different port or host, which the user must know. As said before, the hct building is the responsible for indexing the database. This tool has to be executed before launching any query request. Its input parameters are the same as the database indexing ones, except the two additional parameters (host and port) which are necessary for the KSC communication. Apart from these two tools, one of them subscribing as receiver and the other one as sender of the SearchKSCMessage type, it is also necessary the KSC server, which is the first to be executed since it supplies the communication mean between the two former ones. The KSC server is launched by command line: >$ KSCenter port Where port is the port number on which we want to establish the communication between the hct building and query request tools. After launching the KSC server, the following message shoud appear on the console: >$ KSC started. Listening for request on port port Both hct building and query request tools also subscribe to another message type named SearchCompletedKSCMessage. This time it is the hct building which subscribes as a sender and the query request as a receiver. This message is used to inform that the searching process has been properly completed. A scheme of the KSC architecture for our image retrieval system is illustrated in Figure 5.3.
5.7. HCT OVER A SERVER/CLIENT ARCHITECTURE 59 KSC Server hct building READER Sign in (A) query request WRITER Sign in (B) SearchKSCMessage hct building WRITER Sign in (C) Search Completed KSCMessage query request READER Sign in (D) SearchKSCMessage Search Completed KSCMessage Figure 5.3: Our KSC architecture scheme An example of use of the HCT over the server/client architecture is shown following: 1. First of all, the KSC server is executed on the 147.83.50.77 host: >$ KSCenter 4444 2. The hct building tool is called to index the desired image database over which the query requests will be performed: >$ hct_building --database=/imatge/cventura/.../database.txt --VDColorStructure --host=147.83.50.77 --port=4444 3. Finally, the query request tool is launched each time the user wants to perform a new image retrieval: >$ query_request /imatge/.../image-vd.xml /imatge/.../results/ --num_results=20 --VDColorStructure --preemptive --port=4444 --host=147.83.50.77 As in the hct query tool, the format of this output file, which is created by the hct building once the requested search has been completed, is compatible with the graphic interface GOS (Graphic Object Searcher) to visualize the results in a handier way. This interface manages the user interaction with the query by example system implemented in [Ven10], allowing the user to retrieve some images similar to the query in an attractive and intuitive way. Furthermore, thanks to the support of the
60 CHAPTER 5. IMPLEMENTATION Figure 5.4: Configuration of the HCT parameters in the GOS image researching group, the GOS has been also adapted in order to launch the query requests over the HCT directly from this graphic user interface. Thus, if we access to File >Preferences we can configure the GOS so that the search are performed over an indexed image database as it is shown in Figure 5.4. We have to choose the option Use HCT and specify the path of the query request executable in the Path to the HCT Search Engine field. Furthermore, we choose the option Memory Tree and specify the values of the Host and Port parameters in which the hct building tool is running waiting for new query requests. These configuration parameters are saved for future retrievals.
Chapter 6 Experimental results Once the Hierarchical Cellular Tree and several searching techniques have been implemented, we proceed to their evaluation in order to know whether the proposed modifications improve the original implementation. First of all, in Section 6.1 we set the experiments which have been carried out. Thus, the different parameters to be analyzed are defined as well as the image database over which the experiments have been carried out. Next, the HCT building is evaluated in Section 6.2 by analyzing its intrinsic HCT parameters as well as the time required for the HCT to be built and the time required for some post processing methods. It is in Section 6.3 where the retrieval system is evaluated according to several retrieval performance measures defined in the literature. Finally, many illustrative query requests examples from the image database are shown in Section 6.4. 6.1 Setting the experiments In this section we are going to define the framework for the experiments, i.e. which factors are going to be analyzed, which image database has been indexed for evaluating the retrieval system and which criteria have been used in order to compare the database elements. Basically, we have different kinds of HCT to be evaluated since the tree construction depends on several factors: •The covering radius. The HCT can be built according to either the original covering radius proposed in [KG07] or our proposed approximation by excess (see Section 4.1). 61
62 CHAPTER 6. EXPERIMENTAL RESULTS •The update method for the covering radius (see Section 4.2). Whether this method is applied once the HCT has been built in order to have the exact values for the covering radius or not. •The outliers check method (see Section 5.3.3). Whether this method is applied once the HCT has been built in order to minimize the number of minority cells or not. Therefore, we have 8 (23) differents HCTs. Furthermore, we also want to evaluate how the maturize size has an influence on the results evaluation. Thus, we have set 3 differents values for this parameter: •We have set the values proposed in [KG07], which are 6 and 24 for maturity size and top maturity size, respectively. •In order to evaluate whether setting the same value to the top level has any influence on the performance, we have set both the maturity size and the top maturity size to 7 •In order to evaluate how the HCT performes when a larger maturity size value is used, we have set both the maturity size and the top maturity size to 12. These HCTs have been built over a database which consists of 216,317 images. These images are keyframes which have been extracted from the video content given by the Corporaci´o Catalana de Mitjans Audiovisuals (CCMA), which is involved in the CENIT Buscamedia project [Bus]. The image database used is divided in several assets which represent different video sequences. The content of these videos is generic since we can find news programs, sport events such as soccer matches or Formule One races, cultural programs, political debates, etc. In Figure 6.1, some images from the database are presented. For all these images, the MPEG-7 Color Structure Descriptor has been computed and has been stored in XML files. We have chosen this descriptor for the experiments since the Color Structure gave the best performance for image retrieval in [Ven10]. Therefore, the HCTs have been built based on this descriptor and the Jeffrey divergence [Ven10] as its dissimilarity measure since this distance gave the best results.
6.2. HCT BUILDING EVALUATION 63 Figure 6.1: Sample images from CCMA database 6.2 HCT building evaluation Although the main objective of these experiments is to evaluate how fast the retrieval system is and how good the obtained results are depending on the searching technique and the HCT used, we also want to analyze the intrinsic parameters of the HCT, which are independent from the retrieval system. In other words, the HCT parameters reflect how well performed the hierarchical clustering is. Thus, for each HCT, the following parameters have been studied: •Number of levels: Number of levels into which the HCT has been hierarchically divided. •Number of cells: Number of cells belonging to the ground level. •Mean cell size: A cell from the ground level consists of the number of elements on average. •Variance cell size: Variance of the number of elements belonging to each ground level cell. •Number of mature cells: Number of cells from the ground level which are mature, i.e. the cells which consist of more elements than the maturize size. •Percentage of mature cells: Relative number of mature cells in the ground level.
70 CHAPTER 6. EXPERIMENTAL RESULTS 0 0.5 1 1.5 2 2.5 x 105 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 x 105 X: 2.1e+05 Y: 4.461e+05 Number of elements inserted HCT building time (s) X: 2.1e+05 Y: 3.862e+05 X: 2.1e+05 Y: 3.716e+05 X: 2.1e+05 Y: 3.417e+05 X: 2.1e+05 Y: 4.84e+04 original covering radius proposed covering radius proposed covering radius with update method every 5000 insertions proposed covering radius with update method every 10000 insertions proposed covering radius with update method every 25000 insertions Figure 6.6: HCT building time comparison for update method of the covering radius 0 50 100 150 200 250 0 0.5 1 1.5 2 2.5 3 X: 200 Y: 0.3473 X: 201 Y: 2.545 X: 202 Y: 1.85 X: 210 Y: 0.7931 X: 204 Y: 1.393 X: 216 Y: 0.7357 Elements previously inserted ( x 1e03 ) Insertion time (s) Figure 6.7: HCT insertion time for original covering radius when the update method of the covering radius is applied after 200,000 elements have been inserted
6.3. RETRIEVAL SYSTEM EVALUATION 71 database with respect to an exhaustive search. On the other hand, the retrieval times are expected to be better by using the searching techniques over the HCT than a linear search over the whole image database, which results in a retrieval time of 10 seconds approximately. Thus, as in all systems of this kind, we expect a compromise between the retrieval time and the quality of the retrieved images. First of all, we are going to evaluate independently these two factors for each proposed searching technique and each HCT built. In order to evaluate the retrieval system, we have chosen randomly 1,082 images from the database which have been used as queries. They have been chosen by taking an image out of every 200 images. Then, for each query image, an exhaustive search has been carried out to know which are the most similar images to the query one. Next, for each HCT built and for each searching technique a new ranking is obtained. These new rankings consist in approximations of the nearest neighbours for each image query. Therefore, these new rankings must be compared with the ranking obtained by the exhaustive search. Since in both the exhaustive and the approximate rankings the elements are not sorted at the cellular scale but at the element scale, the elements belonging to both rankings, i.e. the elements in common, will be sorted in the same order. Thus, the approximated ranking can be formed by taking the exhaustive ranking and removing the elements which have not been found by the searching technique used over the HCT. In order to compare the approximate rankings with the exhaustive ranking, we use three different measures which have been found in the literature for comparing top k lists: •Mean Competitive Recall [CPR+07][SMR04][Ger07]. Let kbe the number of images we want to retrieve and A(k, q, E) the set of kimages retrieved by the searching technique A(Preemptive Cell Search,Most Similar Nucleus and Hybrid) for an image query qon our indexed image database E. Let GT (k, q, E) be the set of the knearest neighbours to the image query qwhich has been obtained through an exhaustive search. Then, the competitive recall CR(A, q, k) is defined as the number of elements belonging to the instersection of both sets, i.e. CR(A, q, k) = |A(k, q, E)∩GT(k, q, E)|. Note that competitive recall is an integer number in the range [0, ..., k] and a higher value indicates higher quality. The Mean Competitive Recall CR is the average of the competitive recall over
72 CHAPTER 6. EXPERIMENTAL RESULTS a set of queries Q: CR(A, Q, E) = 1 |Q|X q∈Q CR(A, q, k) (6.1) In our experiments, Qis the set of 1,082 query images chosen randomly from the image database. •Mean Normalized Aggregate Goodness [SMR04][Ger07]. Let FS(k, q, E) be the set of kimages in the image database Efarthest from the image query q. Let W(k, q, E) be the sum of distances of the kfarthest elements from q: W(k, q, E) = X p∈F S(k,q,E) d(q, p) where d(p, q) is the distance from the image query qto the image pwhich belongs to the set FS. In our experiments, this distance is the (dis)similarity measure for the MPEG-7 Color Structure Descriptor. Then, the Normalized Aggregate Goodness (NAG) is defined as: NAG(k, q, A) = W(k, q, E)−Pp∈A(k,q,E)d(p, q) W(k, q, E)−Pp∈GT (k,q,E)d(p, q) where, as in the Mean Competitive Recall, A(k, q, E) is the set of kimages retrieved by the searching technique A(Preemptive Cell Search,Most Similar Nucleus and Hybrid) for an image query qon our indexed image database E and GT(k, q, E) is the set of the knearest neighbours to the image query q which has been obtained through an exhaustive search. Note that the NAG is a real number in the range [0,1] and a higher value indicates higher quality. The NAG is 1 only when the knearest elements are retrieved and is 0 only when the kfarthest elements are retrieved. Thus, the Aggregate Goodness is normalized with respect to the worst possible result. Then, the Mean Normalized Aggregate Goodness results from the average of the NAG over a set of queries Q: NAG(A, Q, E) = 1 |Q|X q∈Q NAG(A, q, k) (6.2) •Kendall distance [FKS03]. This distance is a variation of the standard Kendall’s tau metric between permutations [Ken70]. A permutation σis a bijection from a set D(in our case the image database) onto the set [n] = {1, ..., n}where nis
6.3. RETRIEVAL SYSTEM EVALUATION 73 the size of |D|. Therefore, in our context, a permutation represents the order in which the images from the database have been sorted with respect to the query image, i.e. the ranking over the whole image database. For a permutation σ, let σ(i) be the position of the element iin the rank. We say that iis ahead of j in σif σ(i)< σ(j). Let P={{i, j}|i6=jand i, j ∈D}be the set of unordered pairs of distinct elements. Let σ1and σ2be two permutations to be compared. Then, for each pair {i, j} ∈ Pof distinct members of D, if iand jare in the same order in both permutations there is no penalization, i.e. Ki,j(σ1, σ2)=0; otherwise, Ki,j(σ1, σ2)=1. Finally, Kendall’s tau is given by: K(σ1, σ2) = X {i,j}∈P Ki,j(σ1, σ2) Kendall’s tau turns out to be equal to the number of exchanges needed in a bubble sort to convert one permutation to the other. This distance is modified in [FKS03] not to compare permutations but top klists. The main difference to be considered is that two top klists τ1and τ2over the same database can have different elements, i.e. an element from the database can appear only in one of the two top klists. Now, Dis defined as the union of the elements belonging to at least one permutation, i.e. D=Dτ1∪Dτ2, and Pas the set of all unordered pairs of elements in Dτ1∪Dτ2. Now, for each pair {i, j} ∈ Pof distinct members of D, there are 4 different cases: –Case 1 (iand jappear in both top klists). If iand jare in the same order there is no penalty, i.e. Ki,j(τ1, τ2) = 0; otherwise, Ki,j(τ1, τ2) = 1. In our experiments, this latter case is not possible since the elements are sorted according to the same criteria on both top klists. –Case 2 (iand jboth appear in one top klist (say τ1), and exactly one of ior j, say i, appears in the other top klist (τ2). If iis ahead of j in τ1there is no penalty; otherwise, Ki,j(τ1, τ2) = 1. In our experiments, this case happens when an element of the exhaustive rank has not been found by the searching technique over the HCT and does not appear in the approximated ranking. On the contrary, when two elements belong to the approximated ranking and exactly only one of them belongs to the exhaustive ranking, the element which appears in both lists is always the best placed in the approximated ranking and, therefore, there is no penalty.
74 CHAPTER 6. EXPERIMENTAL RESULTS –Case 3 (i, but not j, appears in one top klist (say τ1), and j, but not i, appears in the other top klist (τ2)). In such a case, there will be always penalty, so Ki,j(τ1, τ2) = 1. In our retrieval system, this case is given when we have a pair consisting of one element from the exhaustive ranking which have not been retrieved by the used searching technique and one element from the bottom of the approximated ranking which does not appear in the exhaustive ranking. –Case 4 (iand jboth appear in one top klist (say τ1), but neither inor j appears in the other top klist (τ2)). In such a case, since the elements do not belong to one of the top klists, we cannot know whether the order in which the elements would appear is the same or not. The user is allowed to define the penalty for this case. In our experiments, this case occurs when we have a pair consisting of either two elements from the exhaustive rank which have not been retrieved by the used searching technique or two elements from the bottom of the approximated rank which do not appear in the exhaustive rank. We have set the penalty to 0, which corresponds with the minimizing Kendall distance defined in [FKS03]. Apart from the these measures for the retrieval system evaluation and the retrieval time, we have also computed the percentage of success in retrieving the query image, i.e. how often the own query image can be found among the results of the retrieval system. There are several cases to analyze depending on the following factors: •The covering radius. The HCT can be build according to either the original covering radius proposed in [KG07] or our proposed approximation by excess. •The update method for the covering radius. Whether this method is applied once the HCT has been built in order to have the exact values for the covering radius or not. •The outliers check method. Whether this method is applied once the HCT has been built in order to minimize the number of minority cells or not. •The maturity size. We have given 3 different values to this parameter: (i) maturity size = 6 and top maturity size = 24, (ii) maturity size = top maturity size = 7, and (iii) maturity size = top maturity size = 12.
6.3. RETRIEVAL SYSTEM EVALUATION 75 •The searching technique. We have used the proposed searching techniques: (i) Most Similar Nucleus, (ii) Preemptive Cell Search, and (iii) Hybrid. In the latter case, we have set to 7, 8 and 9 the number of levels in which the Preemptive Cell Search algorithm is used. •The number of results asked by the user. We have set this value to 10, 20, 40 and 80. First of all, we want to focus the results evaluation on the covering radius and also the proposed update method for it. Table 6.3 shows the results when the outliers check method is not used, the maturity size = 6 and the top maturity size = 24, the searching technique is the Preemptive Cell Search and the number of results asked is 40. proposed covering radius original covering radius non updated updated non updated updated Mean retrieval 1.2386 0.8319 0.1058 1.0095 time (s) Variance retrieval 0.1886 0.1466 0.0057 0.1994 time (s) Retrieved 99.26 99.26 49.26 97.04 queries (%) CR 28.09 27.51 12.35 26.42 NAG 0.9970 0.9967 0.9814 0.9965 Kendall 295.24 313.87 934.14 356.92 Table 6.3: HCT results evaluation without outliers check method, maturity size = 6 and top maturity size = 24, Preemptive Cell Search and 40 results Analyzing the results from Table 6.3 we can see that the retrieval system behaves by far the worst when the original covering radius [KG07] is used without the implemented method for updating the covering radius since there are only 12.35 out of 40 elements in common between the rankings on average. In addition to this, the query image is retrieved only in the 49.26% of the query requests. We come to the same conclusion by analyzing the Normalized Aggregate Goodness (0.9814 is the lowest value) and the Kendall distance (934.14 is the greatest value). On the other hand, the retrieval time is far better than in the other cases. It takes only 0.1058
76 CHAPTER 6. EXPERIMENTAL RESULTS seconds on average. This is because the original covering radius is an approximation by defect of its exact value and, therefore, a lower number of cells are visited, which means a lower number of comparisons. As consequence, not all the cells which should be visited according to the exact covering radius are visited, which results in a bad performance. This performance for the original covering radius is improved when the update method for the covering radius is used. This is because the covering does not take into account only the elements in the current cell but the whole subtree holding from that cell once this update method is applied. On the other hand, the searching time gets far worse than before (1.0095 seconds on average). The reason why the quality measures on the retrieved results for the proposed covering radius are slightly better when the update method is not used is that more cells are visited and, therefore, more elements can be taken into account for generating the ranking. On the other hand, this results on a far worse searching time (1.2386 seconds on average). Therefore, for the experiment reflected on Table 6.3, our proposed approximation by excess for the covering radius and using the update method gives the best performance considering a compromise between the quality measures and the searching time. In addition to this, we have to consider that the time required for the updated method (see Table 6.2) can be considered negligible in comparison with the time required for the HCT construction. Now, we are going to analyze the same experiment but using the Most Similar Nucleus technique instead of the Preemptive Cell Search. The results are shown in Table 6.4. For this technique, the covering radius is not used during the search so it does not matter whether the update method for the covering radius is used or not. Analyzing the results from Table 6.4, we come to the conclusion that the Most Similar Nucleus technique gives a bad performance since the query image is retrieved only in the 5.00% of the query requests and there are only 1.35 out of 40 elements in common between the rankings on average. These results are even worse when the original covering radius is used. On the other hand, the retrieval time is only 0.0075 seconds on average. Since the retrieval time is so short, we have tried incrementing the number of elements considered in the sorting process to obtain a better performance on the resulting ranking. Therefore, instead of considering the number of cells which include at least twice the number of elements desired, i.e. 80 elements, we have tried considering 400 (10 times), 800 (20 times), 1000 (25 times), 2000 (50 times), 5000 (125 times), 10000 (250 times) and 20000 (500 times) elements to generate the top
6.3. RETRIEVAL SYSTEM EVALUATION 77 40 list. The obtained results are shown in Table 6.5. As we expected, the quality of the results improves when the number of elements being considered for the sorting is increased. On the other hand, the greater the number of elements considered, the worse the retrieval time. This is because the number of comparisons done is directly proportional to the number of elements considered. Anyway, we come to the conclusion that even if we consider 20000 elements, which means a retrieval time of 1.3695 seconds, the quality of the results is worse than the quality obtained when the Preemptive Cell Search algorithm is used. The former gives 12.33 out of 40 elements in common between the rankings on average whereas proposed covering radius original covering radius Mean retrieval 0.0072 0.0075 time (s) Variance retrieval 2.01e-05 1.91e-05 time (s) Retrieved 5.00 3.70 queries (%) CR 1.35 0.84 NAG 0.9087 0.9075 Kendall 1530.93 1554.52 Table 6.4: HCT results evaluation without outliers check method, maturity size = 6 and top maturity size = 24, Most Similar Nucleus and 40 results Elements 400 800 1000 2000 5000 10000 20000 Mean retrieval 0.0575 0.0567 0.0700 0.1380 0.3438 0.6871 1.3695 time (s) Variance retrieval 3.10e-05 3.21e-05 4.20e-05 8.20e-05 0.0004 0.0014 0.0054 time (s) Retrieved 7.21 8.23 9.15 12.01 18.39 22.83 31.61 queries (%) CR 2.24 2.82 3.16 4.26 6.53 8.61 12.33 NAG 0.9309 0.9387 0.9416 0.9517 0.9646 0.9709 0.9776 Kendall 1490.57 1462.89 1447.66 1395.03 1289.14 1192.19 1025.71 Table 6.5: HCT results evaluation without outliers check method, maturity size = 6 and top maturity size = 24, Most Similar Nucleus and 40 results
78 CHAPTER 6. EXPERIMENTAL RESULTS the latter gives 27.51 elements in common in a shorter retrieval time (0.8319 seconds). This conclusion is also corroborated by the other quality measures, i.e. the Normalized Aggregate Goodness and the Kendall distance. Furthermore, this experiment allows us to come to conclude that the first progressive subqueries proposed in [KG07] for the Progressive Query over a Query Path would not give a performance so good as the performance obtained when the Preemptive Cell Search is applied. Let us consider the Hybrid technique which combines the two searching techniques analyzed above. As explained in Section 4.3, the Preemptive Cell Search is applied over the uppermost levels (a given number of levels) and the Most Similar Nucleus is used over the lowest levels. We have carried out the experiments by setting to 7, 8 and 9 the number of levels over which the Preemptive Cell Search is applied. The results of the evaluation are shown in Tables 6.6, 6.7 and 6.8 respectively. proposed covering radius original covering radius non updated updated non updated updated Mean retrieval 0.2484 0.2172 0.0442 0.2123 time (s) Variance retrieval 0.0002 0.0009 0.0003 0.0006 time (s) Retrieved 37.99 37.99 23.75 30.13 queries (%) CR 9.84 9.83 5.86 7.69 NAG 0.9727 0.9727 0.9629 0.9686 Kendall 1105.96 1106.08 1292.37 1199.37 Table 6.6: HCT results evaluation without outliers check method, maturity size = 6 and top maturity size = 24, Hybrid with Preemptive Cell Search over the 7 uppermost levels and 40 results From the results showed in Tables 6.6, 6.7 and 6.8, we come to the conclusion that we expected. Thus, the larger the number of levels over which the Preemptive Cell Search is applied, the longer the retrieval time. Therefore, for the Hybrid searching technique, we have a retrieval time which is always shorter than the Preemptive Cell Search retrieval time and longer than the Most Similar Nucleus retrieval time. For example, for the proposed covering radius we have:
6.3. RETRIEVAL SYSTEM EVALUATION 79 0.0072 seconds ≤Retrieval time Hybrid ≤0.8319 seconds where 0.0072 seconds is the retrieval time for the Most Similar Nucleus technique and 0.8319 is the retrieval time for the Preemptive Cell Search technique. On the proposed covering radius original covering radius non updated updated non updated updated Mean retrieval 0.5338 0.4144 0.0612 0.4241 time (s) Variance retrieval 0.0039 0.0093 0.0010 0.0081 time (s) Retrieved 57.95 57.95 31.61 45.19 queries (%) CR 14.23 14.22 7.84 11.24 NAG 0.9824 0.9824 0.9704 0.9782 Kendall 883.36 883.51 1184.59 1016.11 Table 6.7: HCT results evaluation without outliers check method, maturity size = 6 and top maturity size = 24, Hybrid with Preemptive Cell Search over the 8 uppermost levels and 40 results proposed covering radius original covering radius non updated updated non updated updated Mean query 0.9818 0.6835 0.0829 0.7413 time (s) Variance query 0.0495 0.0569 0.0026 0.0595 time (s) Retrieved 84.20 84.20 42.70 73.01 queries (%) CR 20.85 20.81 10.62 18.29 NAG 0.9918 0.9917 0.9779 0.9894 Kendall 579.14 580.43 1042.70 686.00 Table 6.8: HCT results evaluation without outliers check method, maturity size = 6 and top maturity size = 24, Hybrid with Preemptive Cell Search over the 9 uppermost levels and 40 results
86 CHAPTER 6. EXPERIMENTAL RESULTS Figure 6.10: Comparison between rankings from a soccer match close-up query Figure 6.11: Comparison between rankings from a soccer match pan shot query
6.4. QUERY REQUEST EXAMPLES 87 Figure 6.12: Comparison between rankings from a handball match pan shot query Figure 6.13: Comparison between rankings from a Formule One close-up query
88 CHAPTER 6. EXPERIMENTAL RESULTS Figure 6.14: Comparison between rankings from a Formule One pan shot query Figure 6.15: Comparison between rankings from a political debate query
6.4. QUERY REQUEST EXAMPLES 89 Figure 6.16: Comparison between rankings from a political debate query Figure 6.17: Comparison between rankings from a forecast weather program query
90 CHAPTER 6. EXPERIMENTAL RESULTS Figure 6.18: Comparison between rankings from an enternainment TV program Figure 6.19: Comparison between rankings from an enternainment TV program
6.4. QUERY REQUEST EXAMPLES 91 Figure 6.20: Comparison between rankings from an enternainment TV program Figure 6.21: Comparison between rankings from a TV series
Chapter 7 Conclusions and Future Work In this project, an indexing technique called Hierarchical Cellular Tree (HCT) [KG07] has been implemented in order to improve the retrieval times of the retrieval system based on some MPEG-7 visual descriptors which had been previously implemented in [Ven10]. HCT is a MAM-based indexing technique with a dynamical approach which allows changes in the indexed database. Therefore, new elements can be inserted whenever we want and existing elements can be removed from the database without having to rebuild the HCT from scratch. Although the Hierarchical Cellular Tree has been chosen to be used in a particular scenario, i.e. a CBIR system based on some specific features, its implementation allows to index any type of data and, therefore, the HCT is useful for indexing a generic database as long as there is a function to measure the dissimilarity between any pair of elements. Furthermore, some modifications have been proposed to the original HCT. Thus, (i) a redefinition of the covering radius by giving an approximation by excess and (ii) the implementation of a method which allows to update the covering radius to its actual value have resulted in an improvement of the quality of the retrieved elements (27.51 out of 40 elements retrieved on average and 99.26% of success in retrieving the query element) with respect to the retrieval system based on the original covering radius (12.35 out of 40 elements retrieved on average and 49.26% of success in retrieving the query element), which was an approximation by defect. In addition to this, the use of the Preemptive Cell Search algorithm, which is the basic method for the insertion of new elements, as a searching technique is another important contribution. Thus, 93
94 CHAPTER 7. CONCLUSIONS AND FUTURE WORK the retrieval system performance is far better in both retrieval time and retrieved results aspects when this technique is applied (a retrieval time of 0.8319 seconds and 27.51 out of 40 elements retrieved on average) in comparison to the Progressive Query system (a retrieval time of 1.3695 seconds and 12.33 out of 40 elements retrieved on average), which was proposed in [KG07]. Since there are no large databases with a ground truth for evaluating our retrieval system, a great effort has been done in order to evaluate it in the most possible objective way. Thus, the results obtained by the searching techniques over the HCT for a set of queries have been compared with the top klist containing the knearest elements resulting from an exhaustive search over the whole database by using some contrasted measures between top klists extracted from the literature. Therefore, the HCT has been built over a database which consists of 216,317 images obtained from a public service broadcaster. According to the experimental results, we conclude that the proposed covering radius gives the best performance as long as the update method is used (a retrieval time of 0.8319 seconds and 27.51 out of 40 elements retrieved on average). Although the original covering radius gives by far the best retrieval time (0.1058 seconds on average), it is also the one which gives by far the worst retrieved results (12.35 out of 40 elements retrieved on average). However, the performance of the retrieval system based on the original covering radius is remarkably improved when the update method is applied once the HCT has been built (26.42 out of 40 elements retrieved on average) to the detriment of the retrieval time (1.0095 seconds on average), which gets remarkably worse than before the update method was applied. On the other hand, the main disadvantage of the proposed covering radius lies in the computational time required for building the HCT (472,534 seconds) in contrast to the time required when the original covering radius is used (50,868 seconds). However, this time can be reduced by applying periodically the update method for the covering radius during the HCT construction. This project opens the door to new future work lines. The main work line consists in adapting the HCT implementation for working with very large databases which do not allow to be indexed by only using the main memory. Therefore, it is necessary to implement a new approach in which both the main memory and the hard disk are used. Thus, when a new element needs to be indexed or a search over the indexed
95 database is requested, the uppermost levels of the HCT will be loaded at the main memory and the lowest levels will remain stored at the hard disk. Then, when a cell from the lowest level of the HCT loaded at the main memory is reached, the subtree holding from that cell is also loaded at the main memory, whereas the upper levels are freed. Other approaches consisting in using data pointers instead of storing the visual descriptors in the HCT structure must be analyzed, although the computational time is expected to be increased since each comparison will result in an access to hard disk. The implementation of this indexing technique will also allow to improve the retrieval time of any region-based CBIR system. In such a system, we are interested in searching images which contain a region similar to the query region. Thus, each image from the database is divided into a set of regions and the visual descriptors are computed independently for each region. Therefore, the number of elements to be compared is remarkably increased. For instance, if each image is represented by a set of 100 regions, an image database of 1,000 images results in 100,000 elements, which now can be seen as a large database. It is in this context that the HCT can be very useful. Thus, each element from the HCT will no longer represent an image, but a region, and the cells will contain similar regions according to the criteria used, which now can be based on new features such as shape descriptors. Another future work line resulting from this project is the implementation of a browser for an image database as the HCT Browsing application proposed in [KG07]. Thus, HCT can provide a basis for accomplishing an efficient browsing scheme. The hierarchic structure of the HCT is quite appropriate to give an overview to the user about what lies under the current level. Therefore, a browser based on the HCT can turn out to be a guided tour among the database items if it is well supported via an user-friendly graphic interface. Thus, the browser can be also used as an alternative way to retrieve elements from a database. Finally, in this project, the search operations have been always based on only one visual descriptor. However, for some query requests maybe more than one descriptor is required. For instance, the user may want to perform a search based not only in color but also in texture. Furthermore, in a region-based CBIR system, the visual descriptors based on shape play an important role. Therefore, several visual descriptors will be required by the user. As a consequence, it is necessary to study how to work with several descriptors at the same time. There are two options: (i) to build a different
102 BIBLIOGRAPHY [TSS04] J. Pokorny T. Skopal and V. Snasel, Pm-tree: Pivoting metric tree for similarity search in multimedia databases, Local proceedings of the 8th East-European Conference on Advances in Databases and Information Systems (ADBIS) (Budapest, Hungary), 2004, pp. 99–114. [TTSF00] Caetano Traina, Agma Traina, Bernhard Seeger, and Christos Faloutsos, Slim-trees: High performance metric trees minimizing overlap between nodes, In 7th International Conference on Extending Database Technology (EDBT, Springer-Verlag, 2000, pp. 51–65. [Ven10] Carles Ventura, Image-based query by example using mpeg-7 visual descriptors, Master’s thesis, Escola T`ecnica Superior d’Enginyeria de Telecomunicaci´o de Barcelona, 2010. [WJ96] David A. White and Ramesh Jain, Similarity indexing with the ss-tree, Proceedings of the Twelfth International Conference on Data Engineering (Washington, DC, USA), ICDE ’96, IEEE Computer Society, 1996, pp. 516–523. [WP01] Haixun Wang and Chang-Shing Perng, The s2-tree: An index structure for subsequence matching of spatial objects, Proceedings of the 5th Pacific-Asia Conference on Knowledge Discovery and Data Mining (London, UK), PAKDD ’01, Springer-Verlag, 2001, pp. 312–323. [WSB98] Roger Weber, Hans-J¨org Schek, and Stephen Blott, A quantitative analysis and performance study for similarity-search methods in highdimensional spaces, Proceedings of the 24rd International Conference on Very Large Data Bases (San Francisco, CA, USA), VLDB ’98, Morgan Kaufmann Publishers Inc., 1998, pp. 194–205. [Yia93] Peter N. Yianilos, Data structures and algorithms for nearest neighbor search in general metric spaces, Proceedings of the fourth annual ACM-SIAM Symposium on Discrete algorithms (Philadelphia, PA, USA), SODA ’93, Society for Industrial and Applied Mathematics, 1993, pp. 311–321. [ZH00] Xiang Sean Zhou and Thomas S. Huang, Cbir: From low-level features to highlevel semantics, Proc. SPIE Image and Video Communication and Processing, 2000, pp. 24–28.
BIBLIOGRAPHY 103 [ZWYY03] Xiangmin Zhou, Guoren Wang, Jeffrey Xu Yu, and Ge Yu, M+-tree: a new dynamical multidimensional index for metric spaces, Proceedings of the 14th Australasian database conference - Volume 17 (Darlinghurst, Australia, Australia), ADC ’03, Australian Computer Society, Inc., 2003, pp. 161–168.