# Promotion of Color Sorting in Industrial Systems Using a Deep Learning Algorithm
## 2 Materials and Methods  
Input data used as a basis for investigation are digital images of raspberry obtained by screening with an Optyx 3000 color sorter during industrial processing. The system for color sorting and inspection is part of an automatic line for inspection and packaging, of 3 t/h capacity, in the ITN Eko Povlen plant, Serbia. Color sorter and the schematic process of color sorting are represented in Figure 1.  
The system is screening images of the resolution 1024 \(\times\) 1024 pixels in RGB format, and the screening speed is 4000 Hz. The machine recognizes compliant bioproducts and detects noncompliant bioproducts based on prior generated recipe. The recipe contains criteria that define the compliant product, while the color sorter, by means of a pneumatic ejector, eliminates products that do not meet the set criteria. Figure 2 summarizes processes after dataset collected. Raspberry images of the resolution 224 \(\times\) 224 pixels, saved in.jpg format, were used for input data. Input training images need not be in a specific resolution, it is only required that the image size is divisible by 32 ([PERSON] et al., 2019). Color components remained in RGB format. As reported in ([PERSON] et al., 2020), many works related to fruit classification using detection algorithms selected an RGB camera as primary sensory detector. Figure 1: (**a**) Optyx 3000 color sorter in plant; (**b**) schematic representation of the process of color sorting. Classification was performed within the dataset. An example is provided in Figure 3. Five possible classes were defined: raspberry (compliant raspberry) example is provided in Figure 3a, noncompliant (noncompliant/moldy raspberry), noncompliant + stalk (noncompliant/moldy raspberry with a stalk) and stalk were provided in Figure 3b, and defective material (contaminated material) is shown in Figure 3c. The original set contained 99 images of compliant raspberries and 66 images of noncompliant raspberries, as well as defective material. After numbering the images, the set was divided into the training set, validation set, and test set. The validation set included 20 randomly selected images, and the test set included 20 selected representative images containing a specific number of possible appearance variations of compliant and noncompliant raspberries, as well as defective material. A total of 55 objects of interest were included. Data augmentation was performed with the training set, using techniques such as brightness level, rotation, blurring, gamma correction, mirror effect, and noise (Figure 4). The final set size was 4000 images (Table 1). Figure 3: (**a**) Compliant raspberry (class: raspberry), (**b**) noncompliant raspberries (class: stalk, noncompliant, noncompliant + stalk), (**c**) defective materials (class: defect. mat.). Figure 2: Overview of the performed methods. Training and evaluation pipeline. These techniques are ideal for the training set augmentation of the research subject and for other practical reasons. During the inspection process, the object is not always in the same position. In particular, the raspberry does not have a regular shape, so it can occupy several different positions due to shape variations. Illumination that is used by the color sorter is extremely strong; however, in real production some of the lamps may fail. Therefore, there is a possibility of reduced brightness level until the lamps are replaced, which can take several days. The image blurring technique Gaussian blur was utilized for several reasons. During agricultural products' inspection on the color sorter, there is a possibility--albeit very unlikely--that the glass, located above the conveyor belt but below the camera for product screening, may become blurred or dirty. The reasons for this may range from temperature changes in the plant to uncontrolled product motion along the belt at high speeds of fruit transport. Therefore, this technique has found its application for that purpose.