Full text
Deep Learning for Food Instance Segmentation Master in Artificial Intelligence 25/01/2023 Mr. Bhalaji Nagarajan Faculty of Mathematics and Informatics (UB) Dr. Petia Ivanova Radeva Faculty of Mathematics and Informatics (UB) Supervisors: Jesús Molina Rodríguez de Vera Author: Master Thesis
Deep Learning for Food Instance Segmentation Author Jesús Molina Rodríguez de Vera Supervisors Dr. Petia Ivanova Radeva Faculty of Mathematics and Computer Science, Universitat de Barcelona Mr. Bhalaji Nagarajan Faculty of Mathematics and Computer Science, Universitat de Barcelona Master in Artificial Intelligence BARCELONA, Enero 2023
Abstract Food object detection and instance segmentation are critical in many applications such as dietary management or food intake monitoring. Food image recognition poses different challenges, such as the existence of a large number of classes, a high inter-class similarity, and high intra-class variance. This, along with the traditional problems associated with object detection and instance segmentation make this a very complex computer vision task. Realworld food datasets generally suffer from long-tailed and fine-grained distributions. However, the recent literature fails to address food detection in this regard. In this research, we propose a novel two-stage object detector, which we call Strong LOng-tailed Food object Detection and instance Segmentation (SLOF-DS), to tackle the long-tailed nature of food images. In addition, a multi-task based framework, which exploits different sources of prior information, was proposed to improve the classification of fine-grained classes. Lastly, we also propose a new module based on Graph Neural Neworks, we call Graph Confidence Propagation (GCP) that additionally improves the performance of both object detection and instance segmentation modules by combining all the model outputs considering the global image context. Exhaustive quantitive and qualitative analysis performed on two open source food benchmarks, namely the UECFood-256 (object detection) and the AiCrowd Food Recognition Challenge 2022 dataset (instance segmentation) using different baseline algorithms prove the robust improvements introduced by the different components proposed in this thesis. More concretely, we outperformed the state-of-the-art performance on both public datasets.
Contents 1. Introduction 1 1.1. ContextandMotivation .............................. 1 1.2. Objectives...................................... 2 1.3. Contributions.................................... 3 1.4. StructureoftheReport .............................. 3 2. Related work 5 2.1. Object Detection and Instance Segmentation . . . . . . . . . . . . . . . . . . 5 2.2. Detection Post-processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.3. Long-tailed Object Detection and Instance Segmentation . . . . . . . . . . . . 7 2.4. Exploiting Object Relations in Object Detection using Graph Neural Networks 8 2.5. FoodRecognition.................................. 9 3. Methodology 11 3.1. Two-stage Methods for Object Detection in Images: The R-CNN Family . . . 11 3.1.1. Region Proposal Network . . . . . . . . . . . . . . . . . . . . . . . . . 11 3.1.2. RoIPooling................................. 13 3.1.3. Final Classification and Regression . . . . . . . . . . . . . . . . . . . . 14 3.1.4. GIoULoss.................................. 14 3.1.5. Dealing With Different Scale Objects: Feature Pyramid Network . . . 15 3.1.6. Including Instance Segmentation: Mask R-CNN . . . . . . . . . . . . . 16 3.1.7. Mask Scoring R-CNN . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.1.8. CascadeRCNN............................... 18 3.2. Deformable Convolutional Networks . . . . . . . . . . . . . . . . . . . . . . . 19 3.3. Fine-Grained Food Recognition . . . . . . . . . . . . . . . . . . . . . . . . . . 20 3.4. Graph Neural Network for Food Representation Learning . . . . . . . . . . . 20 3.4.1. Graph Convolutional Networks and Gated Attention Networks . . . . 20 3.4.2. EdgeFeatures................................ 22 4. Proposed Framework 25 4.1. GeneralOverview.................................. 25 4.2. Strong Long-Tailed Food Object Detection and Instance Segmentation . . . . 27 4.2.1. Equalization Losses . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 4.2.2. Normed Linear Classification Head . . . . . . . . . . . . . . . . . . . . 28 4.3. Addressing the Fine-Grained Food Detection and Segmentation . . . . . . . . 28 4.3.1. LexicalClusters............................... 30 4.3.2. SIFT-based Clusters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 4.3.3. Confusion Matrix-based Clustering . . . . . . . . . . . . . . . . . . . . 31 4.4. Graph Neural Networks to Refine Detector Predictions . . . . . . . . . . . . . 32 4.4.1. GCPArchitecture ............................. 34 4.4.2. Construction of the Graph . . . . . . . . . . . . . . . . . . . . . . . . . 35 vii
viii Contents 4.4.3. EdgeFeatures................................ 35 5. Results and Discussion 39 5.1. ExperimentalSetup ................................ 39 5.2. Datasets....................................... 40 5.2.1. AiCrowd Food Challenge 2022 . . . . . . . . . . . . . . . . . . . . . . 40 5.2.2. UECFood-256................................ 41 5.3. Evaluation...................................... 44 5.3.1. Mean Average Precision . . . . . . . . . . . . . . . . . . . . . . . . . . 44 5.3.2. ConfusionMatrix.............................. 44 5.3.3. TIDE .................................... 45 5.3.4. Class Activation Mapping Methods . . . . . . . . . . . . . . . . . . . . 46 5.3.5. Cluster Comparison Metrics . . . . . . . . . . . . . . . . . . . . . . . . 46 5.4. SLOF-DS ...................................... 47 5.5. Fine-Grained Food Instance Segmentation . . . . . . . . . . . . . . . . . . . . 52 5.5.1. LexicalClusters............................... 52 5.5.2. SIFT-based Clusters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 5.5.3. Clusters Based on the Confusion Matrix . . . . . . . . . . . . . . . . . 59 5.5.4. Comparison of the Obtained Clusters . . . . . . . . . . . . . . . . . . 61 5.5.5. Combining Different Kinds of Clusters . . . . . . . . . . . . . . . . . . 62 5.6. Graph Confidence Propagation . . . . . . . . . . . . . . . . . . . . . . . . . . 65 5.6.1. Hyperparameter Selection . . . . . . . . . . . . . . . . . . . . . . . . . 65 5.6.2. Analysis of the Best GCP Configuration . . . . . . . . . . . . . . . . . 66 5.7. Combining All the Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 5.8. Comparison to the State-of-the-Art . . . . . . . . . . . . . . . . . . . . . . . . 73 5.9. Results on UECFood-256 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 5.10.QualitativeResults................................. 79 5.11. Limitations of the Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 6. Conclusion and Future Work 83 6.1. Conclusions..................................... 83 6.2. FutureWork .................................... 84 Bibliography 85 List of Acronyms and Abbreviations 95 A. Clusters used for the finegrained subheads 97 A.1. AiCrowd Food Challenge datset . . . . . . . . . . . . . . . . . . . . . . . . . . 97 A.1.1. Lexical dendrogram and clusters . . . . . . . . . . . . . . . . . . . . . 97 A.1.2. Confusion matrix-based dendrogram and clusters . . . . . . . . . . . . 98 A.2.UECFood-256dataset ............................... 99 A.2.1. Lexical dendrogram and clusters . . . . . . . . . . . . . . . . . . . . . 99 A.2.2. Confusion matrix-based dendrogram and clusters . . . . . . . . . . . . 100
List of Figures 1.1. Illustration of long-tailed distribution. . . . . . . . . . . . . . . . . . . . . . . 2 3.1. Diagram of Faster R-CNN [85]. . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.2. Diagram of Region Proposal Networks (RPN). . . . . . . . . . . . . . . . . . 12 3.3. Example of three anchor boxes with three different aspect ratios. . . . . . . . 13 3.4. Comparison of Generalized IoU (GIoU) loss and other losses used for bounding boxregression. ................................... 15 3.5. Diagram of Feature Pyramid Network (FPN). . . . . . . . . . . . . . . . . . . 15 3.6. Diagram of Mask R-CNN [40]. . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.7. Comparison of Faster R-CNN (left) and Cascade R-CNN architecture (right). 18 3.8. Illustration of a 3×3Deformable Convolutional Network (DCN). . . . . . . . 19 3.9. Graph convolution as an extension of traditional convolutional layers. . . . . 21 4.1. Diagram of the proposal, with the task that each element aims to help. . . . . 26 4.2. General overview of the proposed framework. . . . . . . . . . . . . . . . . . . 26 4.3. Proposal of a multi-task framework for fine-grained object detection and instance segmentation (left) and a closer look to the original classification head andthesubheads(right). ............................. 29 4.4. Example of “island” of predictions. . . . . . . . . . . . . . . . . . . . . . . . . 33 4.5. Graph Confidence Propagation (GCP). . . . . . . . . . . . . . . . . . . . . . . 34 4.6. Example of the expected output of Graph Confidence Propagation (GCP) . . 37 5.1. Examples of images in AiCrowd Food Challenge 2022 (AICF22) dataset and their ground truth segmentation. . . . . . . . . . . . . . . . . . . . . . . . . . 41 5.2. Long-tailed distribution of AICF22. . . . . . . . . . . . . . . . . . . . . . . . 42 5.3. Long-tailed distribution of UECFood-256. . . . . . . . . . . . . . . . . . . . 43 5.4. Examples of the problems that can appear in the UECFood-256 dataset. . . . 43 5.5. Different types of errors reported by TIDE . . . . . . . . . . . . . . . . . . . . 45 5.6. Change in Mean Average Precision (mAP) per category between the basic baseline and Strong LOng-tailed Food object Detection and instance Segmentation (SLOF-DS)...................................... 48 5.7. Distribution of per-class mAP for frequent, common and rare classes of the different basic baselines and different variations, including SLOF-DS. . . . . . 49 5.8. Examples in the training set of the class “aperitif with alcohol n s aperol spritz”. 49 5.9. TIDE error report for SLOF-DS. . . . . . . . . . . . . . . . . . . . . . . . . . 50 5.10. EigenCAM [75] (top row) and Deep Feature Factorizations (DFF) [22] (bottom row) output of SLOF-DS for some images of the AICF22 dataset. . . . . . . . 50 5.11. Example of the adaptive receptive field of the DCN. . . . . . . . . . . . . . . 51 5.12. Norm of the rows corresponding to every category in AICF22 in the classification matrix of the trained vanilla Mask RCNN with ResNet-50 as backbone. 51 5.13. Correlation between classification score and Mask-Intersection over Union (IoU) of the predictions of different models with the ground truth mask. . . . . . . 51 ix
2Introduction the process easier than the traditional paper-based journal, the process is still tiresome. Inaccurate estimates of portion sizes, incorrect entries, and failure to locate food products in the existing food database are just a few of the additional problems that these apps still had [41]. This, in turn, prevents most of the users from using them in the long-term. In order to facilitate the process to the user, image-based food tracking applications have been proposed [76]. These solutions aim to facilitate the logging process by extracting as much information as possible from a food image. In this process, one critical step to the correct estimation of the nutritional information is the detection and segmentation of the food items that appear in the image [82, 89]. The datasets used in these experiments, however, are usually private and very reduced in terms of the number of categories and number of images [44, 82, 89]. This scenario does not represent properly the nature of food images, in which there is a great variety of meals with great intra-class variance and great inter-class similarity in many cases. Food image domain presents a long-tailed distribution, which cannot be properly modeled with fewclasses datasets. Even the works that use large object detection datasets, such as UECFood- 256 [50], do not tackle the long-tailed distribution [8, 47], which are characterized by having a few classes that aggregate most of the dataset, as we can see in Figure 1.1. Figure 1.1: Illustration of long-tailed distribution. As a consequence, existing academic literature does not address, to the best of our knowledge, the problem of food object detection and instance segmentation from a long-tailed perspective. On the other hand, there exist some open challenges such as AiCrowd Food Challenge 2022 (AICF22) that use big datasets with a great variety of fine-grained classes. The solutions to these challenges, however, usually lie out of the research paradigm, and focus more on engineering and exhaustive hyperparameter tuning. Although this can lead to good results in these challenges, it does not encourage the proposal of novel solutions to address the task at hand. 1.2. Objectives Given the potential applications of the task and the lack of academic literature on long-tailed food object detection and especially food instance segmentation, we aim to approach the problem from a research perspective. Therefore, we can summarize the objectives of the project as follows: • Analyze and study the challenges associated with long-tailed and fine-grained object
1.3. Contributions 3 detection and instance segmentation, especially those related to the food domain. • Propose solutions to tackle the problem of long-tailed and fine-grained object detection and instance segmentation. • Develop a method to refine the confidence and location of the predictions based on neighboring detections. • Validate our proposal by exhaustive experimentation in public datasets. 1.3. Contributions As a product of our research, driven by the aforementioned objectives, we present the following contributions: • A new strong model for long-tailed food object detection and instance segmentation. • A new multi-task-based framework to address fine-grained food detection and segmentation. • Integration of a graph neural network approach to improve the confidence distribution of predictions in classification-bounded object detection and instance segmentation. • Curation of the dataset for food object detection UECFood-256 [50], and transformation into the widely used and well-established COCO format [57]. • Design, implementation and training of the food segmentation component for food tracking of the European project Smart and Healthy Ageing through People Engaging in Supportive Systems (SHAPES)1. • Re-implementation in C++ of NMS-resampling [110], a state-of-the-art resampling method for long-tailed object detection and instance segmentation. Our implementation achieves a speed up of up to 3×in the overall training time. Link to the pull request to the official repository: https://github.com/JialianW/Forest_RCNN/pull/11. 1.4. Structure of the Report The remainder of the document is structured as follows. In Related work, we report the state-of-the-art in relevant fields for the research, such as object detection and food image recognition. Methodology contains the theoretical notions required to understand the methods used in this project. In Proposed Framework we describe in detail and compare with previous approaches the methods proposed in this research. In Results and Discussion we introduce the experimental and evaluation setup, and we show and analyze the results on different datasets. Finally, Conclusion and Future Work contains the overall conclusions of the project together with potential future research lines. 1https://shapes2020.eu/
2 Related work 2.1. Object Detection and Instance Segmentation Object detection and image segmentation are two of the main tasks in the field of computer vision very active in the last decades. Object detection refers to the process of identifying and correctly labeling all the objects present in an image, typically by determining the bounding box that contains the object and its class. Thus, it combines the tasks of localization and classification in an image. In the context detection, these tasks are usually referred to as bounding box regression and classification, respectively. On the other hand, in image segmentation we are interested in assigning labels to the image at the pixel level. Typically, three kinds of image segmentation are distinguished: semantic segmentation, instance segmentation and panoptic segmentation. In semantic segmentation, the goal is producing a pixel-wise classification of the image. In instance segmentation, which is the one we focus on, a class label is associated to each pixel similar to semantic segmentation, but multiple objects of the same class are treated as separated entities. Finally, panoptic segmentation is a combination of the other two: both a class label and a instance number are assigned to every pixel (like in instance segmentation), but it allows only one value pair per pixel (similar to semantic segmentation). There is clearly a close relation between object detection and instance segmentation, as the main difference is the coarseness of the output: in one we obtain bounding boxes and in the other fine delineations. However, in both cases we aim to identify the different individuals of a given set of classes. This is why instance segmentation models are usually built on top of object detectors by adding a segmentation branch to them or in combination with them, as it is done in well-known models such as Mask RCNN [40], Cascade Mask RCNN [13] or YOLACT [9] and new state-of-the-art approaches like InstanceQuery [30]. Nevertheless, there exist approaches that purely address segmentation without relying on explicitly or implicitly computed bounding box, like Mask2Former [20]. Given that we aim to address both food object detection and instance segmentation, we first explore the former. Following, we will see the instance segmentation as an additional feature to object detection: once a bounding box for an object is found, a different part of the network is in charge of finding the mask inside it. Deep learning approaches to object detection are usually classified into two main groups: one-stage methods and two-stage methods. As the names suggest, they differ in the number of phases in which its functioning can be divided. In the two-stage object detection, which we describe in more detail in Section 3.1, the model makes use of candidate bounding boxes or pre-generated region proposals in order to find the objects in the image. More specifically, the network first decides whether each of 5
6Related work those pre-defined boxes contains an object, and after that it refines it to the actual bounding box and finds the concrete class of the object. Among these methods, we can highlight the R- CNN family like the Faster R-CNN object detector [85]. From that, more advanced methods have been proposed, such as Cascade R-CNN [13], which performs several proposal filtering and adjustment steps, or Mask R-CNN [40], which enables instance segmentation. In recent years, more complex methods have been proposed in the literature, for instance, Hybrid Task Cascade [16] or SCNet [105], which include global context information by adding a semantic segmentation branch per image. More details about this family can be found in Section 3.1. One-stage object detectors perform the bounding box regression and classification directly from the image, without an intermediate explicit evaluation of pre-defined region proposals. In this category, we can include the YOLO family [33, 83, 84]. YOLO also uses predefined anchors, but performs classification and regression in just a single step. In recent years, a new paradigm of object detection systems has appeared. DETR [14] introduced query-based detectors based on the usage of encoder-decoder transformers. There, no hand-crafted anchors or proposals are used to look for objects, but object queries are learned during training to query the transformer decoder and find the objects. Many variants of DETR have been proposed, both for object detection [113, 117] and for segmentation [20, 43, 55]. 2.2. Detection Post-processing Traditional object detection and instance segmentation methods require a post-processing step to remove duplicated predicts. Indeed, although transformer-based models were initially thought not to need these mechanisms, recent research has proved that they can indeed be useful to improve their performance [79]. The most basic method for this purpose is Non-Maximum Suppression (NMS), which simply removes very overlapping detections and keeps the one with the highest confidence. Although it is still used as the de-facto standard, the object detection research community has proposed alternatives to this simple method. Soft-NMS [7] tries to address a common drawback of vanilla NMS: if in the groun-truth annotations there are two very overlapping bounding boxes, the detector will never be able to find both (as we will remove one of them). To solve this, Soft-NMS reduces the confidence scores of non-maximum overlapping predictions. Thus, predicted detections are only removed if its final confidence score lies below the minimum classification threshold. This method does not prevent or mitigate the problem of predicting twice the same object with different classes, as this is not a common problem in general-domain datasets. The authors of [59] proposed Dual-NMS, which uses the density of predictions in an area to determine whether there is actually an object in the area or not. Accumulations or islands of bounding boxes are then removed if they are found to be false positives. Lastly, standard NMS is applied to the remaining predictions. Thus, this method only helps in removing predictions in background areas mis-classified as objects, which can be useful in scenarios like aerial-images detection, but not in ours in which the objects are easily localized. In [95], the authors propose the Weighted Boxes Fusion to combine different bounding boxes into new ones, basically by averaging the classification scores and position in the image of overlapping boxes. However, this method is thought and tested to be used as the aggregator
2.3. Long-tailed Object Detection and Instance Segmentation 7 of model ensembles, rather than to be used as a single-model post-processing step. In a similar approach, Confidence Propagation Cluster [94] tries to combine the information from overlapping bounding boxes to refine the final prediction, this time, of a single model. This method is based on the message passing from belief propagation, which is used to penalize redundant predictions and enhance the positives in an iterative way. Although this mechanism is effective in combining neighboring boxes, it uses hand-crafted (non learnable) message passing rules to aggregate them. 2.3. Long-tailed Object Detection and Instance Segmentation Long-tail distributions are those in which most of the instances of a dataset are represented by just a few classes (head), while the vast majority of the class are under-represented (tail classes). These datasets appear naturally in real-case scenarios, and learning from them pose a challenge for machine learning techniques due to the problem of class imbalance. Obviously, this problem also affects object detection and instance segmentation. This is why, in the last few years, benchmark datasets with a large number of classes and a very marked long-tail data distribution have been proposed and have attracted ever-growing attention. The most well-known example for object detection and instance segmentation is LVIS [37]. Different kinds of solutions can be found in the literature to address this issue. On the one hand, data resampling methods artificially modify the distribution of the dataset mainly by applying two techniques: • Undersampling of head categories. They reduce the number of representatives of frequent classes that the method sees during each training epoch, and they are not used very often in object detection or instance segmentation. • Oversampling of tail categories. Sample images containing rare objects more than once during a training epoch. These methods are more commonly used in object detection, especially Repeat Factor Sampling (RFS) [37]. The functioning of RFS is very simple: the rarest an object category is, the more frequently its images are sampled. Although this method has proved effective, it can considerably increase the training time as the training steps per epoch are incremented. More recently, the authors of [110] have propose a re-sampling technique, NMS-resampling, which does not oversample rare classes at the image level but at the proposal level. On the other hand, some methods propose changing the loss function in different ways. On the one hand, margin calibration methods inject category-specific margins into the classification loss (like cross-entropy loss) to re-balance the logit distribution of categories. One of these methods is the Seesaw loss for instance segmentation [106], which uses a mitigation factor and a compensation factor to weight the gradients of positive and negative predictions of the tail datasets: the mitigation factor reduces the punishment to tail categories, whereas the compensation factor increases the penalty of false positives of tail classes. This aims to create a balance between reducing the punishment of tail classes (which is big because most objects belong to the head, penalizing the prediction of tail classes during training) while trying to keep low the false positives of tail classes. Another example of these kind of losses is the recently proposed Inverse Object Frequency loss (IOF) [2], which balances the logits input
8Related work to cross-entropy loss based on the frequency of each category. They test different functions of the frequency as balancing factor to multiply the logits. This loss, in addition to other enhancements like RFS [37] or the application of augmentations in the feature space [116], allowed them to achieve state-of-the-art results in LVIS v1.0 [37]. Another family of losses are the equalization losses [103], which base its functioning in changing the gradient contributed by different categories or instances. The first version of the equalization loss [101] simply blocks the negative gradient for classes less frequent than a given threshold. On the other hand, the equalization loss v2 [102] does not rely on precomputed statistics, but on the instant and accumulated gradient as an indicator of the imbalance. Other methods try to exploit relations between classes to group them in order to guide the learning process. This is the case of Forest R-CNN [110], which clusters the classes using different criteria, such as texture or class label lexical embedding. For each created clustering, an additional classification head is added at the end of the network, and it is in charge of predicting which cluster every object belongs to in that partition. In inference, the predicted probability for each cluster is used as a prior. The gradient of these heads does not flow to the rest of the model. Another method of this kind is AHRL [53], which creates clusters based on the feature vectors generated by the network for the different classes. The clusters are used during training to create additional classification tasks to find the correct class within the cluster for each object. This makes it necessary to train the model twice: once to obtain the feature representation and another training which includes the cluster information. Another interesting contribution of [53] is that they built their method on top of a strong model generated by taking different solutions in the literature to long-tailed object detection, which proves useful to get a strong starting point, like normed linear layer [108] or equalization loss [102]. 2.4. Exploiting Object Relations in Object Detection using Graph Neural Networks Even since before the explosion of deep learning and the widely adoption of Convolutional Neural Network (CNN) and Graph Neural Network (GNN), different authors have tried to exploit the interaction between objects themselves and between objects and the scene to improve object detectors. In first works, the authors tried to do so by post-processing the final predictions of the model [32, 74]. Most recent works, on the other hand, model the objects or proposals using graph structures, as they are well suited to represent these kind of relations. While some approaches use learning algorithms such as conditional random fields [112], this approach requires groundtruth labels for the relations between objects for all the images. Other works focus on using GNN to combine information from different network detections to create new ones, relying on more general priors that do not need to be explicitly annotated. Some proposals rely on frequency of co-occurrence between objects to build the edges between the nodes [19, 45], and others use this information as a starting point to then refine the weights automatically [6]. To this end, the lexical information of labels has also been used to this end, frequently using word embeddings to represent the categories [17, 18, 19, 114, 115]. The most common
2.5. Food Recognition 9 approach [17, 18, 19], is using different graphs and GNN to model separately the relation between classes and the relation between objects in the scene. In [115], however, they propose a cross-modal framework in which both labels and objects detected are represented by nodes, and they predict the strength of the edge between every object and category to make the final classification of each detection. In [17, 18], authors proved that including additional information in the edges between objects to encode their spatial relation can lead to significant improvements. As we have seen, the usage of GNN applied to object detection has been vastly explored, mainly with the aim of learning semantic relations between objects of different classes and the scene. 2.5. Food Recognition Intelligent health applications that include dietary control, food perception, meal recommendation, and food health analysis have all relied heavily on food recognition algorithms in recent years [70]. For instance, food recognition have been applied in the past to tasks such as dietary assessment [100], nutritional monitoring in the elderly [76] and food calorie estimation [29, 38]. With the explosion of deep learning, one of the first applications of deep learning in this field was food classification, based on different well-known deep neural networks such as MobileNet [38, 81], Wide Residual Networks [66], VGG and DenseNet [46]. Despite the applicability of the research in this area, the growth of the field was constrained due to the relatively small size of existing datasets like Food-101 [48]. However, real-world food images present some challenges that can not be represented in small datasets, and that is why new food image classification benchmarks have appeared, which grow in both number of images and classes like FoodX-251 [49] and Food 2K [71]. As the datasets become bigger and more fine-grained, new methods were proposed to try to tackle these issues [4, 87]. Food images are often composed of different food items. This makes tasks such as object detection very relevant for the application of food recognition. That is why different solutions have been proposed in the literature to this problem [8, 56, 64]. Despite the importance of the method, existing benchmarks are still reduced [50, 64], and some of them are frequently used as a multi-label classification benchmark [66]. Food semantic segmentation has also attracted a lot of attention in the last few years, with the proposal of ever growing datasets, like UNIMIB2016 [21] and more recently UECFoodPix [29] and UECFoodPix-Complete [78]. These datasets have been widely used in the literature to propose and test new food semantic segmentation solutions [5, 93, 107]. One task that has received less attention is food instance segmentation. Existing datasets are usually small and private or not widely used [26, 44, 82, 89]. In [77], authors proposed a new architecture to address food instance segmentation, but their main goal was the counting of items of food in an image, and results are not reported in terms of instance segmentation. Despite this lack of standardize benchmarks and (as a consequence) development of this task, food instance segmentation is key for tasks such as calories estimation and dietary control [82], and working on reduced datasets prevents its applicability on real-life scenarios.
3 Methodology In this chapter, we explain the theoretical concepts of our proposed method. This chapter would provide a background to the different stages of the proposed pipeline. We first introduce the Two-stage family of algorithms for both detection and instance segmentation. Later we brief the backbone of the algorithms followed by information about Fine-grained food recognition and the usage of graphs to refine the object detections. 3.1. Two-stage Methods for Object Detection in Images: The R-CNN Family In this thesis, we focus on the two-stage Deep learning methods for object detection in images given the excellent results they achieved in the bibliography (see previous Section). As we have introduced previously, in these models we can differentiate two different phases in the detection of objects in an image. The most representative members of this kind of network are the members of the R-CNN family, around which we have built our proposal. The first two-stage object detectors of this family were the original R-CNN [36] and its successor Fast R-CNN [35]. However, those methods still relied in non-trainable components to perform the region proposal. Because of that, we will start with Faster R-CNN [85], which is commonly used as a basic baseline for new detection methods. In Figure 3.1, a diagram of the architecture of Faster R-CNN is displayed. The first component of the network is the backbone, to which the input image is fed. The objective of the backbone is to obtain a feature representation of the input image that is useful to perform the task at hand (object detection). Although they were originally based on CNN architectures, in the last few years transformer-based models such as vision transformers [28] or Swin [60, 61] have emerged. Once the image is processed by the backbone, it outputs a feature map, which is used by the rest of the network. 3.1.1. Region Proposal Network The output of the backbone for each image is a feature map m∈Rh×w×d, which is the input to the next module of the network, Region Proposal Networks (RPN), which is the main contribution of [85]. This component is in charge of performing the first of the two stages of the Faster R-CNN, and it is displayed in Figure 3.2. To generate region proposals, a small convolutional network is slided over m. The CNN of this network takes as input a n×ncrop of m, and its output is fed to two sibling layers for classification (cls) and regression (reg). For each sliding-window location, the network considers kdifferent predefined anchors (explained in the next lines): 11
18 Methodology This process helps the network produce confidence scores that better represent the quality of the masks, which in turn improves the overall performance of the network according to the results reported in [42]. 3.1.8. Cascade RCNN In Section 3.1.1, we have explained how region proposals are assigned to ground-truth boxes during training in order to compute the loss and guide the learning process. However, selecting the IoU threshold, u, is not a trivial task. If uis too high, the network will have a higher precision when selection the positive proposals during training. However, reducing the number of positives during training could lead to overfitting. On the other hand, if uis low, the positive training sets of proposals seen during training are richer and more diverse, but the network is not highly encouraged to reject close false positives. In [13], the authors propose a multi-stage approach to deal with this problem: Cascade R-CNN. Figure 3.7 shows how this architecture is a multi-stage extension of Faster R-CNN: several bounding box heads with a regression and a classification branches are concatenated. Increasing IoU threshold and proposal quality Figure 3.7: Comparison of Faster R-CNN (left) and Cascade R-CNN architecture (right). Image extracted from [13] . The idea is to increase the assignment IoU threshold, ui, in successive stages of the cascade. That is, ui> ui−1. Thanks to that, the authors achieved simultaneous improvement in the quality of both the hypothesis or candidate proposals and the detector itself. The key idea is considering the workflow as a cascaded process of filtering-and-improvement of proposals. Regarding the detector improvement, each regression head outputs a refined version of the proposal that has received as input. Therefore, since we concatenate several heads, we expect the region hypothesis to be of higher quality (highest IoU with the ground-truth). The progressive refinement of the proposals can be seen as a composition of different functions specialized for input boxes of growing quality. Consequently, as each regression head receives more curated proposals, we can set higher IoU thresholds while avoiding overfitting: Thanks to the refinement, the number of positive examples will remain high. On the other hand, increasing the threshold also helps to remove outliers, which increases the learning effectiveness of bounding box regression in later stages. Please note that at each stage there is also a classification head, which is trained according
3.2. Deformable Convolutional Networks 19 to the assignment made with the received proposals and using the corresponding threshold ui, as explained in Section 3.1.1. Additionally, extending this architecture to instance segmentation only requires adding a trainable segmentation branch at each stage of the cascade, which is trained and used according to the principles of Mask R-CNN (more information in Section 3.1.6). The resulting architecture receives the name of Cascade Mask R-CNN. At inference time, we take the classification, regression, and segmentation outputs of the last step. 3.2. Deformable Convolutional Networks Deformable Convolutional Network (DCN) are a variant of a standard convolution operation that allows the convolutional kernel to adapt its shape to the input feature maps [25]. It achieves this by introducing a set of learnable offsets to the standard convolutional kernel, which allows the kernel to be deformed or moved to different positions within the input feature maps. The main idea behind deformable convolutions is to make the convolutional operation more flexible, allowing it to better handle variations in the shape and position of objects within an image. In practice, the offsets are learned during training and are used to adjust the position of the kernel at each location in the input feature maps. The offsets are concatenated to the input feature maps, and the convolution is performed as usual, but the kernel is moved according to the learned offsets, as it is illustrated in Figure 3.8. Figure 3.8: Illustration of a 3×3Deformable Convolutional Network (DCN). From [25] The number of parameters in a deformable convolution layer is slightly more than in a standard convolutional layer. In a standard convolutional layer, the kernel weights and biases are the only learnable parameters. The number of parameters in a standard convolutional layer can be calculated as: (kh·kw·ic+ 1) ·oc, while the number of parameters of a deformable convolutional layer are computed as: (kh·kw·ic+ 1) ·oc+kh·kw·oc,
20 Methodology where kh=kernel height, kw=kernel width, ic=input channels, oc=output channels. Therefore, the number of trainable parameters introduced by DCN are given by: (kh·kw·ic+ 1) ·oc+kh·kw·oc−(kh·kw·ic+ 1) ·oc=kh·kw·oc. 3.3. Fine-Grained Food Recognition In [87], the authors proposed an effective method to deal with long-tailed food datasets. Although our task is different, the domain is the same, so we extrapolated some ideas from their approach. The model works by training a baseline model on the whole set of food classes. Once this model is trained, the corresponding confusion matrix, CM, is computed. If we assume that it is row-normalized, the distance matrix is computed as: DCM = 1 −0.5·(CM +CM⊺).(3.3) From this distance matrix, a dendrogram is built. Then, it is used to find clusters of subsets of classes that are frequently confused by the model. For each one of the cluster that are found, a new classification head is added to the model. If one cluster has nclasses, its classification head predicts n+ 1 categories: a concrete class of the cluster or “other” if the class does not belong to that subset. Once the new heads have been built, the baseline is frozen and each subhead is trained with a per-head data balancing mechanism to avoid both inter-class and intra-class imbalance. Once all the heads have been trained, their outputs are combined using a Feed Forward Network (FFN), which needs to be trained in an additional training phase. 3.4. Graph Neural Network for Food Representation Learning A GNN is designed to deal with data that is presented in the form of graphs, that is, that can be represented as G= (V, E)where V is the set of vertex or nodes, and Eare the edges between the nodes. The edges represent the relation or connection between two nodes, and two nodes connected by an edge are considered neighbors. Note that the edges can be undirected or directed. In undirected graphs, the edges link two vertices symmetrically, while in directed graphs, the edges link two vertices asymmetrically. The connectivity of the graph can be represented as a list of edges or as an adjacency matrix A, such that Ai,j = 1 if and only if there is an edge from node ito node j. Lastly, note that the connection between two nodes can be weighted, which might be used to represent different degrees of connection or other features. 3.4.1. Graph Convolutional Networks and Gated Attention Networks One of the key components of GNN is the message passing mechanism. The idea behind this concept is the passing of information between adjacent nodes. It works in three simple steps: • For each node, the node embeddings of its neighbors are gathered, typically after having applied a (learnable) function on them.
3.4. Graph Neural Network for Food Representation Learning 21 • These embeddings or messages are aggregated via an aggregate function, which can also be learnable. • The node is updated using this aggregated message, usually via a learnable function. The simple mechanism explained above is the foundation of what is known as graph convolution, which generalizes the convolution operation of a CNN, as we illustrate in Figure 3.9. More concretely, we can imagine an image as a graph in which each pixel is a node, and neighboring pixels are connected with an edge (the pixels that lie inside the convolutional kernel). In graph convolutions, the idea is very similar. The features of every node in the graph are predicted as a function of itself and its neighbors. The key difference is that the number of neighbors of a node in a general graph is not predefined. Finally, just like in traditional convolutions, it is possible to stack several graph convolutional layers to perform successive transformations of the node embeddings. X Convolution weights Figure 3.9: Graph convolution as an extension of traditional convolutional layers. In both cases two steps are applied: linear transformation of the pixels/nodes and weighted of the neighbors to update the nodes. The first Graph Convolutional Network (GCN) was proposed in [51]. In order to understand how they work, we need to introduce some notation. Given the graph G= (V, E), we can represent it as (H, A), where His the node feature matrix and Ais the adjacency matrix. Thus, the i−th row of H,hi, contains the embedding of the i−th node of the graph. Moreover, let Nibe the set of neighbors of the i−th node (which includes itself). Thus, the update step of GCN can be expressed as: h(′) i=σ ∑ j∈Ni cijWhj ,where cij =1 √|Ni||Nj|,(3.4) where Wis a learning weight matrix and is shared by all nodes. The coefficients cij weight
22 Methodology the contribution of each neighbor to the new representation of the node, and it is determined by the degree of each node. A couple of years later, the authors of [104] proposed Graph Attention Network (GAT), a variation of GCN. The main difference between GAT and GCN is that the explicitly computed cij are replaced by αij, which are computed from a learnable attention mechanism using the node embeddings, as we show in Equation (3.5): αij =LeakyReLU (aT[Whi∥Whj]),(3.5) where arepresents the weights of a single-layer FFN and ∥denotes the concatenation operation. Finally, the softmax function is applied to the coefficients αij in the row dimension to obtain a probability distribution: αij =exp (αij) ∑k∈Niexp (αik).(3.6) Another important difference between the original GCN and GAT is that in the latter multi-head attention is explored. Thus, instead of one set of coefficients αij calculated using a single pair of weightsa,W, it is possible to learn Kindependent weights that can focus on different features. The final result is obtained from their aggregation: h′ i=σ 1 K K ∑ k=1 ∑ j∈Ni αk ijWkhj .(3.7) However, GAT presents a problem that affects their expressiveness. In [11], the authors proved that due to the order in which linear operations are applied in Equation (3.5), GAT can only compute static attention rather than dynamic attention. Although the theoretical proof of this theorem is outside the scope of this thesis, the key notion is that for a trained GAT, the attention function only provides a static ranking of a set of nodes, regardless of the query node (hiin Equation (3.6)), which only affects the sharpness of the derived probability distribution. The authors of [11] proposed a new version, Graph Attention Network v2 (GATv2), which solved this issue by replacing Equation (3.5) with the following expression: αij =aTLeakyReLU ([Whi∥Whj]) .(3.8) 3.4.2. Edge Features In the previous section, we considered the edge information just as an adjacency matrix of binary values: whether two nodes are neighbors or not. Thus, we are only considering structural information apart from that of the nodes themselves to compute the attention and update the nodes. It is, however, possible to include d−dimensional data as edge features. That is, for any pair of neighboring nodes hi, hj∈V, the edge that defines the relationship between them is characterized by ei,j ∈Rd. In the case of GATv2 (or any similar attention mechanism), we can reformulate Equation (3.8) to include such information in the computation of the
3.4. Graph Neural Network for Food Representation Learning 23 pairwise attention, as follows: αij =aTLeakyReLU ([Whi∥Whj∥ei,j]) .(3.9) Regarding object detection, this characteristic of GNN is usually not exploited, and edge information is usually binary data or single-valued real data at most (when considering the co-occurrence matrix, for example). In [19], the authors modeled the spatial relationship between any two proposals using a set of 4 non-symmetric spatial features. Thus, for any pair of proposals pi, pjof size wi×hi, wj×hjcentered in (xi, yi),(xj, yj)respectively, they encoded the positional relation as follows: Rij =[log (xi−xj)2 w2 i ,log (yi−yj)2 h2 i ,log wi wj ,log hi hj]T .(3.10)
4 Proposed Framework In this section, we introduce our proposal to address the problem of long-tailed and finegrained food object detection and instance segmentation. At first, we present the overall architecture of the designed components. After that, we explain them individually in detail. 4.1. General Overview Although it is commonly done in the literature, adding the proposed modules to “weak” baselines or methods is sub-optimal mainly because of two reasons. First, it is not fair to compare with “weak” models, as they are more easily outperformed. Second, we can get a better idea of the best results that we can expect from the proposed method, and compare it with other State of the art approaches. Thus, the first element of our proposal is a model which combines different ideas from the literature to improve long-tailed food detection and segmentation that we described in Section 4.2. In this project, we propose a new framework built on top of two-stage object detectors and instance segmentation models.Figure 4.1 and Table 4.1 detail the sub-task of instance segmentation (in object detection segmentation is ignored) that is affected by the different components that we introduce: • In order to deal with long-tailed distribtuions, we propose the Strong LOng-tailed Food object Detection and instance Segmentation (SLOF-DS), a method based on state- of-the-art components in the literature to address the task at hand. This element is highlighted in blue in Figure 4.1. • In order to improve the classification of the model, a fine-grained classification multitask head, explained in detail in Section 4.3, used during training to provide additional guidance to the learning process. Green in Figure 4.1. • In order to improve the detection of the model, we propose a module based on GNN, which we refer to as Graph Confidence Propagation (GCP); it aggregates information from neighboring detections to produce a final classification and regression prediction. More details can be found in Section 4.4. Red in Figure 4.1. We also show in Figure 4.2 a more detailed description of the combined architecture, that shows more accurately how the different parts of a traditional two-stage detector and the proposed components would interact. It is important to note that the modules are independent of each other, in the sense that they can be used separately or combined. Moreover, given the modular nature of the proposal, this method is not limited to Faster/Mask R-CNN, but can also be applied to more 25
26 Proposed Framework Backbone Classification Localization Segmentation Features Equalization loss v2 Normed Linear Layer DCN in the backbone Multi-task fine-grained subheads Graph Confidence Propagation GIoU loss DCN in the backbone Graph Confidence Propagation DCN in the backbone Mask Scoring (MaskIoU head) Input image Figure 4.1: Diagram of the proposal, with the task that each element aims to help. Classification Localization Segmentation Equalization Loss v2 ✓ Normed linear layer ✓ DCN in the backbone ✓ ✓ ✓ GIoU loss ✓ Mask Scoring (MaskIoU head) ✓ Multi-task fine-grained heads ✓ Graph Condidence Propagation ✓ ✓ Table 4.1: Detailed description of the tasks affected by each proposed components. Feature map RPN RoI Align Bounding box Mask Regression Classification Fine-grained classification Proposal aggregator GNN Regression Classification Figure 4.2: General overview of the proposed framework. The area inside the black doted line corresponds to the traditional Mask RCNN. The new components, the multi-task finegrained module and the GCP are highlighted in purple and green, respectively. complex architectures such as Cascade (Mask) R-CNN [13], Hybrid Task Cascade (HTC) [16] or SCNet [105]. In these cases, we can simply add one pair of these modules per stage in the cascade. In Results and Discussion, we explore the performance improvements achieved by the proposed modules for different two-stage architectures.
4.2. Strong Long-Tailed Food Object Detection and Instance Segmentation 27 4.2. Strong Long-Tailed Food Object Detection and Instance Segmentation In this section, we describe the SLOF-DS, a method based on state-of-the-art components in the literature to address the task at hand. To tackle the long-tailed problem of food image classification, we inspire in [53], where the authors combine different components from other works to construct a powerful initial model for object detection of long-tailed distributions. As discussed before in Faster R-CNN and all the methods described in Section 3.1, the classification of every instance is performed by a linear layer. This linear layer can be represented as the matrix multiplication of the feature vector representing the instance by the learnable matrix weight Wcls ∈Rd×C, where dis the dimension of the feature vector and C is the number of classes (note that we ignore the +1 of the background for simplicity). Thus, each column of Wcls can be seen as a category classifier responsible for a specific category or task. Using the Mask RCNN framework, we borrow those components that do not increase the computation requirements or the training time: • Replace the cross-entropy loss of the classification head with the Equalization loss v2 (EQLv2) [102]. • Replace the linear layer of the classification head with a normed linear layer (that is, using cosine similarity) [108]. • Replace the original bounding box regression loss, L1, with the GIoU loss [86]. • Optimizing the backbone by using ResNet-50 [39] with FPN [58]. 4.2.1. Equalization Losses Equalization losses constitute a family of classification losses for recognition tasks in which the dataset at hand presents a long-tailed distribution [103]. These losses rely on the gradient itself as a way to weight the contribution of the different instances to the final loss, rather than precomputed statistics based on the frequency of classes in the dataset. The reason to do that is that, as the authors of [102] argue, not all the samples of the same category influence the same. In this research, we use the Equalization loss v2 (EQLv2) [102]. According to the idea introduced earlier, in which every category has its own predictor or task, for each instance there are C−1tasks with negative label and one with positive label. Obviously, this leads to a great imbalance between positives and negatives for each predictor, especially for those of rare classes. For the j−th task, the accumulated positive and negative gradients along a set of instances Iare: ∇pos zj(L) = 1 |I| ∑ i∈I yi j(pi j−1) ∇neg zj(L) = 1 |I| ∑ i∈I (1−yi j)pi j (4.1)
34 Proposed Framework GNN that combines information from neighboring predictions to: refine its location and help to reduce the confidence of false positives. Although, as we have seen in Related work GNNs are not new to object detection, our research presents two peculiarities that, to the best of our knowledge, have not been explored in the literature yet: • While others’ work focuses on complex scenes (such as COCO [57] or LVIS [37] images) in which the interaction between objects is paramount, we are trying to solve the problem of overlapping predictions. Hence, the goal of including GNN in other projects is different from ours. • Although lexical information has been used to create auxiliary graphs[19, 115], we include a semantic similarity metric as an edge feature, allowing the embedding of this information without additional components (more information in Section 4.4.3). 4.4.1. GCP Architecture A diagram of GCP is displayed in Figure 4.5. There, we can identify three islands of predictions (red, blue and green) that are identified and processed by the module to produce a finer output. The input of GCP is the output of the bounding box head of the two-stage detector. As it can be seen, GCP simply consists of a GATv2 layer [11] and two additional normed linear layers that act as final regression and classification head. This module is trained jointly with the rest of the network in an end-to-end fashion. As we have now one additional classification head and regression head, we need to add two new components to the total loss of the network. In principle, the choice of these losses is independent of the losses of the original bounding box head, but we keep the same loss functions before and after GCP for the sake of simplicity. Edge features GCP Improved node representations Graph representation of region proposals Proposal refinement Bounding box Regression Classification Graph builder GATv2 Regression Classification Figure 4.5: Graph Confidence Propagation (GCP). Left. High level overview of its functioning. Right. Components of GCP (green) as well as its connection with the rest of the network (blue).
4.4. Graph Neural Networks to Refine Detector Predictions 35 4.4.2. Construction of the Graph In this project, we propose the usage of a GNN that combines the information of neighboring proposals to refine both their classification and their bounding-box regression. This GNN is appended at the end of the network, just before the classification and regression branches. At this point, in the traditional Mask R-CNN, each proposal of the network is represented by a feature vector, vi∈RD, which is fed to both heads, leading to a final prediction. These vectors viconstitute the node embeddings of the graph. Regarding the adjacency matrix, we follow a very simple approach motivated by previous observations: two proposals are considered neighbors if and only if the IoU between them is greater than or equal to a given threshold τ. This is a key difference from other approaches, which base their adjacency matrix on cooccurrences of the labels [114], K-Nearest Neighbors [115], or use a fully connected network and rely on attention mechanisms [19]. The rationale behind this decision is that the problem we are trying to address is directly related to spatially accumulated bounding boxes. Thus, the hyperparameter τenables us to control how strict we are when looking for islands of predictions. 4.4.3. Edge Features In addition to the IoU information that defines the adjacency matrix, we explore different edge features to embed further prior information that characterizes the relationship between two neighboring nodes. Selection of edge features is paramount, as it provides GATv2 with additional information to decide which neighbors each node should pay attention to. More concretely, we consider three different dimensions to define edge features: spatial, lexical, and statistical. In the former, we include not only IoU, but also its variant GIoU [86], as well as the spatial features used in the positional relation module of [19] described in Section 3.4.2. These features encode all the information that is required to transform one bounding box into the other, and thus it is not symmetrical. This means that we need to use directed graphs. On the other hand, we also leverage the lexical embeddings described in Section 4.3.1. Given a class ciof the dataset, USE computes a feature vector li∈R256 that encodes the semantic information of the label that describes the class. Thus, for a dataset of Cclasses, we obtain a matrix L∈R(C+1)×256 of lexical feature vectors, where the last row corresponds to the background class and is computed as lbackground =−1 C C ∑ i=1 li ∥li∥2 , that is, the opposite of the mean of the normalized feature vectors of all classes. With this, we aim to obtain a simple approximation of a vector that is maximally different from the foreground concepts of the dataset in terms of the cosine distance (on average). Consider now that the proposals piand pjare neighbors according to the conditions established in Section 4.4.2. During training time, we know the true labels of these proposals, but in inference we cannot use this information. However, for each of these proposals (nodes in the network), we can obtain the classification score (already normalized via softmax) given by
36 Proposed Framework the original classification head2for each of them si, sj∈RC+1, respectively (remember that the last additional class correspond to background). Then, instead of using the lexical embedding of the ground-truth class, we can compute lexical representation of a proposal as follows: ˆ li= C+1 ∑ k=1 cik ·lk∈R256, ˆ lj= C+1 ∑ k=1 cjk ·lk∈R256, where cik represents the score of pifor the k−th class. Thus, we can get a representation of the proposal in the lexical space as a linear combination of the embeddings of the classes, even if we do not have access to the real label information. This enables the computation of lexical similarity between the two nodes of the networks as the cosine similarity of their lexical representations: Simlex(pi, pj) = Sim(pj, pi) = ⟨ˆ li,ˆ lj⟩ ∥ˆ li∥2∥ˆ lj∥2 . Note that as far as we know, this is the first time that this kind of information has been used to enhance object detection and instance segmentation. For the statistical information, we compute the co-occurrence matrix, O, of the classes from the training set. In other words, Oij contains the probability of the class jappearing if we observe class i. Again, as we do not know the real labels of the proposals at inference time, we cannot use directly the values of O. However, we can follow a similar approach to the one described above for the lexical features. It is enough to consider that matrix indexing can be achieved via matrix multiplication: Oij =eiOe⊺ j,(4.3) where ek∈R1×Cstands for the row vector that is null except for the k−th component. As we do not have “crisp” indexing (labels are unknown), we can replace ei, ejwith the scores si, sjin Equation (4.3) (disregarding the last component corresponding to background). The result is then used as “expected co-occurrence” of proposals piand pj. As we illustrate in Figure 4.6, once the model finds some detections for an image, GCP receives this information and tries to combine the features of different proposals to generate a new set of higher quality detections, improving both the classification and the localization. 2The classification head that is applied before the GNN
4.4. Graph Neural Networks to Refine Detector Predictions 37 Figure 4.6: Example of the expected output of GCP
5 Results and Discussion In this chapter, we present the experimentation and analysis performed to validate our proposal. At first we will describe the experimental setup, including software, configuration and hardware. Then we will introduce the datasets used and the evaluation metrics. After that, we thoroughly analyse each component separately and combined in an instance segmentation dataset. Then, we contrast the conclusions extracted from those experiments in a food object detection benchmark using two different architectures. Finally, we present some detection examples of the trained model, as well as some limitations of the solutions. 5.1. Experimental Setup For the sake of reproducibility, a Docker [69] image was created to serve as a stable and portable developing environment. In addition to this, for all experiments a fixed random seed was used. The deep learning framework chosen for the implementation of the different algorithms and the execution of the experiments was Pytorch in its version 1.13 [80]. More concretely, we base our code on the toolbox MMDetection version 2.25.0 [72] and its foundational library MMCV version 1.6.0 [23], which are widely adopted in the research community as the base for the development of new algorithms. Most of the state-of-the-art methods are available in MMDetection, and its modular design makes it easy to integrate new components. For our experiments, three architectures are considered: Faster R-CNN [85], Cascade R- CNN [13] for object detection and Mask R-CNN [40] for instance segmentation. Unless otherwise specified, we use as a starting point the basic configuration provided in MMDetection for Faster R-CNN, Mask R-CNN and Cascade R-CNN1for the COCO dataset [57]. More concretely, the main configuration details are as follows for the three architectures: • Training schedule of 12 epochs, as it is commonly done in the literature [54, 57, 110]. • Batch size of 2 images per GPU. • SGD with a learning rate of 0.02, momentum of 0.9 and weight decay of 1e−4. This learning rate is for the original batch-size of 2×8, and is automatically scaled based on the final batch-size used during training. • Learning rate warmup of 500 training iterations. • The learning rate is reduced by a factor of 10 at the end of epochs 8 and 11. 1https://github.com/open-mmlab/mmdetection/tree/31c84958f54287a8be2b99cbf87a6dcf12e57753/ configs 39
40 Results and Discussion • The input images are resized so that their longer size fits inside a 1333 ×800 images. Resize is done keeping the aspect ratio. • The only data augmentation applied is random flip with a probability of 0.5. • During training, the IoU threshold of the RPN is set to 0.7 for the three architectures, the IoU threshold of the final regression layers of the R-CNN is 0.5 for Faster R-CNN and Mask R-CNN. Cascade R-CNN presents three R-CNN stages with IoU thresholds of 0.5,0.6and 0.7. • The inference-related configurations are as follows: –NMS with a IoU threshold of 0.7 for the output of the RPN. –Vanilla NMS with a IoU threshold of 0.5 for the output of the network. –Final classification threshold of: 0.05 for Faster R-CNN and Mask R-CNN, and 0.001 for Cascade Mask R-CNN. For all the experiments, we maintain ResNet-50 [39] pretrained on ImageNet-1K [27] as the backbone, as is commonly done in the literature. A FPN is used taking as input for the pyramid the last 4 stages of the ResNet-50 as described in Section 3.1.5. In terms of hardware, the experiments were carried out using a Nvidia RTX 3090 24GB provided by the research group CVMLUB of Universitat de Barcelona. 5.2. Datasets 5.2.1. AiCrowd Food Challenge 2022 The dataset used during this research for instance segmentation is the AICF22 dataset. The reason to use it is because on one hand this is the only public dataset for food instance segmentation and on the other hand it is sufficiently rich and complex in order to validate our proposals and their improvements. The dataset was used for the aforementioned challenge, and it is an extended version (regarding the number of ingredients and images) with respect to the dataset of previous years’ editions [73]. The dataset contains images of 323 categories or classes, corresponding to different ingredients and meals. The dataset consisted of 54,392 annotated images (for training and validation) and a test set of 2,819 pictures for which only the images have been made public. This test set was the one employed to evaluate the submissions to the challenge platform. Figure 5.1 contains some examples of images and annotations of the dataset. A first Exploratory Data Analysis (EDA) showed that the data set had some defects that we had to overcome. As we can observe in Figure 5.1, it is easy to find some of the deficiencies: missing objects, coarse segmentations and even notably wrong segmentation. Nevertheless, the most relevant problem, which we think we must highlight, is that the validation set provided by the organization (composed of 1,000 images) was a subset of the training set and it did not contain images for all the classes. These facts, especially the former, made the provided validation set unsuitable for its purpose. Because of that, we decided to create our own data train-validation split from the training set. We wanted this split to be stratified, so that the distribution of the different classes remained as similar as possible in both sets. As it has been pointed out by different authors, traditional single-label stratification is not
5.2. Datasets 41 Figure 5.1: Examples of images in AICF22 dataset and their ground truth segmentation. appropriate for multi-label cases (which resembles more the scenario of object detection or instance segmentation dataset) [91, 99]. Because of that, we made use of an specialized tool for multi-label stratification in order to perform the splitting [98]. Due to the problems of the public validation set, we have decided to make public our data split with the aim of encouraging easy and comparable research using this dataset2. One of the main challenges we faced when working with this dataset has been the longtailed distribution of categories that it presents in terms of both the number of images and the number of instances, as demonstrated by Figure 5.2. For example, the 9 most frequent classes represent around 26% of the entire dataset, the same number of instances as the 214 least common classes. More concretely, the number of images per class (in the training set) ranges from 3498 (water) to 35 (pearl onion). We inspired in the creators of the LVIS dataset [37] to structure and categorize the classes of the AICF22 dataset depending on their frequency. This allows to analyze the performance of the solutions depending on the frequency of the classes. In [37], the categories are divided into three groups depending on their frequency in the training dataset: frequent (more than 100 images), common (more than 10 and less than 100 images), and rare (at most 10 images). We follow the same pattern, but we adapted the number to our dataset (e.g. no category has less than 10 images in the training set). Particularly, we defined 100 and 500 images in the training set as the thresholds for our dataset. Some details of the resulting groups can be found in Table 5.1. 5.2.2. UECFood-256 For object detection-only task, we worked with the UECFood-256 dataset [50], which is composed of 29774 images containing 256 different Asian-cuisine dishes. For this dataset, we 2https://drive.google.com/drive/folders/1wYH1_0h3KqqdOX2HezlTjxZg74Fko0mF
42 Results and Discussion 0 50 100 150 200 250 300 Category 0 1 2 3 4 Percentage of images Set All Train Validation (a) Percentage of images containing representatives of each category. Categories are sorted in decreasing frequency order. 1 50 100 150 200 250 300 Category 0 20 40 60 80 Cum. Percentage of instances (b) Cumulative percentage of instances corresponding to the 323 classes. The segments of different colors represent groups of categories that account for 25% of the instances. Figure 5.2: Long-tailed distribution of AICF22. Class type Number of classes Percentage instances Frequent 27 44.86% Common 159 43.40% Rare 137 11.74% Table 5.1: Statistics of the three groups of classes defined for AICF22 based on LVIS [37]. use a public validation split, which defined 24097 images as training images and 5677 images as validation images. In Figure 5.3, we observe that this dataset also presents a long-tailed distribution. Nevertheless, in this case this behavior is less pronounced: the number of images per class in the training set ranges from 484 (miso soup) to 80 (crispy noodles). Moreover, we can appreciate in Figure 5.3b how the cumulative percentage distribution is almost linear from the 30 −th category (approximately) which indicates that the frequency of the tail classes is mostly uniform. Indeed, if we sort the tail classes by the number of images in the training set and take the difference between two consecutive classes, there are only 16 gaps greater than 1. In other words, for all the numbers between 122 and 80 (but 16), there is at least one class with that number of images. As an additional comment, the largest gap between two consecutive tail classes is of just 2. These properties make it difficult to define the frequent, common and rare classes as we do in Section 5.2.1 for AICF22. Because of that, for this particular dataset, we decided to distinguish only two types of categories: frequent, being those classes with more than 125 in the training set (13 most frequent classes); and common, which are all the rest. It is worth mentioning that the original format of the dataset presented some problems that we had to deal with. In particular, there was an annotation problem that caused different images to have the same image name and identifier. If we are not aware of this, two problems
5.2. Datasets 43 0 50 100 150 200 250 Category 0.5 1.0 1.5 2.0 2.5 3.0 3.5 Percentage of images Set All Train Validation (a) Percentage of images containing representatives of each category. Categories are sorted in decreasing frequency order. 1 50 100 150 200 250 Category 0 20 40 60 80 100 Cum. Percentage of instances (b) Cumulative percentage of instances corresponding to the 256 classes. The segments of different colors represent groups of categories that account for 25% of the instances. Figure 5.3: Long-tailed distribution of UECFood-256. will appear in the training dataset: • Some images will be lost, as only one of the images with common identifier will be used. • In the “duplicated” image that is kept, we will have bounding boxes that do not appear in the actual image. We give some examples of this situation in Figure 5.4. We handled this problem and transformed the data into one of the most common and widely used annotation formats for object detection: COCO [57]. With the aim of encouraging and facilitating research in the field of food instance segmentation, we will provide later a public access to this reformated dataset. Figure 5.4: Examples of the problems that can appear in the UECFood-256 dataset.
50 Results and Discussion Cls (28.1) Loc (2.8) Both (1.1) Dupe (0.1) Bkg (1.4) Miss (6.2) Figure 5.9: TIDE error report for SLOF-DS. Figure 5.10: EigenCAM [75] (top row) and DFF [22] (bottom row) output of SLOF-DS for some images of the AICF22 dataset. dependant norm in the columns of the weight matrix of the classifier. To illustrate this phenomenon, we show in Figure 5.12 the norm of the classifier column corresponding to each class in the basic baseline after training. In this plot, we can observe the clear trend between the frequency of the classes and the norm of its column. Using normed linear layers helped to solve this problem. Finally, we show in Figure 5.13 the impact of the introduced MaskIoU head from Mask Scoring [42] in the correlation between the classification score of the predictions and its localization accuracy. As we can see, it is only when we introduce this component when the correlation increases, and high confidence scores are produced only for very well located masks. The fact that we only see correlation at high values of the classification score is due
5.4. SLOF-DS 51 Figure 5.11: Example of the adaptive receptive field of the DCN. The green point represents the “center”, and the red points - the perceptive field. 102103 Num. Instances (Train) 100 4 × 10 1 6 × 10 1 Cls Matrix Norm Category by frequency common frequent rare Figure 5.12: Norm of the rows corresponding to every category in AICF22 in the classification matrix of the trained vanilla Mask RCNN with ResNet-50 as backbone. Each point represents a class. Logarithmic scale is used in both axes. to the above-mentioned problem, which leads the model to produce well-located, but poorly classified masks. 0.6 0.8 1.0 Cls confidence 0.5 0.6 0.7 0.8 0.9 1.0 Mask IoU (a) Basic baseline 0.6 0.8 1.0 Cls confidence 0.5 0.6 0.7 0.8 0.9 1.0 Mask IoU (b) SLOF-DS-MaskIOU 0.5 0.6 0.7 0.8 0.9 1.0 Cls confidence 0.5 0.6 0.7 0.8 0.9 1.0 Mask IoU (c) SLOF-DS Figure 5.13: Correlation between classification score and Mask-IoU of the predictions of different models with the ground truth mask.
52 Results and Discussion 5.5. Fine-Grained Food Instance Segmentation In this section, we analyze and discuss the results of the SLOF-DS when introducing subheads based on different information (lexical described in Section 4.3.1, SIFT-based and Confusion matrix-based ones). 5.5.1. Lexical Clusters Table 5.3 contains the results in terms of the mAP for the model without subheads and the model with subhead generated from different number of clusters. As we can see, the results always improve when introducing the subheads, with enhanced ranging from +0.5to +1.1. The best results are obtained with 10 clusters, and there is a significant drop in gain when the number of clusters increases to 15. Because of that, we keep 10 as the optimal size of the clustering and we keep this size for the rest of the experiments. In Figure A.1 a dendrogram with the 323 classes and the 10 final clusters is presented. Model Number of clusters mAP SLOF-DS – 23,4 SLOF-DS 5 24,4 SLOF-DS 10 24,5 SLOF-DS 15 23,9 Table 5.3: Ablation of the number of lexical clusters Once we had chosen the best number of clusters, we decided to analyze more in depth the changes in the behaviour of the model. Regarding the classification, in Figure 5.14, we study how the confusion matrix of the different clusters evolves when using the 10 lexical subheads during training compared to the results obtained by the best model in Section 5.4. As we can see, the mean precision of all the clusters increases, with an especially relevant increase in the clusters 0, 2 and 7. Despite improving the results for all clusters, we see in Figure 5.14b that there are some clusters for which the confusion with images of the same cluster increases. In other words, the confusion intra-cluster increases. This means that the additional tasks introduced during training by the multi-head approach are pulling away some clusters from the others rather than separating the classes within the cluster. Although this result might be unexpected, it can be explained by the fact that the new heads introduced also include the output “other”, which improves the ability of the network to differentiate different clusters. Indeed, by looking at Figure 5.15 we can see that the rate of inter-cluster false positives is reduced for all the clusters, but the number 6, whose increase is very small. This is another evidence that, for this lexical clustering, the proposed multi-task approach is more useful to separate the cluster between them. The four clusters for which intra-cluster confusion grows are clusters 3, 4, 5 and 9: •Cluster 3. The classes that made up this group can be classified mainly in two types: fruits and nuts.
5.5. Fine-Grained Food Instance Segmentation 53 25 30 35 40 45 50 55 Mean percentage of hits in confusion matrix Cluster 0 Cluster 1 Cluster 2 Cluster 3 Cluster 4 Cluster 5 Cluster 6 Cluster 7 Cluster 8 Cluster 9 +4.2 +2.4 +3.4 +1.1 +3.0 +0.7 +1.5 +3.3 +2.0 +2.3 SLOF-DS Fine Grained LEX10 (a) Change in the average of the diagonal of the (general) confusion matrix for each lexical cluster. 20 30 40 50 60 Mean intra-cluster confusion Cluster 0 Cluster 1 Cluster 2 Cluster 3 Cluster 4 Cluster 5 Cluster 6 Cluster 7 Cluster 8 Cluster 9 -1.81 -0.26 -2.82 +0.88 +0.21 +0.95 -1.86 -0.62 -1.18 +0.26 SLOF-DS Fine Grained LEX10 (b) Change in the average confusion between classes of the same cluster for each lexical cluster. Figure 5.14: Cluster-wise change in performance of the model before and after including the multitask fine-grained heads. In the left plot, the larger (positive) the difference, the better. In the right plot it is the opposite. 20 25 30 35 40 45 50 Average false positives outside the cluster. Cluster 0 Cluster 1 Cluster 2 Cluster 3 Cluster 4 Cluster 5 Cluster 6 Cluster 7 Cluster 8 Cluster 9 -2.37 -2.11 -0.60 -1.91 -3.13 -1.50 +0.29 -2.48 -2.44 SLOF-DS Fine Grained LEX10 Figure 5.15: Evolution of the average percentage of predictions of classes of each cluster whose corresponding ground-truth belonged to other cluster. •Cluster 4. This cluster is composed of different types of cheese and cold meat. •Cluster 5. Contains all the kinds of bread that appear in the dataset. •Cluster 9. This is one of the most heterogeneous clusters from the culinary point of view. It contains classes such as croissant with chocolate filling,green bean steamed without addition of salt or pizza with ham baked. Despite this heterogeneity, we can find in it some sub-clusters of very visually similar classes: different kinds of pizza, lasagnes,
54 Results and Discussion vegetables-based dishes. On the one hand, looking again at Figure 5.14a, clusters 3, 4 and 9 are those presenting the smallest intra-cluster confusion before including the fine-grained heads. Thus, small changes in the confusion matrix are more likely to increase these values. In fact, the worsening in this metric is pretty small in clusters 4 and 9, and the three clusters are still among the best performing in this regard. This observation suggests that, when the clusters are pulled apart, the categories from clusters which classes were well separated get closer in the feature space. With cluster 5, however, the situation is the opposite: it presents the highest intra-class confusion both before and after including the multi-task heads. Taking a look at the confusion matrix obtained by the best lexical-based model in Figure 5.16, the main problem is that two classes are predicted wrong very often: bread wholemeal and bread white. This is caused by three factors: 1. Images of different kinds of bread are often indistinguishable even for the human eye. 2. In some cases, the annotators used coarse labels, like bread wholemeal, for items belonging to a more concrete kind of bread that is present in the dataset, like bread wholemeal toast or bread black. This is a problem of the dataset. 3. Some classes, like bread grain,bread wholemeal and bread whole wheat are used as synonyms in different parts of the world. This is a typical problem of crowd-sourcing datasets. The first two problems are illustrated with examples in Figure 5.17. Regarding the two dataset-related problems, they would require addressing them with some noise-aware method or via relabeling. The former is out of the scope of this project, and the latter is disregarded, because altering the dataset could lead to unfair comparison with other solutions. In terms of mAP, we show in Table 5.4 the value averaged per cluster for the model trained with and without the multi-task approach. As we can see, there are also improvements in this regard for all the clusters. This suggests that the improvements in classification commented above have been translated to a better performance of the food segmentation system. Cluster mAP SLOF-DS mAP SLOF-DS+LEX10 Change 0 17.63 18.95 +1.32 1 18.37 19.32 +0.95 2 17.10 17.67 +0.57 3 31.38 32.21 +0.83 4 19.20 20.26 +1.06 5 18.19 19.98 +1.79 6 29.97 32.01 +2.04 7 26.54 27.09 +0.55 8 30.71 32.09 +1.38 9 26.14 27.30 +1.16 Table 5.4: Averaged mAP for each cluster with and without multi-task training with 10 lexical clusters.
5.5. Fine-Grained Food Instance Segmentation 55 bread_wholemeal bread bread_grain bread_white fajita_bread_only bread_whole_wheat bread_pita bread_toast braided_white_loaf_ch crisp_bread bread_black bread_wholemeal_toast bread_ticino_ch bread_fruit bread_rye focaccia white_bread_with_butter_eggs_and_milk gluten_free_bread Other(s) bread_wholemeal bread bread_grain bread_white fajita_bread_only bread_whole_wheat bread_pita bread_toast braided_white_loaf_ch crisp_bread bread_black bread_wholemeal_toast bread_ticino_ch bread_fruit bread_rye focaccia white_bread_with_butter_eggs_and_milk gluten_free_bread Other(s) 68 3.2 0.79 6.3 0 2.1 0 0.26 0.53 0.53 0 0.26 0 0.26 0 0.26 0 0 17 32 14 1.2 29 0 4.3 0.39 0.78 1.9 0.39 0 0 0 0.39 0 0 0 0 16 62 3.6 5.4 8.9 0 3.6 0 0 0 0 0 3.6 0 0 0 0 0 0 12 5.2 3.8 0 73 0.2 0.6 0 2.2 4.4 0 0 0.2 0 0 0 0.2 0.4 0 9.5 0 4.2 0 0 58 0170000000000021 48 5.2 0.65 16 0 12 0 0 1.3 0.65 0 0 0 0 0 0 0 0 17 05005050 0000000000040 6.1 6.1 0 18 0 0 0 27 6.1 0 0 6.1 0 0 0 3 0 0 27 3.2 3.2 0 30 0 1.1 0 1.1 45 0 0 0 0 0 0 0 1.1 0 15 46 0000007.700000007.70038 87 4.34.34.3000000000000000 38 3.8 0 0 0 0 0 3.8 3.8 0 0 31 0 0 0 0 0 0 19 00075 0 0 0 0 8.3 0 0 0 8.3 0 0 0 0 0 8.3 47 16 11 5.3 0 0 0 0 0 0 0 0 0 16 0 0 0 0 5.3 69 00000006.26.20000000019 0 0 0 7.1 0 0 7.1 0 0 0 0 0 0 0 0 14 0 0 71 00043 00000000000036021 42 11 0 11 0 5.3 0 0 0 0 0 0 0 0 0 0 0 0 32 29 10 2.6 29 2.6 3 3.5 1.7 5.7 2.6 0 2.6 0 0.87 0 3 3 0 0 0 20 40 60 80 100 Figure 5.16: Confusion matrix of SLOF-DS + LEX10 for the cluster 5 In order to understand whether improvements in mAP are only due to improvements of the classification head, we compare the changes in the error report generated by TIDE. As reported in Figure 5.18, the classification errors have been considerably reduced, while the others have slightly increased. This increase is not enough to affect the overall performance of the model, though. 5.5.2. SIFT-based Clusters Another kind of clustering that we explored was the one based on SIFT features, as detailed in Section 4.3.2. In order to obtain those clusters, we used Algorithm 1 with vocab_size = 10× 323 = 3230. Regarding the number of clusters, we can see the evolution of Within-Cluster- Sum of Squared Errors (WSS) for different numbers of clusters in Figure 5.19. According to that plot, we appreciate mainly one possible “elbow” point: 3. Thus, we kept this as the
56 Results and Discussion Figure 5.17: Example of very similar classes (first row) and coarse-labeled annotations (second row, right). Orange bounding boxes indicate the bounding box of the ground-truth masks. value of the hyperparameter. In Figure 5.20, we can see the 2D representation generated by UMAP from the average SIFT BOW of each category, as well as the clusters found by K-Means. At first, we try to extract some meaningfulness from the 2D representation, and thus, from the clustering. Although it is hard to be certain, the horizontal dimension seems to represent the “smoothness” of the food item: at the left of the cloud of points we can find most of the drinks of the dataset, which have very uniform textures. As we move to the right, we can find some creams and sauces, which are usually very uniform visually. On the other hand, the classes with the highest value in this dimension are: muesli,crunchy muesli,quinoa and rice; all of them classes with very noisy and detailed textures. Regarding the vertical axis, we could not extract any meaning high-level explanation. Be that as it may, the horizontal axis is the one with the highest variance, and it is the most important in the clustering process according to Figure 5.20. Therefore, one reasonable point of view is interpreting these clusters as groups of classes of similar uniformity in their textureIn the following we will refer as cluster 0, 1 or 2 to the blue, orange and green respectively.
5.5. Fine-Grained Food Instance Segmentation 57 Cls (28.1) Loc (2.8) Both (1.1) Dupe (0.1) Bkg (1.4) Miss (6.2) (a) SLOF-DS Cls (26.8) Loc (2.9) Both (1.1) Dupe (0.1) Bkg (1.5) Miss (6.6) (b) SLOF-DS+LEX10 Figure 5.18: Comparison of the TIDE errors report with and without the multi-task heads of LEX10. 1 2 3 4 5 6 7 8 9 101112131415161718 Number of clusters 0 500 1000 1500 2000 WSS Figure 5.19: Value of WSS for different number of SIFT-based clusters. 4 6 8 10 12 2 4 6 Figure 5.20: UMAP representation of the mean SIFT-based BOW of the classes of AICF22. Each point represents a class and each color a cluster. = cluster 0, = cluster 1, = cluster 2 In Table 5.5, we compare the general mAP of the best model in Section 5.4 and the model trained with the multi-task heads for 3 SIFT-based clusters. As we can see, there is a considerable improvement of 1.1 in the value of the metric.
58 Results and Discussion Model Number of clusters mAP SLOF-DS – 23,4 SLOF-DS 3 24,5 Table 5.5: Impact of using SIFT-based clusters during training In Figure 5.21 we show, similarly to what we did with lexical clusters, the changes in the confusion matrix with and without the SIFT-based multi-task heads. Again, we observe general improvements for all the clusters. Moreover, in this case, the intra-cluster confusion also improves in the three groups. On the other hand, Figure 5.22 indicates that for clusters 0 and 2, most of the improvement in the classification matrix comes from the reduction in the confusion with classes of other clusters. Nevertheless, the improvements in cluster 1 are also remarkable. Remember that this behaviour also appeared when analysing the lexical clusters in Section 5.5.1. 35 40 45 50 55 Mean percentage of hits in confusion matrix Cluster 0 Cluster 1 Cluster 2 +1.9 +3.4 +3.9 SLOF-DS Fine Grained SIFT03 (a) Change in the average of the diagonal of the (general) confusion matrix for each SIFT- based cluster. 30.0 32.5 35.0 37.5 40.0 42.5 45.0 47.5 50.0 Mean intra-cluster confusion Cluster 0 Cluster 1 Cluster 2 -0.34 -1.87 -1.62 SLOF-DS Fine Grained SIFT03 (b) Change in the average confusion between classes of the same cluster for each SIFT- based cluster. Figure 5.21: Cluster-wise change in performance of the model before and after including the SIFT- based multi-task fine-grained heads. In the left plot, the larger (positive) the difference, the better. In the right plot, the opposite occurs. The results above-mentioned suggest that, in the case of SIFT-based clusters, the auxiliary multi-task losses improve the ability of the model to distinguish between models of the same clusters and between different clusters. This improvement in classification for each group is also appreciated in the mAP if we compute the mean per cluster: it improves between 0.87 and 1.32 according to Table 5.6. Finally, Figure 5.23 illustrates that, as it was the case when using the best configuration of lexical heads, the improvements on global and per-cluster mAP are all due to the improvements of the classifier: It is the only component of the TIDE report that considerably improves, while others like the location increase a little.
5.5. Fine-Grained Food Instance Segmentation 59 10 12 14 16 18 20 22 24 Mean inter-cluster confusion Cluster 0 Cluster 1 Cluster 2 -1.59 -1.49 -2.25 SLOF-DS Fine Grained SIFT03 Figure 5.22: Evolution of the average percentage of predictions of classes of each SIFT-based cluster whose corresponding ground-truth belonged to another cluster. Cluster mAP SLOF-DS mAP SLOF-DS+SIFT03 Change 0 17.85 18.72 +0.87 1 34.89 36.21 +1.32 2 22.72 23.81 +1.09 Table 5.6: Averaged mAP for each cluster with and without the multi-task training with 3 lexical clusters. Cls (28.1) Loc (2.8) Both (1.1) Dupe (0.1) Bkg (1.4) Miss (6.2) (a) SLOF-DS Cls (26.3) Loc (3.1) Both (1.1) Dupe (0.1) Bkg (1.4) Miss (6.4) (b) SLOF-DS+SIFT03 Figure 5.23: Comparison of TIDE errors report with and without the multi-task heads of SIFT03. 5.5.3. Clusters Based on the Confusion Matrix As we are testing our proposed multi-task on top of the best model of Section 5.4, we use its confusion matrix as described in Section 4.3.3 to obtain the clusters used to build the subheads. As we commented on in that section, the confusion matrix can be very sparse, leading to very difficult-to-clusterize dendrograms. This is the case here. To understand the problem, let us take a look at Figure 5.24. In this plot, we show the sorted 2-NN distance of the classes of AICF22 with respect to DCM defined in Equation (3.3). This represents the distance between every class and its second closest class. This means that,
66 Results and Discussion Model GCP Spatial Features Lexical Features Co-occurrence Features mAP SLOF-DS - - - - 23.4 SLOF-DS ✓- - - 24.1 SLOF-DS ✓ ✓ - - 24.1 SLOF-DS ✓-✓- 24.0 SLOF-DS ✓- - ✓23.9 SLOF-DS ✓ ✓ ✓ -24.3 SLOF-DS ✓ ✓ ✓ ✓ 23.9 Table 5.14: Ablation of edge features used to construct the graph on the AICF22 dataset. In all cases, we use a single GATv2 layer and a IoU threshold of 0.5 to build the adjacency matrix. On the other hand, one critical decision when building the graph of proposals is the IoU threshold used to build the adjacency matrix. We established an initial high threshold of 0.5, because we are targeting the problem of “islands” of detections. However, it is possible that setting a too high threshold removes potentially beneficial connections between nodes. Because of that, we test lower thresholds to see if they lead to an increase in performance. Results displayed in Table 5.15 show that there is not such an improvement, and in fact, the best results are obtained with 0.5. This means that, although GATv2 [11] can learn what neighbors to pay attention to, we can make things easier, because of the particular problem we are addressing. Nevertheless, results are remarkably robust to threshold changes. Model IoU adjacency threshold mAP SLOF-DS + GCP 0.3 24.2 SLOF-DS + GCP 0.4 24.1 SLOF-DS + GCP 0.5 24.3 Table 5.15: Impact of the IoU adjacency threshold on the performance of GCP. All experiments use the best configuration from Table 5.14. 5.6.2. Analysis of the Best GCP Configuration Once we have determined the best GCP configuration in the last section, we analyze in more detail the behavior of the model. To do so, we revisit the problem that we are trying to solve with the introduction of GCP: sometimes there are islands of predictions in which the highest-confidence prediction is not of the ground-truth class. In Table 5.16, we show some numerical results that prove that the proposed method actually improves the cases that we were trying to address. To build this table, we have found all the islands present in the predictions of each model, using different IoU thresholds to determine
5.7. Combining All the Modules 67 whether two predictions belong to the same island or not. As we can see for all the thresholds, there is a relative improvement in the confidence of the predictions of the actual class of the island with respect to the false positives: in other words, the true positives present higher relative confidence with respect to the false positives when we use GCP. Island Threshold Model Percentage islands TP>FP Mean TP-FP 0.5 SLOF-DS 60.7 14.6 SLOF-DS+GCP 63.1 17.7 0.6 SLOF-DS 60.6 14.3 SLOF-DS+GCP 63.1 17.6 0.7 SLOF-DS 60.6 14.0 SLOF-DS+GCP 63.2 17.4 0.8 SLOF-DS 60.8 13.6 SLOF-DS+GCP 63.9 17.4 0.9 SLOF-DS 63.3 13.1 SLOF-DS+GCP 66.5 17.7 Table 5.16: Improvements in “islands” of predictions when using GCP. The first column indicates the overlapping IoU threshold used to find islands among the predictions. The third column contains the proportion of islands in which there is a true positive with confidence higher than the false positive with highest confidence. The fourth column contains the mean of the confidence difference between the best true positive and the worst false positive. On the other hand, we show some qualitative results in Table 5.17. Please note that the segmentations have been omitted to make the visualization clearer, but in all the cases they presented a very good match with the actual objects. For different images, we appreciate how the confidence of the true class is higher with respect to the wrong predictions than in the model without GCP (even if this is not enough to surpass them, as in the first example). In addition, we can also see the number of boxes that “vote” for each class before the application of GCP in the second model (that is, the original proposals that are input into GATv2). We appreciate how the number of correct predictions is larger, leading to an improvement in the relative confidences. Finally, according to the TIDE results reported in Figure 5.27, most of the improvements in mAP with respect to SLOF-DS come from improvements in classification, as expected. As we have seen, both the overall numerical results and the qualitative analysis support our hypothesis that the proposed GCP can help reduce the confidence of false positives in islands of predictions. 5.7. Combining All the Modules Finally, we combine in a single network the three proposals of this project. More specifically, we use the best configuration of the multi-task subheads found in Section 5.4 and the best
68 Results and Discussion Image Ground truth SLOF-DS SLOF-DS+GCP •cake chocolate •brownie (0.48) •cake chocolate (0.33) •beef (0.13) •brownie (0.56 | 7) •cake chocolate (0.45 | 22) ↑ •pear •banana (0.69) •pear (0.35) •pear (0.77 | 12) ↑ •banana (0.12 | 2) ↓ •rice •soup lentils (0.21) •rice (0.17) •rice (0.28 | 8) ↑ •soup lentils (0.14 | 2) ↓ •muffin •cookies (0.56) •muffin (0.43) •muffin (0.75 | 15) ↑ •cookies (0.20 | 1) ↓ Table 5.17: Examples of improvements when adding GCP on top of SLOF-DS. The third and fourth columns contain the predictions and confidence of both models. In the fourth row, the second number between brackets represents the number of predictions predicted for each class prior to the GCP module. configuration of GCP described in Section 5.6, that is: • Multi-task heads from two clustering approaches: 3 from the SIFT-based partition and 10 from the lexical partition. λ1= 5. • GCP with a neighboring threshold of IoU = 0.5and using as spatial and lexical features in as edge information. In Table 5.18, we report a summary of the results obtained so far in addition to the results achieved by the combination of the three components previously analyzed. We can highlight some important facts from the results. First of all, adding multi-task subheads before the GCP improves the results compared to only using GCP (+0.3), which suggests that using better inputs for the GNN enables GCP to produce better outputs. However, the best
5.7. Combining All the Modules 69 Cls (28.1) Loc (2.8) Both (1.1) Dupe (0.1) Bkg (1.4) Miss (6.2) (a) SLOF-DS Cls (26.4) Loc (3.1) Both (1.1) Dupe (0.1) Bkg (1.5) Miss (6.1) (b) SLOF-DS+GCP Figure 5.27: Comparison of the TIDE errors report of SLOF-DS with and without the GCP. overall result corresponds to using only multi-task subheads, which slightly outperforms the combination. Model Maultitask subheads GCP mAP SLOF-DS - - 23.4 SLOF-DS ✓-24.7 SLOF-DS - ✓24.3 SLOF-DS ✓ ✓ 24.6 Table 5.18: Ablation of the inclusion of the best multi-task subheads and GCP on top of SLOF-DS. Given the results obtained, it is important to understand the impact of adding GCP at the end of the multi-task subheads on the model output. Like in the previous section, we show the statistics of the islands found in the predictions of both models in Table 5.19. Again (apart from one value), including the GCP improves the relative confidence of the true positives with respect to the false positives. This means that, even if overall mAP is slightly worse, the GCP is working as intended (reducing the problem of the islands). Therefore, we conduct further studies to understand the small drop in performance of the final model. In Figure 5.28 we show the distribution of confidence in the predictions of both models. If some image had no false positives or true positives, the mean was set to 0 for the corresponding group (i.e. no prediction equals confidence of 0). It is clear that using GCP increases the confidence of true positives, especially increasing the lower quartile of the distribution. Moreover, it reduces the confidence of the false positives, in this case especially in the higher quartile. These results go in line with the figures reported in Table 5.16, and supports the notion that GCP improves the distributions of confidence in both false positives and false negatives by using information from neighboring proposals. To have an even clearer idea of the changes that GCP is introducing in these distributions, we present in Figure 5.29 two scatter plots: one for false positives and another for true positives. According to the information shown, we can extract some valuable insights:
70 Results and Discussion Island Threshold Model Percentage times TP>FP Mean TP-FP 0.5 SLOF-DS + Multi-task subheads 63.2 16.2 SLOF-DS + Multi-task subheads + GCP 63.5 17.9 0.6 SLOF-DS + Multi-task subheads 62.8 15.8 SLOF-DS + Multi-task subheads + GCP 63.4 17.7 0.7 SLOF-DS + Multi-task subheads 62.8 15.5 SLOF-DS + Multi-task subheads + GCP 63.5 17.7 0.8 SLOF-DS + Multi-task subheads 63.9 15.6 SLOF-DS + Multi-task subheads + GCP 64.6 17.9 0.9 SLOF-DS + Multi-task subheads 66.8 16.1 SLOF-DS + Multi-task subheads + GCP 66.3 17.0 Table 5.19: Improvements in “islands” of predictions when using GCP and multi-task fine-grained heads. The first column indicates the overlapping IoU threshold used to find islands among the predictions. The third column contains the proportion of islands in which there is a true positive with confidence higher than the false positive with the highest confidence. The fourth column contains the mean of the confidence difference between the best true positive and the worst false positive. • Confidence of false positives is reduced in most of the images, but this decrease is especially sharp in the worst (original highest confidence) case. On the other hand, some images get worse results in this regard, but in much less extent than the improvements. Only the results for some images from the originally best performing group are highly worsened. • In the case of true positives, we see a similar trend (in the opposite direction), but this time the improvements are much clearer (great mass of points below x= 0). All the previously discusses facts indicate that the GCP is mainly acting as we intended to, but the improvements introduced in the confidence distributions are not reducing the rate of false positives so that this has a positive impact on the mAP. This can be due to the fact
5.7. Combining All the Modules 71 FP TP Evaluation 0.0 0.2 0.4 0.6 0.8 1.0 Confidence SLOF-DS + Multitask subheads + GCP SLOF-DS + Multitask subheads Figure 5.28: Comparison of distributions of per-image mean confidence of true positives and false positives. that, according to the above-discussed, the GCP seems to be working like a regularizer by combining neighbors information. It improves a lot the gravest errors, but it also introduces some additional errors. 0.0 0.2 0.4 0.6 0.8 1.0 Mean per-image FP confidence without GCP 1.00 0.75 0.50 0.25 0.00 0.25 0.50 0.75 1.00 Inrecement of confidence with GCP (a) False positives 0.0 0.2 0.4 0.6 0.8 1.0 Mean per-image TP confidence without GCP 1.00 0.75 0.50 0.25 0.00 0.25 0.50 0.75 1.00 Inrecement of confidence with GCP (b) True positives Figure 5.29: Changes in mean per-image confidence vs. the mean per-image confidence of the model SLOF-DS with the multi-task head. Every point represents an image. The vertical axis represents the increment in mean confidence for each image and prediction type when introducing GCP.
72 Results and Discussion This regularization also can be seen at the class-level. In Figure 5.30, where we have the class-wise distribution of mAP for both models, we can see that the first 2 quartiles improve with GCP, but the third quartile is worse. 0 10 20 30 40 50 60 70 mAP 10.2 10.5 322. 522. .0536 635. Multi-task subheads SLOF-DS + GCP Multi-task subheads+ SLOF-DS + Figure 5.30: Distribution of per-class mAP with and without GCP in the AICF22 dataset. With all the discussed in this section taken into account, we consider that, even if mAP is slightly worse in the complete model (-0.1), we think that the properties of the predictions generated by the final model are more desirable than those of the model with only multi-task subheads. Finally, and according, again, to the TIDE report, we see the great drop in the penalization from the classification head after adding both the multi-task fine-grained subheads and GCP. Indeed, the value of 25.1 for this error of the report is the lowest among all the configurations considered so far. This fact reinforces the idea that the model which combines all the proposed improvements is the one that better corrects the problems that we initially identified. Cls (28.1) Loc (2.8) Both (1.1) Dupe (0.1) Bkg (1.4) Miss (6.2) (a) SLOF-DS Cls (25.1) Loc (3.3) Both (1.2) Dupe (0.1) Bkg (1.7) Miss (5.8) (b) SLOF-DS+LEX10+SIFT03+GCP Figure 5.31: Comparison of TIDE errors report of SLOF-DS with and without the best fine-grained configuration and GCP.
5.8. Comparison to the State-of-the-Art 73 5.8. Comparison to the State-of-the-Art In this section, we compare the results of our proposal on AICF22 with two state-of-the-art methods on long-tailed instance segmentation: Forest R-CNN [110] and IOF [2]. For both methods, we use the best reported configuration in their papers, and we take the official implementation to allow perfect reproducibility and a fair comparison. There is only one exception. Although we use the NMS-resampling method for Forest R-CNN (as they mention in their paper), we do not use RFS for IOF, because it would have considerably increased the training schedule. Results displayed in Table 5.20 show that, for the considered dataset, our proposal clearly outperforms the other approaches in the 6 considered metrics: average precision with a matching threshold of 0.5 and 0.75, mean average precision for rare, common and frequent classes and global mean average precision. Indeed, the results of plain SLOF-DS are also very close to the second best solution (IOF with DCN in the backbone). These results confirm that the problems that the food-specific solutions that we have proposed in this thesis enable a great improvement over generalist state-of-the-art methods. Method AP@50 AP@75 mAPrmAPcmAPfmAP Mask RCNN [40] 27.5 21.3 14.4 22.0 28.1 19.3 Forest R-CNN (2022) [110] 30.4 23.3 17.7 23.8 27.0 21.5 IOF (2022) [2] 30.6 23.3 16.7 24.2 28.4 21.4 IOF (2022) [2] †32.3 26.1 18.9 26.5 30.8 23.5 SLOF-DS †(ours) 32.3 25.8 18.5 26.4 30.8 23.4 Our approach †(ours) 34.0 27.4 20.4 27.2 31.3 24.6 Table 5.20: Comparison of the results in AICF22 with different state of the art methods for longtailed object detection. All the models use Mask RCNN and ResNet-50-FPN. †indicates that the ResNet-50 convolutions have been replaced with DCN [25]. 5.9. Results on UECFood-256 In this section, we test our proposal on the object detection dataset UECFood-256 [50] with the aim of testing the generalization ability. Particularly, we test the contributions over two different two-stage object detection architectures: Faster R-CNN and Cascade R-CNN. As we have already analyzed in detail the behavior and impact of each component, here we merely show the results without discussing them in-depth. Please, note that since we are not performing segmentation, we do not include Mask Scoring in these tests. In Table 5.21, we show the impact of the different components of SLOF-DS in the results for this dataset. Like in the case of AICF22 dataset, the mAP improves incrementally when we include the different elements. In this dataset, our results are much higher than in the previous one. In the case of the cascade architecture, we can also see evident changes, with an overall improvement of +3.9 in the mAP. According to the TIDE results shown in Figure 5.32, the classification errors now account for a greater proportion of penalty than before. However, this value is much lower than the
74 Results and Discussion best configuration for AiCrowd. According to the results, we can highlight different possible causes for the better mAP in this dataset: classification works much better, very likely because of the number of categories; localization and missing are drastically reduced because object detection is much easier than instance segmentation, and finally, UECFood-256 does not present small objects (with bounding box below 32×32 that were present in AICF22), which are usually missed by traditional object detectors. As expected, we see a similar pattern for the Cascade SLOF-DS, but with a much smaller error due to the classification. Probably, the most surprising results is that the error attributed to the location is higher in the cascade, which we did not foresaw due to the multi-stage bounding box refinement performed by the cascade. Network GIoU EQLv2 Normed Linear DCN mAP Faster-RCNN + R50 - - - - 46.9 Faster-RCNN + R50 ✓ ✓ ✓ - 49.5 Faster-RCNN + R50 (SLOF-DS) ✓ ✓ ✓ ✓ 52.6 Cascade-RCNN + R50 - - - - 54.1 Cascade SLOF-DS + R50 ✓ ✓ ✓ ✓ 58.0 Table 5.21: Impact on the results of the different additions to SLOF-DS and the Cascade SLOF-DS in the results on the UECFood-256 dataset. Cls (20.1) Loc (1.8) Both (0.5) Dupe (0.1) Bkg (0.7) Miss (1.2) (a) SLOF-DS Cls (14.2) Loc (2.0) Both (0.4) Dupe (0.0) Bkg (0.7) Miss (0.6) (b) Cascade SLOF-DS Figure 5.32: TIDE errors report for the SLOF-DS and the Cascade SLOF-DS in the UECFood-256. Similar to what we did for AICF22, we explore the three proposed dimensions for the multi-task framework: •Lexical. We follow the same approach for the construction of the dendrogram. We decided to keep ten as the number of clusters, even if it is true that it is possible that this number of groups works well for AICF22 and not for the UECFood-256. The
5.9. Results on UECFood-256 75 obtained and colored dendrogram is visualized in Figure A.3. •SIFT-based. We applied the elbow method similarly in this case, obtaining 6 as the candidate for the number of clusters, as we illustrate in Figure 5.33. The final distribution of the clusters in the 2D space generated by UMAP is shown in Figure 5.34. Unfortunately, this time we were not able to find any meaningful high-level relation in the UMAP dimensions. •Confusion matrix-based. In the same way we did for AICF22, we computed the confusion matrix of the SLOF-DS after training. We encountered the same sparsity problems mentioned in Section 5.5.3, and end up using again t= 0.9·MaxHeight(dendrogram) as the cutting threshold of the dendrogram (displayed in Figure A.4). In this case, 18 clusters were initially found, but 5 were discarded for being unitary or binary clusters, and 1 cluster was ruled out for being too big. 1 2 3 4 5 6 7 8 9 101112131415161718 Number of clusters 200 400 600 WSS Figure 5.33: Value of the WSS for different number of SIFT-based clusters on the UECFood-256. 2345 6 8 10 12 Figure 5.34: UMAP representation of the mean SIFT-based BOW of the classes of the UECFood- 256. Each point represents a class and each color - a cluster. After obtaining the clusters, we added the corresponding multi-task heads to the SLOF-DS and trained from scratch. In Table 5.22, we display the obtained results. Please note that,
82 Results and Discussion 5.11. Limitations of the Approach In spite of the promising results in different datasets and architectures reported in this chapter, the proposed solution present some limitations: • Although the changes introduced by the SLOF-DS have proved helpful in improving the mAP of rare classes, they are still the classes with the lowest performance. • The different clustering techniques used have brought improvements in all the studied cases, but they do not always allow a high-level understanding of the the groups generated, which limits future refinements. • Also regarding the multi-task subheads, the combination of different sources of information does not boost the results consistently. Therefore, trying different alternatives is advisable to get the best configuration, which increases the training expenses. • The proposed GCP successfully tackles the targeted problem, i.e. changing the confidence distribution of the true positives and false positives in ares of the image with high density of predictions. However, these improvements can sometimes not be enough to improve the mAP of the model.
6 Conclusion and Future Work 6.1. Conclusions The main objective of this thesis was the study of long-tailed food object detection and instance segmentation, which we have fulfilled by proposing and evaluating different components that address the main challenges that we have found for those tasks. The proposals have been tested and analyzed using the instance segmentation dataset AiCrowd Food Challenge 2022 (AICF22) as well as the object detection dataset UECFood-256 [50]. More concretely, we have built a strong and optimized model integrating in an efficient way different ingredients proposed in the literature. These elements were introduced with the aim of adapting a basic Mask R-CNN [40] to tackle long-tailed food detection and segmentation. Analysis performed has proved that this series of additions has helped in the expected direction, achieving important performance improvements by mitigating some of the major problems found: large class imbalance, heavily changing shape of the target objects (i.e. food items), and great misalignment of mask/detection precision and classification accuracy. Then, inspired by the work carried out in [87], we proposed a multi-task learning framework that exploits prior information, e.g. lexical and texture information, to add additional guidance to the training process by clustering the categories of the dataset. Contrary to what we expected, this additional guidance seemed to help more in pulling the different clusters apart rather than separating the different classes of the same cluster, but this was not an obstacle to achieve important performance improvements. Moreover, we tested that the gain achieved by using pre-computed information exceeds the enhancements of using confusion matrix data, which in turn avoids the computational burden of training twice. Moreover, the proposed method does not increase computation or number of parameters time during inference. Although we expected complementary knowledge to increase performance in all scenarios, this was only the case for the instance segmentation dataset, which after the analysis performed in Results and Discussion indicates that the contribution of different partitions of the categories is limited by the similarity of them. On the other hand, we identified that the main source of errors in long-tailed food object detection and instance segmentation was the classification components, while the localization was mainly good. We diagnosed the presence of regions with a high density of predictions, that we refereed to as “islands” of predictions, among which there were true positive and several false positives. In order to increase the confidence of the actual class and reduce that of other predictions, we proposed Graph Confidence Propagation, a GNN-based module that aggregates information of overlapping proposals to allow them to improve one another. Results in both datasets and all the architectures show the potential of this component to improve the distribution of confidence scores in both true positives and false positives. 83
84 Conclusion and Future Work In addition to the results of the research itself, we were able to contribute in two ways. On one hand, we provided a faster implementation of NMS-resampling [110], a state-of-the-art resampling method. We expect that the speed gains will encourage more people to test, use and improve this tool. On the other hand, we addressed some of the issues of the annotations of UECFood-256 [50] object detection dataset, and have transformed it to one of the most used and supported annotation formats: COCO [57]. We hope that this contribution will stimulate the research on food object detection by making the usage of this dataset easier for newcomer researchers. Finally, the research carried out during the first stages of this project has already been tested and implemented in a real-world scenario within the framework of the European project SHAPES. Particularly, the designed instance segmentation module served as a key part of a food logging app that helps the elderly to have better dietary habits. This highlights the usefulness of this research field and the positive impact its growth could have in the society. 6.2. Future Work At first, we would like to highlight that we are, at the time of writing, preparing a submission to a journal to publish the main contributions of this thesis. Despite the fact that the goals established at the beginning of the research have been successfully accomplished, there is still a huge margin for continuation of the work. In the following lines, we present some of these ideas for future research. First of all, the next path of research that we are going to explore is related to the GCP. Given the improvements in the confidence distribution, we consider that additional postprocessing approaches (that may be based on some NMS variations such as CP-cluster [94]) could leverage these improvements and lead to potential gains in the quality of final predictions. Moreover, we also find discrepant results regarding whether or not using complementary information to build the multi-task fine-grained heads is helpful or not. Therefore, this path needs to be explored more in depth to try to find in which situations this is really beneficial. Although the datasets used during this thesis have more classes than most of the similar datasets, they are still small compared to the huge variety of food and meals around the world. Having a dataset containing all possible classes is neither practical nor feasible in any open domain. This is why, in recent years, cross-modal models like CLIP [111], which allow zero-shot image classification thanks to the entanglement of lexical and visual features, have gained popularity. On the other hand, we have seen in our research the positive impact that the use of lexical information in different ways can have in food detection. Therefore, we consider that an interesting path of research is using large cross-modal datasets, such as [65] to work towards the creation of an open food image detection and segmentation system. Finally, although the project was focused since its conception on food instance segmentation and detection, we believe that some of the proposal and insights extracted from our research could help in other domains and datasets, such as the long-tailed benchmark LVIS [37]. This dataset is bigger, has more classes and presents a more clear long-tailed distribution than the ones used in this project. Therefore, it is a good dataset to evaluate the potential and generality of our proposal.
Bibliography [1] Afshin, A. et al. “Health effects of dietary risks in 195 countries, 1990–2017: a systematic analysis for the Global Burden of Disease Study 2017.” In: The Lancet 393.10184 (May 11, 2019), pp. 1958–1972. issn: 0140-6736. doi:10.1016/S0140 - 6736(19 ) 30041-8. [2] Alexandridis, K. P. et al. Inverse Image Frequency for Long-tailed Image Recognition. Sept. 11, 2022. doi:10.48550/arXiv.2209.04861. arXiv: 2209.04861[cs]. [3] Allaoui, M., Kherfi, M. L., and Cheriet, A. “Considerably improving clustering algorithms using UMAP dimensionality reduction technique: A comparative study.” In: Image and signal processing. Ed. by A. El Moataz et al. Cham: Springer International Publishing, 2020, pp. 317–325. isbn: 978-3-030-51935-3. [4] Arslan, B. et al. “Fine-grained food classification methods on the UEC food-100 database.” In: IEEE Transactions on Artificial Intelligence 3.2 (2021), pp. 238–243. [5] Aslan, S. et al. “Benchmarking algorithms for food localization and semantic segmentation.” In: International Journal of Machine Learning and Cybernetics 11.12 (2020), pp. 2827–2847. [6] Bhowmik, A. et al. Detecting Objects with Graph Priors and Graph Refinement. Dec. 23, 2022. doi:10.48550/arXiv.2212.12395. arXiv: 2212.12395[cs]. [7] Bodla, N. et al. “Soft-NMS — Improving Object Detection with One Line of Code.” In: 2017 IEEE International Conference on Computer Vision (ICCV). 2017 IEEE International Conference on Computer Vision (ICCV). Venice: IEEE, Oct. 2017, pp. 5562– 5570. isbn: 978-1-5386-1032-9. doi:10.1109/ICCV.2017.593. [8] Bolanos, M. and Radeva, P. “Simultaneous food localization and recognition.” In: 2016 23rd International conference on pattern recognition (ICPR). IEEE. 2016, pp. 3140– 3145. [9] Bolya, D. et al. “Yolact: Real-time instance segmentation.” In: Proceedings of the IEEE/CVF international conference on computer vision. 2019, pp. 9157–9166. [10] Bolya, D. et al. “TIDE: A General Toolbox for Identifying Object Detection Errors.” In: Computer Vision – ECCV 2020. Ed. by A. Vedaldi et al. Lecture Notes in Computer Science. Cham: Springer International Publishing, 2020, pp. 558–573. isbn: 978-3-030- 58580-8. doi:10.1007/978-3-030-58580-8_33. [11] Brody, S., Alon, U., and Yahav, E. How Attentive are Graph Attention Networks? Jan. 31, 2022. doi:10.48550/arXiv.2105.14491. arXiv: 2105.14491[cs]. [12] Bruno, V., Resende, S., and Juan, C. “A survey on automated food monitoring and dietary management systems.” In: Journal of health & medical informatics 8.3 (2017). [13] Cai, Z. and Vasconcelos, N. “Cascade R-CNN: High Quality Object Detection and Instance Segmentation.” In: IEEE Transactions on Pattern Analysis and Machine Intelligence 43.5 (2021), pp. 1483–1498. doi:10.1109/TPAMI.2019.2956516. 85
86 Bibliography [14] Carion, N. et al. End-to-End Object Detection with Transformers. arXiv:2005.12872. arXiv, May 28, 2020. doi:10.48550/arXiv.2005.12872. arXiv: 2005.12872[cs]. [15] Cer, D. et al. Universal sentence encoder. 2018. arXiv: 1803.11175[cs.CL]. [16] Chen, K. et al. “Hybrid task cascade for instance segmentation.” In: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. 2019, pp. 4974– 4983. [17] Chen, S., Li, Z., and Tang, Z. “Relation R-CNN: A Graph Based Relation-Aware Network for Object Detection.” In: IEEE Signal Processing Letters 27 (2020), pp. 1680– 1684. issn: 1558-2361. doi:10.1109/LSP.2020.3025128. [18] Chen, S. et al. “Improving Object Detection with Relation Mining Network.” In: 2020 IEEE International Conference on Data Mining (ICDM). 2020 IEEE International Conference on Data Mining (ICDM). Nov. 2020, pp. 52–61. doi:10.1109/ICDM50108. 2020.00014. [19] Chen, S. et al. “Object detection using dual graph network.” In: 2020 25th international conference on pattern recognition (ICPR). 2021, pp. 3280–3287. doi:10.1109/ ICPR48806.2021.9412825. [20] Cheng, B. et al. “Masked-attention Mask Transformer for Universal Image Segmentation.” In: 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). 2022, pp. 1280–1289. doi:10.1109/CVPR52688.2022.00135. [21] Ciocca, G., Napoletano, P., and Schettini, R. “Food recognition: a new dataset, experiments and results.” In: IEEE Journal of Biomedical and Health Informatics 21.3 (2017), pp. 588–598. doi:10.1109/JBHI.2016.2636441. [22] Collins, E., Achanta, R., and Susstrunk, S. “Deep feature factorization for concept discovery.” In: Proceedings of the european conference on computer vision (ECCV). 2018, pp. 336–352. [23] Contributors, M. MMCV: OpenMMLab computer vision foundation. 2018. [24] Cox, A. M., McKinney, P., and Goodale, P. “Food logging: an information literacy perspective.” In: Aslib Journal of Information Management (2017). doi:10.1108/ AJIM-12-2016-0208. [25] Dai, J. et al. “Deformable Convolutional Networks.” In: 2017 IEEE International Conference on Computer Vision (ICCV). 2017, pp. 764–773. doi:10.1109/ICCV.2017.89. [26] Dai, Y., Park, S., and Lee, K. “Utilizing Mask R-CNN for Solid-Volume Food Instance Segmentation and Calorie Estimation.” In: Applied Sciences 12.21 (2022), p. 10938. [27] Deng, J. et al. “ImageNet: A large-scale hierarchical image database.” In: 2009 IEEE conference on computer vision and pattern recognition. 2009, pp. 248–255. doi:10. 1109/CVPR.2009.5206848. [28] Dosovitskiy, A. et al. “An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale.” In: arXiv:2010.11929 [cs] (June 3, 2021). arXiv: 2010.11929.
Bibliography 87 [29] Ege, T., Shimoda, W., and Yanai, K. “A New Large-scale Food Image Segmentation Dataset and Its Application to Food Calorie Estimation Based on Grains of Rice.” In: Proceedings of the 5th International Workshop on Multimedia Assisted Dietary Management. MADiMa ’19. New York, NY, USA: Association for Computing Machinery, Oct. 15, 2019, pp. 82–87. isbn: 978-1-4503-6916-9. doi:10.1145/3347448.3357162. [30] Fang, Y. et al. “Instances As Queries.” In: Proceedings of the IEEE/CVF International Conference on Computer Vision. 2021, pp. 6910–6919. [31] Fellbaum, C. WordNet: An electronic lexical database. Bradford Books, 1998. [32] Felzenszwalb, P. F. et al. “Object detection with discriminatively trained part-based models.” In: IEEE transactions on pattern analysis and machine intelligence 32.9 (2010), pp. 1627–1645. doi:10.1109/TPAMI.2009.167. [33] Ge, Z. et al. “Yolox: Exceeding yolo series in 2021.” In: arXiv preprint arXiv:2107.08430 (2021). [34] Gildenblat, J. and contributors. PyTorch library for CAM methods. 2021. [35] Girshick, R. “Fast r-cnn.” In: Proceedings of the IEEE international conference on computer vision. 2015, pp. 1440–1448. [36] Girshick, R. et al. “Rich feature hierarchies for accurate object detection and semantic segmentation.” In: Proceedings of the IEEE conference on computer vision and pattern recognition. 2014, pp. 580–587. [37] Gupta, A., Dollár, P., and Girshick, R. “LVIS: A Dataset for Large Vocabulary Instance Segmentation.” In: 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). 2019, pp. 5351–5359. doi:10.1109/CVPR.2019.00550. [38] Harris, P. et al. “An Intelligent Image Classification Approach for Food Items Nutrition Facts.” In: International Conference on Image Processing and Capsule Networks. Springer. 2022, pp. 422–430. [39] He, K. et al. “Deep residual learning for image recognition.” In: 2016 IEEE conference on computer vision and pattern recognition (CVPR). 2016, pp. 770–778. doi:10. 1109/CVPR.2016.90. [40] He, K. et al. “Mask R-CNN.” In: Proceedings of the IEEE international conference on computer vision. 2017, pp. 2961–2969. [41] Helander, E. et al. “Factors related to sustained use of a free mobile app for dietary self-monitoring with photography and peer feedback: retrospective cohort study.” In: Journal of medical Internet research 16.4 (2014), e3084. doi:10.2196/jmir.3084. [42] Huang, Z. et al. “Mask Scoring R-CNN.” In: 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). June 2019, pp. 6402–6411. doi:10.1109/ CVPR.2019.00657. [43] Jain, J. et al. OneFormer: One Transformer to Rule Universal Image Segmentation. Nov. 10, 2022. arXiv: 2211.06220[cs].
88 Bibliography [44] Jaswanthi, R. et al. “A Hybrid Network Based on GAN and CNN for Food Segmentation and Calorie Estimation.” In: 2022 International Conference on Sustainable Computing and Data Communication Systems (ICSCDS). 2022 International Conference on Sustainable Computing and Data Communication Systems (ICSCDS). Apr. 2022, pp. 436–441. doi:10.1109/ICSCDS53736.2022.9760831. [45] Jiang, C. et al. “Hybrid Knowledge Routed Modules for Large-scale Object Detection.” In: Advances in Neural Information Processing Systems 31 (2018). [46] Jiang, S. et al. “Multi-scale multi-view deep feature aggregation for food recognition.” In: IEEE Transactions on Image Processing 29 (2019), pp. 265–276. [47] Jung, D. et al. “A preliminary result of food object detection using swin transformer.” In: Proceedings of the 2022 8th international conference on computer technology applications. 2022, pp. 183–187. doi:10.1145/3543712.3543731. [48] Kaur, P., Sikka, K., and Divakaran, A. “Combining weakly and webly supervised learning for classifying food images.” In: arXiv preprint arXiv:1712.08730 (2017). [49] Kaur, P. et al. “Foodx-251: a dataset for fine-grained food classification.” In: arXiv preprint arXiv:1907.06167 (2019). [50] Kawano, Y. and Yanai, K. “Automatic expansion of a food image dataset leveraging existing categories with domain adaptation.” In: Computer vision - ECCV 2014 workshops. Ed. by L. Agapito, M. M. Bronstein, and C. Rother. Cham: Springer International Publishing, 2015, pp. 3–17. isbn: 978-3-319-16199-0. [51] Kipf, T. N. and Welling, M. Semi-supervised classification with graph convolutional networks. 2016. doi:10.48550/ARXIV.1609.02907. [52] Lavie, C. J., Milani, R. V., and Ventura, H. O. “Obesity and cardiovascular disease: Risk factor, paradox, and impact of weight loss.” In: Journal of the American College of Cardiology 53.21 (2009), pp. 1925–1932. issn: 0735-1097. doi:https://doi.org/ 10.1016/j.jacc.2008.12.068. [53] Li, B. “Adaptive hierarchical representation learning for long-tailed object detection.” In: 2022 IEEE/CVF conference on computer vision and pattern recognition (CVPR). 2022, pp. 2303–2312. doi:10.1109/CVPR52688.2022.00235. [54] Li, B. and Technology, M. “Adaptive Hierarchical Representation Learning for Long- Tailed Object Detection Supplementary Materials.” In: (), p. 4. [55] Li, F. et al. Mask DINO: Towards A Unified Transformer-based Framework for Object Detection and Segmentation. June 6, 2022. doi:10.48550/arXiv.2206.02777. arXiv: 2206.02777[cs]. [56] Liang, Y. et al. “Image Segmentation and Recognition for Multi-Class Chinese Food.” In: 2022 IEEE International Conference on Image Processing (ICIP). IEEE. 2022, pp. 3938–3942. [57] Lin, T.-Y. et al. “Microsoft coco: Common objects in context.” In: European conference on computer vision. 2014, pp. 740–755. [58] Lin, T.-Y. et al. “Feature pyramid networks for object detection.” In: Proceedings of the IEEE conference on computer vision and pattern recognition (CVPR). July 2017.
Bibliography 89 [59] Lin, Z. et al. “Dual-NMS: A Method for Autonomously Removing False Detection Boxes from Aerial Image Object Detection Results.” In: Sensors 19.21 (Jan. 2019), p. 4691. issn: 1424-8220. doi:10.3390/s19214691. [60] Liu, Z. et al. “Swin Transformer: Hierarchical Vision Transformer Using Shifted Windows.” In: Proceedings of the IEEE/CVF International Conference on Computer Vision. 2021, pp. 10012–10022. [61] Liu, Z. et al. “Swin Transformer V2: Scaling Up Capacity and Resolution.” In: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. 2022, pp. 12009–12019. [62] Lloyd, S. “Least squares quantization in PCM.” In: IEEE transactions on information theory 28.2 (1982), pp. 129–137. doi:10.1109/TIT.1982.1056489. [63] Lowe, D. G. “Object recognition from local scale-invariant features.” In: Proceedings of the seventh IEEE international conference on computer vision. Vol. 2. 1999, pp. 1150– 1157. doi:10.1109/ICCV.1999.790410. [64] Mao, R. et al. “Visual aware hierarchy based food recognition.” In: International Conference on Pattern Recognition. Springer. 2021, pp. 571–598. [65] Marin, J. et al. “Recipe1M+: A Dataset for Learning Cross-Modal Embeddings for Cooking Recipes and Food Images.” In: arXiv:1810.06553 [cs] (July 9, 2019). arXiv: 1810.06553. [66] Martinel, N., Foresti, G. L., and Micheloni, C. “Wide-slice residual networks for food recognition.” In: 2018 IEEE Winter conference on applications of computer vision (WACV). IEEE. 2018, pp. 567–576. [67] Mc Namara, K., Alzubaidi, H., and Jackson, J. K. “Cardiovascular disease as a leading cause of death: how are pharmacists getting involved?” In: Integrated pharmacy research & practice 8 (2019), pp. 1–11. issn: 2230-5254. doi:10.2147/IPRP.S133088. [68] McInnes, L., Healy, J., and Melville, J. “UMAP: Uniform manifold approximation and projection for dimension reduction.” In: arXiv preprint arXiv:1802.03426 (2018). [69] Merkel, D. “Docker: lightweight linux containers for consistent development and deployment.” In: Linux journal 2014.239 (2014), p. 2. [70] Min, W. et al. “A survey on food computing.” In: ACM Computing Surveys (CSUR) 52.5 (2019), pp. 1–36. doi:10.1145/3329168. [71] Min, W. et al. “Large scale visual food recognition.” In: arXiv preprint arXiv:2103.16107 (2021). [72] MMDetection Contributors. OpenMMLab Detection Toolbox and Benchmark. Aug. 2018. [73] Mohanty, S. P. et al. “The food recognition benchmark: Using deep learning to recognize food in images.” In: Frontiers in Nutrition 9 (2022). doi:10.3389/fnut.2022. 875143. [74] Mottaghi, R. et al. “The role of context for object detection and semantic segmentation in the wild.” In: Proceedings of the IEEE conference on computer vision and pattern recognition. 2014, pp. 891–898.
90 Bibliography [75] Muhammad, M. B. and Yeasin, M. “Eigen-CAM: Class activation map using principal components.” In: 2020 international joint conference on neural networks (IJCNN). 2020, pp. 1–7. doi:10.1109/IJCNN48605.2020.9206626. [76] Nagarajan, B. et al. “Nutritional monitoring in older people prevention services.” In: Digital health technology for better aging. Springer, 2021, pp. 77–102. [77] Nguyen, H.-T., Ngo, C.-W., and Chan, W.-K. “SibNet: Food instance counting and segmentation.” In: Pattern Recognition 124 (Apr. 1, 2022), p. 108470. issn: 0031-3203. doi:10.1016/j.patcog.2021.108470. [78] Okamoto, K. and Yanai, K. “UEC-FoodPIX Complete: A Large-scale Food Image Segmentation Dataset.” In: Proc. of ICPR Workshop on Multimedia Assisted Dietary Management(MADiMa). 2021. [79] Ouyang-Zhang, J. et al. NMS Strikes Back. Dec. 12, 2022. doi:10.48550/arXiv. 2212.06137. arXiv: 2212.06137[cs]. [80] Paszke, A. et al. “PyTorch: An imperative style, high-performance deep learning library.” In: Advances in neural information processing systems 32. Curran Associates, Inc., 2019, pp. 8024–8035. [81] Phiphiphatphaisit, S. and Surinta, O. “Food image classification with improved MobileNet architecture and data augmentation.” In: Proceedings of the 2020 The 3rd International Conference on Information Science and System. 2020, pp. 51–56. [82] Poply, P. “An instance segmentation approach to food calorie estimation using mask R-CNN.” In: Proceedings of the 2020 3rd international conference on signal processing and machine learning. 2020, pp. 73–78. doi:10.1145/3432291.3432295. [83] Redmon, J. and Farhadi, A. “Yolov3: An incremental improvement.” In: arXiv preprint arXiv:1804.02767 (2018). [84] Redmon, J. et al. “You only look once: Unified, real-time object detection.” In: Proceedings of the IEEE conference on computer vision and pattern recognition. 2016, pp. 779–788. [85] Ren, S. et al. “Faster r-cnn: Towards real-time object detection with region proposal networks.” In: Advances in neural information processing systems 28 (2015). [86] Rezatofighi, H. et al. “Generalized intersection over union: A metric and a loss for bounding box regression.” In: 2019 IEEE/CVF conference on computer vision and pattern recognition (CVPR). 2019, pp. 658–666. doi:10.1109/CVPR.2019.00075. [87] Ródenas, J. et al. “Learning multi-subset of classes for fine-grained food recognition.” In: Proceedings of the 7th international workshop on multimedia assisted dietary management. MADiMa ’22. New York, NY, USA: Association for Computing Machinery, 2022, pp. 17–26. isbn: 978-1-4503-9502-1. doi:10.1145/3552484.3555754. [88] Sahoo, D. et al. “FoodAI: Food image recognition via deep learning for smart food logging.” In: Proceedings of the 25th ACM SIGKDD international conference on knowledge discovery & data mining. 2019, pp. 2260–2268. doi:10.1145/3292500.3330734. [89] Sathish, S. et al. “Analysis of Convolutional Neural Networks on Indian food detection and estimation of calories.” In: Materials Today: Proceedings 62 (2022), pp. 4665–4670. issn: 2214-7853. doi:10.1016/j.matpr.2022.03.122.
Bibliography 91 [90] Sculley, D. “Web-scale k-means clustering.” In: Proceedings of the 19th international conference on World wide web. 2010, pp. 1177–1178. doi:10.1145/1772690.1772862. [91] Sechidis, K., Tsoumakas, G., and Vlahavas, I. “On the stratification of multi-label data.” In: Joint european conference on machine learning and knowledge discovery in databases. 2011, pp. 145–158. [92] Selvaraju, R. R. et al. “Grad-cam: Visual explanations from deep networks via gradientbased localization.” In: Proceedings of the IEEE international conference on computer vision. 2017, pp. 618–626. [93] Sharma, U., Artacho, B., and Savakis, A. “Gourmetnet: Food segmentation using multi-scale waterfall features with spatial and channel attention.” In: Sensors 21.22 (2021), p. 7504. [94] Shen, Y. et al. “Confidence propagation cluster: Unleash full potential of object detectors.” In: 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) (2022), pp. 1141–1151. [95] Solovyev, R., Wang, W., and Gabruseva, T. “Weighted boxes fusion: Ensembling boxes from different object detection models.” In: Image and Vision Computing (2021), pp. 1– 6. doi:10.1016/j.imavis.2021.104117. [96] Stumbo, P. J. “New technology in dietary assessment: a review of digital methods in improving food record accuracy.” In: Proceedings of the Nutrition Society 72.1 (2013), pp. 70–76. doi:10.1017/S0029665112002911. [97] Sun, J., Radecka, K., and Zilic, Z. “Exploring better food detection via transfer learning.” In: 2019 16th international conference on machine vision applications (MVA). 2019, pp. 1–6. doi:10.23919/MVA.2019.8757886. [98] Szymański, P. and Kajdanowicz, T. “A scikit-based Python environment for performing multi-label classification.” In: ArXiv e-prints (Feb. 2017). [99] Szymański, P. and Kajdanowicz, T. “A network perspective on stratification of multilabel data.” In: Proceedings of the first international workshop on learning with imbalanced domains: Theory and applications. Ed. by P. B. Luís Torgo and N. Moniz. Vol. 74. Proceedings of machine learning research. PMLR, Sept. 22, 2017, pp. 22–35. [100] Tahir, G. A. and Loo, C. K. “A comprehensive survey of image-based food recognition and volume estimation methods for dietary assessment.” In: Healthcare. Vol. 9. 12. MDPI. 2021, p. 1676. [101] Tan, J. et al. Equalization Loss for Long-Tailed Object Recognition. Apr. 14, 2020. doi: 10.48550/arXiv.2003.05176. arXiv: 2003.05176[cs]. [102] Tan, J. et al. “Equalization Loss v2: A New Gradient Balance Approach for Longtailed Object Detection.” In: Proceedings of the IEEE/CVF conference on computer vision and pattern recognition. 2021, pp. 1685–1694. [103] Tan, J. et al. The Equalization Losses: Gradient-Driven Training for Long-tailed Object Recognition. Oct. 11, 2022. doi:10.48550/arXiv.2210.05566. arXiv: 2210. 05566[cs].
98 Clusters used for the finegrained subheads A.1.2. Confusion matrix-based dendrogram and clusters cucumber_pickled_ch kiwi sauce_soya aperitif_with_alcohol_n_s_aperol_spritz black_olives sushi soup_of_lentils_dahl_dhal vegetable_mix_peas_and_carrots sesame_seeds celeriac sauerkraut coleslaw_chopped_without_sauce hazelnut_chocolate_spread_nutella_ovomaltine_caotina chocolate_mousse crisp_bread focaccia pomegranate sun_dried_tomatoe strawberries grapefruit_pomelo wine_red cola_based_drink grapes cherries red_radish pearl_onion smoothie mixed_milk_beverage fondue pear lemon kolhrabi white_asparagus wine_white wine_rose lye_pretzel_soft savoury_pastry_stick bread_fruit roll_with_pieces_of_chocolate white_bread_with_butter_eggs_and_milk brioche meatloaf_ch meat_terrine_pate pasta_penne salad_dressing sauce_pesto parsley ham_raw dried_meat_n_s ham_n_s bread_rye bacon potatoes_au_gratin_dauphinois_prepared chickpeas croutons tofu cheese_n_s parmesan onion garlic feta mashed_potatoes_prepared_with_full_fat_milk_with_butter grits_polenta_maize_flour lentil_n_s lentils_green_du_puy_du_berry capers peas pasta_hornli_ch pasta_twist pasta_n_s pasta_in_butterfly_form_farfalle tomato_sauce bolognaise_sauce chili_con_carne_prepared beans_kidney carrot sweet_potato pumpkin orange mandarine apricots kaki sugar_melon_galia_honeydew_cantaloupe mixed_vegetables curry_vegetarian swiss_chard chicken_curry_cream_coconut_milk_curry_spices_paste sauce_curry chips_french_fries country_fries potato baked_potato lasagne_vegetable_prepared lasagne_meat_prepared pancake crepe_with_flour_plain fajita_bread_only bread_pita egg halloumi biscuit praline_n_s chocolate_cookies chocolate_egg_small tart_n_s cake_lemon fruit_tart banana_cake cookies muffin salt_cake_ch_vegetables_filled quiche pizza_with_vegetables_baked french_pizza_from_alsace_baked bread_toast braided_white_loaf_ch honey pie_plum_baked_with_cake_dough cheesecake bread_wholemeal_toast rusk_wholemeal apple_pie pie_apricot peanut_butter butter_spread_puree_almond cake_chocolate brownie cottage_cheese tzatziki mayonnaise cream_double_cream_heavy_cream_45 tartar_sauce hummus mozzarella goat_cheese_soft ice_cream_n_s tiramisu yogurt curds_natural birchermuesli_prepared_no_sugar_added apple peach nectarine croissant ham_croissant_ch croissant_with_chocolate_filling dark_chocolate chocolate_n_s chocolate_milk sweet_corn corn almonds hazelnut raisins_dried nuts chestnuts_ch sunflower_seeds peanut pine_nuts blueberries pumpkin_seeds berries_n_s beetroot−steamed−without−addition−of−salt beetroot_raw red_cabbage_raw sauce_cream sauce_mushroom beef_n_s pork_n_s sauce_savoury_n_s sauce veggie_burger hamburger salmon_smoked salmon fish_n_s chicken chicken_breast spring_roll_fried chicken_leg chicken_cut_into_stripes_only_meat breadcrumbs_unspiced cordon_bleu sausage cervelat_ch jam spring_onion_scallion avocado artichoke caprese_salad_tomato_mozzarella greek_salad white_cabbage chinese_cabbage fennel witloof_chicory banana crisps_ch nuggets corn_crisps rosti_n_s falafel_balls spaetzle risotto omelette_with_flour_thick_crepe_plain egg_scrambled shrimp_prawn pasta_in_conch_form potato_gnocchi brussel_sprouts cashew_nut walnut green_olives pistachio cauliflower potato_salad broccoli leek asparagus guacamole vegetable_au_gratin_baked zucchini aubergine_eggplant ratatouille fruit_mixed mango pineapple applesauce cheese_for_raclette_ch fruit_coulis watermelon_fresh meat_n_s dates ketchup sauce_cocktail french_salad_dressing oil_vinegar_salad_dressing balsamic_salad_dressing mustard cucumber coconut blue_mould_cheese salami_ch figs raspberries mushroom seeds_n_s mixed_seeds_n_s tuna tuna_in_oil_drained crunch_muesli muesli_dry flakes porridge_prepared_with_partially_skimmed_milk tomato bell_pepper_red_raw bell_pepper_red_stewed plums damson_plum green_bean_steamed_without_addition_of_salt french_beans leaf_spinach spinach pasta_noodles pasta_spaghetti pasta_linguini_parpadelle_tagliatelle rice_noodles_vermicelli pasta_wholemeal rice rice_wild rice_whole_grain taboule_prepared_with_couscous couscous bulgur quinoa salad_lambs_ear spinach_raw salad_rocket salad_leaf_salad_green mixed_salad_chopped_without_sauce basil alfa_sprouts shoots_n_s pizza_margherita_baked pizza_with_ham_baked pizza_with_ham_with_mushrooms_baked water soft_drink_with_a_taste glucose_drink_50g water_with_lemon_juice kefir_drink tea juice_apple ice_tea_on_black_tea_basis beer juice_orange juice soup soup_pumpkin bouillon soft_cheese tomme_ch butter cream_cheese_n_s fresh_cheese_n_s hard_cheese emmental_cheese_ch semi_hard_cheese gruyere_ch coffee espresso ristretto_with_caffeine white_coffee latte_macchiato cappuccino bread_wholemeal bread_black bread_grain bread gluten_free_bread bread_whole_wheat bread_white bread_ticino_ch roll_of_half_white_or_white_flour_with_large_void Figure A.2: Dendrogram based on the confusion matrix of SLOF-DS presented in Section 5.4. Each color represents one of the 19 clusters. This is the clustering resulting from setting as cutting threshold of the tree 0.9×max_height. Cluster with only 2 elements and the biggest one are not considered in the final setting.
A.2. UECFood-256 dataset 99 A.2. UECFood-256 dataset A.2.1. Lexical dendrogram and clusters 65_Caesar salad 66_green salad 67_macaroni salad 68_Thai papaya salad 69_spicy chicken salad 70_Japanese−style pancake 71_pancake 72_fried mussel pancakes 73_fish−shaped pancake with bean jam 74_Small steamed savory rice pancake 75_Coconut milk−flavored crepes with shrimp and beef 76_omelet 77_omelet 78_oyster omelette 79_omelet with fried rice 80_steamed egg hotchpotch 81_egg sunny−side up 82_scrambled egg 83_fried chicken 84_chicken cutlet 85_Deep Fried Chicken Wing 86_chicken nugget 87_three cup chicken 88_roast chicken 89_roast duck 90_spicy chili−flavored tofu 91_cold tofu 92_stinky tofu 93_bean curd family style 94_cabbage roll 95_egg roll 96_Fried spring rolls 97_dak galbi 98_chop suey 99_loco moco 100_bak kut teh 101_xiao long bao 102_kung pao chicken 103_chow mein 104_zha jiang mian 105_udon noodle 106_soba noodle 107_ramen noodle 108_beef noodle 109_beef noodle soup 110_tensin noodle 111_chilled noodle 112_fried noodle 113_Crispy Noodles 114_fine white noodles 115_dipping noodles 116_Pork Sticky Noodles 117_Vermicelli noodles with snails 118_miso soup 119_pork miso soup 120_Japanese tofu and vegetable chowder 121_chinese soup 122_Wonton soup 123_Sour prawn soup 124_hot & sour soup 125_clear soup 126_fish ball soup 127_coconut milk soup 128_winter melon soup 129_oxtail soup 130_potage 131_minestrone 132_stew 133_pho 134_khao soi 135_babi guling 136_nasi goreng 137_nasi padang 138_nasi uduk 139_nasi campur 140_laksa 141_mie goreng 142_ayam goreng 143_mie ayam 144_bubur ayam 145_ayam bakar 146_pork cutlet on rice 147_minced pork rice 148_Rice crispy pork 149_Barbecued red pork in sauce with rice 150_boned, sliced Hainan−style chicken with marinated rice 151_Rice with roast duck 152_fried pork dumplings served in soup 153_ball shaped bun with pork 154_braised pork meat ball with napa cabbage 155_sweet and sour pork 156_pork satay 157_ginger pork saute 158_simmered pork 159_stewed pork leg 160_pork belly 161_fried pork in scoop 162_Pork with lemon 163_twice cooked pork 164_charcoal−boiled pork neck 165_sirloin cutlet 166_minced meat cutlet 167_pork loin cutlet 168_pork cutlet 169_pork fillet cutlet 170_ham cutlet 171_lamb kebabs 172_steamed meat dumpling 173_steamed spareribs 174_seasoned beef with potatoes 175_beef in oyster sauce 176_stir−fried beef and peppers 177_hambarg steak 178_steak 179_thinly sliced raw horsemeat 180_toast 181_french toast 182_pizza toast 183_kaya toast 184_roll bread 185_french bread 186_raisin bread 187_meat loaf 188_croissant 189_bagel 190_doughnut 191_scone 192_muffin 193_waffle 1_rice 2_chicken rice 3_fried rice 4_mixed rice 5_rice ball 6_rice gruel 7_chicken−'n'−egg on rice 8_rice vermicelli 9_Steamed rice roll 10_glutinous oil rice 11_Glutinous Rice Balls 12_eels on rice 13_eight treasure rice 14_beef curry 15_cutlet curry 16_dry curry 17_curry puff 18_green curry 19_yellow curry 20_boiled chicken and vegetables 21_hot and sour, fish and vegetable ragout 22_noodles with fish curry 23_Egg Noodle In Chicken Yellow Curry 24_Chicken Rice Curry With Coconut 25_Hue beef rice vermicelli soup 26_sushi 27_sashimi 28_spam musubi 29_bibimbap 30_natto 31_takoyaki 32_yakitori 33_okinawa soba 34_sukiyaki 35_tempura bowl 36_tempura udon 37_vegetable tempura 38_tempura 39_sashimi bowl 40_sushi bowl 41_broiled eel bowl 42_beef bowl 43_teriyaki grilled fish 44_grilled pacific saury 45_grilled salmon 46_baked salmon 47_salmon meuniere 48_fried fish 49_boiled fish 50_dried fish 51_lightly roasted fish 52_shrimp with chill source 53_fried shrimp 54_Shrimp patties 55_salt & pepper fried shrimp with shell 56_pilaf 57_sauteed vegetables 58_sauteed spinach 59_kinpira−style sauteed burdock 60_stir−fried mixed vegetables 61_grilled eggplant 62_eggplant with garlic sauce 63_dish consisting of stir−fried potato, eggplant and green pepper 64_potato salad 194_oatmeal 195_crape 196_crullers 197_mango pudding 198_trunip pudding 199_shortcake 200_cream puff 201_custard tart 202_brownie 203_churro 204_almond jelly 205_lemon fig jelly 206_rare cheese cake 207_moon cake 208_apple pie 209_chinese pumpkin pie 210_chip butty 211_french fries 212_sandwiches 213_tortilla 214_tacos 215_nachos 216_popcorn 217_hamburger 218_pizza 219_sausage 220_hot dog 221_spaghetti 222_spaghetti meat sauce 223_tiramisu 224_lasagna 225_gratin 226_rice gratin 227_mushroom risotto 228_paella 229_jambalaya 230_adobo 231_lumpia 232_pot au feu 233_hot pot 234_croquette 235_namero 236_haupia 237_parfait 238_ganmodoki 239_laulau 240_jiaozi 241_malasada 242_gulai 243_jjigae 244_nanbanzuke 245_oshiruko 246_kamameshi 247_tanmen 248_samul 249_kushikatu 250_zoni 251_oden 252_goya chanpuru 253_champon 254_inarizushi 255_yudofu 256_mozuku Figure A.3: Dendrogram based on lexical similarity of the classes of UECFood-256. Each color represents one of the 10 final lexical clusters considered
100 Clusters used for the finegrained subheads A.2.2. Confusion matrix-based dendrogram and clusters spam_musubi toast sandwiches oden ganmodoki hambarg_steak steak natto dry_curry scrambled_egg popcorn mushroom_risotto namero steamed_spareribs pizza pizza_toast sauteed_vegetables Thai_papaya_salad stir_fried_beef_and_peppers nanbanzuke kinpira_style_sauteed_burdock potage steamed_egg_hotchpotch jjigae hot_pot dak_galbi paella broiled_eel_bowl fried_mussel_pancakes chicken__n__egg_on_rice pork_cutlet_on_rice tempura_udon sukiyaki sashimi_bowl sushi_bowl potato_salad macaroni_salad beef_curry cutlet_curry seasoned_beef_with_potatoes boiled_chicken_and_vegetables croissant roll_bread chip_butty hot_dog hamburger fried_chicken ginger_pork_saute shrimp_with_chill_source chicken_nugget braised_pork_meat_ball_with_napa_cabbage Shrimp_patties salt___pepper_fried_shrimp_with_shell malasada chinese_pumpkin_pie pancake waffle apple_pie moon_cake crape shortcake french_toast kaya_toast custard_tart trunip_pudding roast_duck pork_belly mango_pudding almond_jelly Glutinous_Rice_Balls fried_pork_dumplings_served_in_soup xiao_long_bao ball_shaped_bun_with_pork Steamed_rice_roll Small_steamed_savory_rice_pancake rare_cheese_cake haupia fried_noodle spaghetti spaghetti_meat_sauce mie_ayam zha_jiang_mian omelet omelet_with_fried_rice scone oatmeal muffin cream_puff bagel doughnut grilled_eggplant grilled_salmon teriyaki_grilled_fish boiled_fish chop_suey stir_fried_mixed_vegetables dish_consisting_of_stir_fried_potato__eggplant_and_green_pepper twice_cooked_pork eggplant_with_garlic_sauce fried_pork_in_scoop bean_curd_family_style kung_pao_chicken three_cup_chicken boned__sliced_Hainan_style_chicken_with_marinated_rice beef_in_oyster_sauce stewed_pork_leg spicy_chicken_salad Pork_with_lemon tortilla tacos nachos bubur_ayam rice_gratin lasagna oyster_omelette Coconut_milk_flavored_crepes_with_shrimp_and_beef stinky_tofu baked_salmon inarizushi curry_puff churro crullers Fried_spring_rolls lumpia jambalaya nasi_goreng croquette fried_fish rice mixed_rice kamameshi minced_pork_rice glutinous_oil_rice eels_on_rice jiaozi gratin cabbage_roll simmered_pork roast_chicken chicken_rice Japanese_style_pancake takoyaki yakitori steamed_meat_dumpling tempura_bowl beef_bowl egg_sunny_side_up loco_moco fish_shaped_pancake_with_bean_jam thinly_sliced_raw_horsemeat meat_loaf parfait fish_ball_soup babi_guling grilled_pacific_saury dried_fish sauteed_spinach mozuku green_salad goya_chanpuru Caesar_salad raisin_bread french_bread laulau salmon_meuniere sweet_and_sour_pork udon_noodle dipping_noodles chilled_noodle soba_noodle sausage egg_roll french_fries cold_tofu bibimbap samul stew champon spicy_chili_flavored_tofu fine_white_noodles lemon_fig_jelly oshiruko eight_treasure_rice tiramisu brownie tensin_noodle chinese_soup kushikatu pork_satay lamb_kebabs sushi rice_ball sirloin_cutlet fried_shrimp pilaf fried_rice green_curry yellow_curry pot_au_feu rice_gruel coconut_milk_soup zoni clear_soup Wonton_soup yudofu winter_melon_soup sashimi lightly_roasted_fish Deep_Fried_Chicken_Wing adobo ayam_goreng ayam_bakar vegetable_tempura tempura rice_vermicelli Crispy_Noodles mie_goreng chow_mein ramen_noodle beef_noodle okinawa_soba tanmen hot___sour_soup bak_kut_teh noodles_with_fish_curry laksa beef_noodle_soup pho Pork_Sticky_Noodles Hue_beef_rice_vermicelli_soup Vermicelli_noodles_with_snails minestrone oxtail_soup hot_and_sour__fish_and_vegetable_ragout Sour_prawn_soup gulai khao_soi Egg_Noodle_In_Chicken_Yellow_Curry charcoal_boiled_pork_neck Rice_crispy_pork Barbecued_red_pork_in_sauce_with_rice Rice_with_roast_duck Chicken_Rice_Curry_With_Coconut nasi_campur nasi_padang nasi_uduk pork_loin_cutlet chicken_cutlet pork_cutlet pork_fillet_cutlet minced_meat_cutlet ham_cutlet miso_soup Japanese_tofu_and_vegetable_chowder pork_miso_soup Figure A.4: Dendrogram based on the confusion matrix of SLOF-DS for UECFood-256. Each color represents a cluster.