# Semantic Segmentation of Packaged and Unpackaged Fresh-Cut Apples Using Deep Learning
## 1 Introduction  
Apples are versatile and widely used fruits. They play an essential role in the daily diet of many people. They are rich in essential nutrients, minerals, fibres, and vitamins that provide a significant contribution to maintaining good health [1]. Additionally, apples provide a boost of energy, help to regulate blood sugar [2], and reduce the risk of certain cancers [3, 4]. Quality control is very important to select high quality and non-defective apples and monitor their state in a pervasive way along the whole supply chain. Traditionally, human experts are responsible for quality control of fruit. They grade apples according to various parameters such as size, shape, colour, defects, etc. Visual and internal quality of apples are related to browning of the pulp, total soluble solids (TSS) [5], acidity (pH) [6], and other physicochemical properties [7]. Estimation of these properties has always been a challenging and time-consuming task for human experts. The market of fresh-cut apples, ready to be eaten, is increasing [8, 9, 10, 11]. The cutting process accelerates the senescence of these fruits which is strongly related to the browning of pulp. A continuous monitoring of this part of apples along the path from harvest to final users, even after they have been packaged, is critical to extend their shelf-life as much as possible. Computer vision systems (CVS) are replacing human experts in quality control of fruit and in several other applications in the agriculture and food industry. CVSs are being used to recognize and classify different types of fruit based on their size, shape, colour, and texture. CVSs can determine ripeness, firmness, and colour properties. CVS can alsobe used for defect detection and grading. The integration of machine learning algorithms into a CVS can improve the accuracy and flexibility of the fruit quality control process and can provide greater, more robust, and consistent performances than human operators. To achieve the best results, vision techniques need to work on the more significant regions of the images avoiding noise sources that can be introduced by less relevant parts of the scene. In quality control of fresh-cut apples, the identification and selection of visible pulp is critical to apply colour analysis to the parts that are more affected by browning induced by senescence. This paper will deal only with the problem of selecting the visible parts of the pulp in the images to restrict further meaningful colour analysis oriented to quality and internal parameters' estimation to the most relevant parts of fruit; colour analysis on pulp regions is out of the scope of this paper. Image segmentation is an important step in many computer vision applications [12,13]. Robust image segmentation techniques strongly empower the extraction of relevant information from images. Depending on the kind of analysis used to achieve image segmentation, results at different resolutions can be reached up to the pixel-by-pixel segmentation provided by approaches such as colour analysis [14]. Several applications of image segmentation methods exploit colour and texture features to separate fruits from the background [15,16]. To identify the best features for each specific kind of images is often a difficult process that involves a cumbersome trial-and-error process. In cases similar to the Golden apples, where colour and texture features are quite similar between the pulp and peel, the results achieved by traditional image processing and computer vision techniques have been unsatisfactory in terms of completeness and robustness [17]. [PERSON] et al. proposed a CVS algorithm for the segmentation and grading of Golden Delicious apples [17]. They managed to segment apple samples from the background and were able to detect stem end and calyx regions. They achieved defect segmentation using a multi-layer perceptron (MLP) neural network. Their algorithm achieved an accuracy higher than 94% for calyx detection and 100% accuracy for stem ends outside the apples.