A method and system for coffee bean identification based on stacked perception classification model
Patent Information
- Application Number
- CN202611274177.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-21
- Publication Date
- 2026-10-30
AI Technical Summary
[0004]为了改善现有咖啡豆识别技术中堆叠伪特征易混淆于真实瑕疵,单视角信息不全,豆级定位缺失导致误剔浪费严重的问题,本申请提供一种基于堆叠感知分类模型的咖啡豆识别的方法与系统
1.由于采用了筛分单层化布料与网格定位图案检测载体建立世界坐标的方案,以及驱动咖啡豆翻转采集多视角图像数据与点云数据并生成融合特征数据的方法,再通过预训练的堆叠感知分类模型分离堆叠伪特征和真实瑕疵特征,所以系统能够有效克服咖啡豆堆叠造成的伪影干扰和单视角信息不全的缺陷,实现单豆级别的精确定位与按需剔除,进而大幅降低了误检率和误剔率,提升了咖啡豆自动分选的准确性和原料利用率;
Smart Images

Figure CN123016422A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of coffee bean sorting, and in particular to a method and system for coffee bean identification based on a stacking-aware classification model. Background Technology
[0002] In the field of automated coffee bean sorting, existing technologies often employ manual visual selection, or use vibratory feeders or conveyor belts to collect images for identification after the coffee beans are distributed. However, these methods suffer from drawbacks such as low sorting efficiency, high labor costs, inconsistent sorting standards, and high rates of missed or incorrect sorting.
[0003] Existing conventional color sorting equipment relies solely on single color differences for sorting, only distinguishing color variations. It cannot accurately identify various types of defective coffee beans, such as moldy beans, insect-damaged beans, internally cracked beans, beans with localized mold spots, and broken beans. Some beans with internal mold and no obvious color difference on the surface are difficult to remove. Furthermore, the irregular shape and varying surface curvature of coffee beans make it difficult to completely prevent stacking and contact between beans during the distribution process. The edge shadows and overlapping contours of stacked areas easily form false stacking features in two-dimensional images. These false features are highly similar in morphology to real defect features, causing classification models to frequently misclassify normal stacked beans as defective beans or miss real defects hidden by the stack. Simultaneously, single-view image acquisition is limited by the occlusion of the coffee beans themselves, making it difficult to obtain complete surface information, further exacerbating misjudgments. Moreover, even when existing recognition systems complete classification, they often lack accurate mapping from image coordinates to physical world coordinates and precise positioning capabilities at the individual bean level. This makes subsequent removal actions difficult to apply accurately to the target individual, often blowing away adjacent normal beans as well, resulting in a high rate of false removal and raw material waste. Summary of the Invention
[0004] To address the problems in existing coffee bean identification technologies, such as the spurious stacking features being easily confused with real defects, incomplete information from a single perspective, and the lack of bean-level localization leading to serious waste due to incorrect rejection, this application provides a method and system for coffee bean identification based on a stacking-aware classification model.
[0005] In the first aspect, the coffee bean identification method based on a stacked perception classification model provided in this application adopts the following technical solution: S1, the coffee beans are sieved and made into a single layer of cloth so that the coffee beans enter the detection carrier with a grid positioning pattern and the world coordinates of the grid unit are established. S2. Drive the coffee beans to rotate, collect multi-view image data and point cloud data of the coffee beans, and associate the multi-view image data and point cloud data with the grid cells based on the world coordinates; S3. Perform spatiotemporal alignment and feature fusion on the multi-view image data and the point cloud data to generate fused feature data of coffee beans; S4. Input the fused feature data into the pre-trained stacked perception classification model to separate stacked pseudo features and real defect features. When the classification confidence is insufficient, trigger the separation retake and update the fused feature data until the classification confidence reaches the preset standard, and then output the classification result of coffee beans and target grid cell. S5. Generate a rejection instruction based on the classification result and the world coordinates corresponding to the target grid cell, and control the corresponding air valve nozzle to divert coffee beans to the hopper corresponding to the classification result based on the rejection instruction.
[0006] By employing the aforementioned technical solution, coffee beans are sieved and laid out in a single layer, and a detection carrier with a grid positioning pattern is introduced. This suppresses disorderly stacking at the source. Simultaneously, the coffee beans are driven to flip, collecting multi-view image data and point cloud data, which are then correlated based on world coordinates to generate fused feature data. A stacking perception classification model is used to separate stacking pseudo-features from real defect features, generating rejection commands to control the corresponding air valve nozzles to divert the coffee beans to the corresponding bins. This solution combines precise coffee bean positioning, multi-modal fusion perception, active separation of stacking artifacts, and adaptive closed-loop confirmation, effectively solving the problems of misjudgment and missed judgment caused by stacking, and achieving high-accuracy, low-error automatic sorting of coffee beans.
[0007] Optionally, S1 specifically includes S11, vibrating and screening the coffee beans to remove dust, debris and agglomerated materials to obtain dispersed coffee beans; S12. The dispersed coffee beans are spread into a single layer by a frequency conversion cloth mechanism, so that the dispersed coffee beans enter the detection carrier with a grid positioning pattern to obtain the coffee beans to be detected. S13. Identify the grid positioning pattern and calibrate the coordinates of the grid cells to establish the world coordinates of the grid cells for image association and removal positioning of the coffee beans to be detected.
[0008] By employing the above technical solution, coffee beans are first vibrated and sieved to obtain dispersed coffee beans. Then, a frequency-controlled fabric feeding mechanism applies a single layer of fabric to guide the dispersed coffee beans into a detection carrier with a grid positioning pattern, resulting in coffee beans to be detected. The grid pattern is then identified, and the grid cells are calibrated to establish a global coordinate system. The vibrating sieving process purifies the raw coffee bean material, reducing interference from contaminants on subsequent coffee bean imaging. The frequency-controlled fabric feeding ensures the orderly single-layer arrangement of the coffee beans, and the coordinate calibration of the grid cells provides a definite spatial reference for each coffee bean to be detected, enabling precise binding of image data and physical location, thus creating conditions for accurate tracking and rejection.
[0009] Optionally, S2 specifically includes S21, generating target tracking data based on the world coordinates and the delivery status of the coffee bean to be detected, wherein the target tracking data is used to identify the movement relationship of the coffee bean to be detected at different detection positions; S22. Drive the coffee bean to be detected with the target tracking data to flip, and collect multi-view image data and point cloud data of the coffee bean to be detected; S23. Based on the target tracking data and the world coordinates, associate the multi-view image data, the point cloud data and the corresponding grid cells to obtain grid association detection data. The grid association detection data is used for subsequent spatiotemporal alignment and feature fusion.
[0010] By employing the above technical solution, target tracking data is generated to identify motion relationships. This data drives the coffee bean to be detected to flip and collects multi-view image data and point cloud data. Then, based on the target tracking data and world coordinates, these are associated with the corresponding grid cells to obtain grid-associated detection data. The target tracking data ensures that the identity of each coffee bean is continuous and not lost during the flipping motion. The multi-view data and grid cells correspond accurately, providing a reliable one-to-one mapping relationship for subsequent spatiotemporal alignment and feature fusion, and eliminating data attribution errors caused by motion confusion.
[0011] Optionally, S22 specifically includes S221, acquiring surface image data of the coffee beans to be tested through a multi-view industrial camera, and acquiring spectral texture image data of the coffee beans through a near-infrared camera, a hyperspectral camera, and a polarization camera; S222. Collect point cloud data of coffee beans using a structured light 3D scanning device, and perform initial registration of the point cloud data with the surface image data and the spectral texture image data according to the acquisition position; S223. Based on the target tracking data, the initially registered surface image data, the spectral texture image data, and the point cloud data are merged to obtain the multi-view image data and the point cloud data.
[0012] By employing the above technical solution, surface image data and spectral texture image data are acquired, while point cloud data is simultaneously acquired by a structured light 3D scanning device. The point cloud data, surface image, and spectral texture image are initially registered according to the acquisition location and then merged based on target tracking data. This multimodal imaging scheme simultaneously captures color, texture, polarization characteristics, and internal quality information such as near-infrared and hyperspectral data, as well as 3D morphology. The initial registration and tracking merging ensure precise synchronization of the acquired multi-source image data in time and space, greatly enriching the expression of single-bean features and providing sufficient basis for distinguishing coffee beans that look similar but have internal defects.
[0013] Optionally, S3 specifically includes S31, performing same coffee bean matching and coordinate unification on the multi-view image data and the point cloud data to generate alignment detection data and view reliability data; S32. Construct a coffee bean surface model using the point cloud data in the alignment detection data, and map the image defect response in the alignment detection data to the coffee bean surface model to generate three-dimensional defect distribution data. S33. Based on the viewpoint reliability data, perform occlusion compensation and weight fusion on the three-dimensional defect distribution data to generate the fused feature data.
[0014] By employing the aforementioned technical solution, multi-view image data and point cloud data are matched with the same coffee bean, and coordinates are unified to generate alignment detection data and viewpoint reliability data. A coffee bean surface model is constructed using the point cloud data, and image defect responses are mapped to this coffee bean surface model to generate a three-dimensional defect distribution. Then, occlusion compensation and weighted fusion are performed based on viewpoint reliability to generate fused feature data. This process deeply integrates two-dimensional texture information from multiple perspectives with a three-dimensional geometric model. Occlusion compensation guided by viewpoint reliability effectively recovers defect areas obscured by the bean itself or neighboring beans, eliminating blind spots and allowing the fused features to more completely reflect the true surface condition of the coffee bean, thus enhancing the comprehensiveness of defect identification.
[0015] Optionally, S4 specifically includes S41, inputting the fused feature data into the stack-aware classification model, and generating stack density data and defect response data through the stack sensitivity attention module in the stack-aware classification model; S42. Based on the stacking density data, the defect response data is decoupled to suppress stacking pseudo-features formed by overlapping shadows, contact boundaries and contour distortion, and the real defect features are obtained. S43. Generate classification confidence based on the actual defect characteristics, and output the classification result of coffee beans and target grid cells after the classification confidence reaches the preset standard.
[0016] By employing the above technical solution, fused feature data is input into the stacking-aware classification model. The stacking-sensitive attention module generates stacking density data and defect response data. Based on the stacking density, the defect response is decoupled to suppress false stacking features and obtain true defect features. Then, based on these true defect features, a classification confidence score is generated, and upon reaching the target score, the classification result and target grid cell are output. The stacking-sensitive attention module enables the model to actively perceive the degree of contact between coffee beans, specifically removing false responses caused by stacking and retaining only the defect expressions of the coffee beans themselves. This significantly reduces the probability of misclassifying normal stacking as defects. The confidence-gated output strategy prevents unreliable classification decisions from being passed down downstream.
[0017] Optionally, S42 specifically includes S421, generating stacking contribution data based on the stacking density data, wherein the stacking contribution data is used to characterize the response component in the defect response data caused by coffee bean stacking; S422. Based on the stacked contribution data, decouple the texture response, edge response and grayscale response in the defect response data to obtain pseudo-feature response data and candidate defect response data. S423. Perform consistency verification between the candidate defect response data and the fused feature data to obtain the true defect features.
[0018] By employing the aforementioned technical solution, stacking contribution data is generated to characterize the response components caused by coffee bean stacking in the defect response. Based on this, texture response, edge response, and grayscale response are decoupled, separating pseudo-feature response data and candidate defect response data. The candidate defect responses are then compared with the fused feature data for consistency verification to obtain the true defect features. Quantifying the stacking contribution achieves precise decoupling across multiple feature channels, enabling the differentiation of false textures, pseudo-edges, and abnormal grayscale changes caused by coffee bean stacking. The verification mechanism further filters out residual artifacts, ensuring that the final output of true defect features is highly derived from the actual quality of the coffee beans, thus improving the specificity and robustness of coffee bean classification.
[0019] Optionally, S43 specifically includes S431, when the classification confidence level does not reach the preset standard, generating a separation retake instruction based on the stacking density data and the target grid cell; S432. Apply micro-vibration separation to the coffee beans in the target grid cell according to the separation re-beat command, so that the stacked coffee beans produce relative displacement, and obtain the separated coffee beans. S433. Re-capture the separated coffee beans from the same perspective, and return the re-captured image data and point cloud data to update the fused feature data until the classification confidence reaches the preset standard.
[0020] By employing the above technical solution, when the classification confidence level does not reach the preset standard, a separation and re-enhancing instruction is generated. Micro-vibration separation is applied to the coffee beans within the target grid cell, causing relative displacement and resulting in separated coffee beans. Subsequently, a re-enhancing image is taken from the same viewpoint until the confidence level reaches the standard. This adaptive closed-loop re-enhancing mechanism actively changes the physical stacking state of the coffee beans. Micro-vibration separation breaks the tight contact, and the re-enhancing image from the same viewpoint ensures that the collected image data of the coffee beans can be compared. The iterative update process continuously strengthens the feature determinism, thereby effectively solving the recognition ambiguity caused by severe stacking and ensuring that the classification result of each coffee bean is based on sufficient and reliable information.
[0021] Optionally, S5 specifically includes S51, determining the target injection position based on the world coordinates corresponding to the target grid cell, and determining the target silo based on the classification result, wherein the target injection position is the physical center of the target grid cell; S52. Based on the target blowing position and the coffee bean conveying status, determine the corresponding air valve nozzle from the array air valve nozzle and generate a rejection command containing the blowing sequence, wherein the airflow range of the corresponding air valve nozzle covers the target grid cell. S53. Control the corresponding air valve nozzle to blow towards the target blowing position according to the rejection instruction, so that the coffee beans enter the target hopper corresponding to the classification result.
[0022] By adopting the above technical solution, the target blowing position is determined based on the world coordinates of the target grid cell, and the target hopper is specified in conjunction with the classification results. Based on the blowing position and conveying status, the corresponding nozzle is determined from the array of air valve nozzles, and a rejection command is issued. The nozzle is controlled to blow coffee beans into the corresponding hopper. This solution precisely couples world coordinate positioning with air valve array control. The blowing position accurately points to the center of the target grid cell where the single coffee bean is located, and the timing command is synchronized with the conveying movement, ensuring that the airflow accurately strikes the target coffee bean without disturbing adjacent beans. This achieves stable, low-loss, and precise single-bean rejection.
[0023] Secondly, the present invention provides a coffee bean identification system based on a stacking perception classification model, including a material screening device, a detection carrier, a grid calibration module, a flipping drive mechanism, a multi-view acquisition module, a data processing module, a stacking perception classification module, a rejection control module, an air valve nozzle array, and multiple material bins. The cloth screening device is used to screen coffee beans and apply them in a single layer, so that the coffee beans can enter the detection carrier. The surface of the detection carrier is provided with a grid positioning pattern for carrying coffee beans after they have been processed with a single layer of fabric; The grid calibration module is used to establish the world coordinates of the grid cells based on the grid positioning pattern. The flipping drive mechanism is used to drive the coffee beans located on the detection carrier to flip; The multi-view acquisition module is used to acquire multi-view image data and point cloud data of coffee beans when the flipping drive mechanism drives the coffee beans to flip, and associate the multi-view image data and point cloud data with the grid cell based on the world coordinates. The data processing module is used to perform spatiotemporal alignment and feature fusion on the multi-view image data and the point cloud data to generate fused feature data of coffee beans; The stacking perception classification module contains a pre-trained stacking perception classification model, which is used to receive the fused feature data, separate stacking pseudo features and real defect features, and trigger a separation re-shot command when the classification confidence is insufficient, so that the flipping drive mechanism and the multi-view acquisition module re-acquire the corresponding coffee beans and update the fused feature data until the classification confidence reaches the preset standard, and then output the classification result and target grid cell. The rejection control module is used to generate rejection instructions based on the classification results and the world coordinates corresponding to the target grid cell, and send the rejection instructions to the corresponding air valve nozzle; The air valve nozzle array diverts coffee beans to the bins corresponding to the sorting results based on the rejection command. The technical effects of the coffee bean identification system based on the stacked perception classification model provided in the second aspect of the present invention are the same as those in the first aspect, and will not be repeated here.
[0024] In summary, this application includes at least one of the following beneficial technical effects: 1. By adopting a scheme of establishing world coordinates using a single-layer sieved fabric and a grid positioning pattern detection carrier, and a method of driving coffee beans to flip and collect multi-view image data and point cloud data to generate fused feature data, and then using a pre-trained stacking perception classification model to separate stacking pseudo-features and real defect features, the system can effectively overcome the artifact interference caused by coffee bean stacking and the defects of incomplete single-view information, achieve precise positioning and on-demand removal at the single bean level, thereby significantly reducing the false detection rate and false rejection rate, and improving the accuracy of automatic coffee bean sorting and raw material utilization. 2. By using a stacking-sensitive attention module to generate stacking density data and decoupling the defect response data, and then decoupling the texture response, edge response, and grayscale response through stacking contribution data and verifying consistency with the fused feature data to obtain the true defect features, the system can accurately remove false defect signals caused by coffee beans contacting each other. This effectively solves the problem of confusing stacked pseudo features with real defects in existing technologies, thereby achieving highly specific identification of coffee bean surface defects and significantly reducing misjudgments of normally stacked beans. 3. By employing a closed-loop confirmation method that generates a separation and re-shooting instruction based on stacking density data and target grid cells when classification confidence is insufficient, applies micro-vibration to separate coffee beans within the target grid cells, performs a re-shoot from the same viewpoint, and iteratively updates the fused feature data until the confidence level is met, the system can proactively change the coffee bean stacking state to obtain more discriminative information when identification is uncertain. It also precisely couples world coordinate positioning with array gas valve control, effectively solving the problems of blurred identification caused by severe stacking and difficulty in accurately applying the removal action to individual coffee beans. This results in highly reliable classification decisions and precise removal with low loss at the single bean level. Attached Figure Description
[0025] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0026] Figure 1 This is a flowchart of the coffee bean identification method based on a stacked sensing classification model provided in the embodiments of this application; Figure 2 This is a flowchart of step S1 of the coffee bean identification method based on a stacked sensing classification model provided in the embodiments of this application; Figure 3 This is a flowchart of step S2 of the coffee bean identification method based on a stacked sensing classification model provided in the embodiments of this application; Figure 4 This is a flowchart of step S22 of the coffee bean identification method based on a stacked sensing classification model provided in the embodiments of this application; Figure 5 This is a flowchart of step S3 of the coffee bean identification method based on a stacked sensing classification model provided in the embodiments of this application; Figure 6 This is a flowchart of step S4 of the coffee bean identification method based on a stacked sensing classification model provided in the embodiments of this application; Figure 7 This is a flowchart of step S42 of the coffee bean identification method based on a stacked sensing classification model provided in the embodiments of this application; Figure 8 This is a flowchart of step S43 of the coffee bean identification method based on a stacked sensing classification model provided in the embodiments of this application; Figure 9 This is a flowchart of step S5 of the coffee bean identification method based on a stacked sensing classification model provided in the embodiments of this application; Figure 10This is an overall architecture diagram of the coffee bean identification system based on a stacked perception classification model provided in the embodiments of this application.
[0027] Reference numerals: 1. Fabric screening device; 2. Detection carrier; 3. Grid calibration module; 4. Tilting drive mechanism; 5. Multi-view acquisition module; 6. Data processing module; 7. Stacking sensing and classification module; 8. Rejection control module; 9. Air valve nozzle array; 10. Hopper. Detailed Implementation
[0028] The following is in conjunction with the appendix Figure 1 -Appendix Figure 10 This application will be described in further detail.
[0029] This application discloses a method and system for coffee bean identification based on a stacked perception classification model.
[0030] See attached document Figure 1 A method for coffee bean identification based on a stacked perception classification model includes S1, sieving coffee beans and making them into a single layer of cloth, so that the coffee beans enter a detection carrier with a grid positioning pattern, and establishing the world coordinates of the grid cells.
[0031] See attached document Figure 2 In this embodiment, S1 specifically includes S11, vibrating and screening the coffee beans to remove dust, debris, and agglomerated materials to obtain dispersed coffee beans; and S12, using a frequency conversion cloth feeding mechanism to distribute the dispersed coffee beans into a single layer, allowing the dispersed coffee beans to enter a detection carrier with a grid positioning pattern to obtain coffee beans to be tested.
[0032] Vibrating screening refers to a physical sorting method that uses mechanical vibration to force coffee beans through a screen of a specific mesh size to separate dust, debris, and agglomerated materials. Dispersed coffee beans are coffee beans that, after screening, are independent individuals without sticking together; coffee beans can be either pre-roasted green beans or post-roasted roasted beans. A variable frequency feeding mechanism is a device that uses a variable frequency speed-regulating motor to drive the feeding components, allowing precise control of material flow and spreading speed. Single-layer feeding refers to the process of evenly spreading coffee beans in a single, non-overlapping layer on the surface of the detection carrier. The detection carrier is a tray or conveyor surface that carries and transports coffee beans through the detection area; its surface is printed with a high-contrast checkerboard pattern as a grid positioning pattern; the high contrast typically uses a combination of pure white and pure black, and the brightness difference between the black and white areas of the checkerboard is at least 8 times. A grid cell is the smallest square area divided by checkerboard lines, used to locate the spatial assignment of a single coffee bean. The side length of the smallest square area should be slightly larger than the maximum diameter of a single coffee bean to ensure that a single coffee bean can fall completely into a square. For example, for a regular coffee bean with a diameter of 5 mm to 6 mm, the smallest square area size can be 8 mm × 8 mm.
[0033] Specifically, the coffee beans first fall into a multi-stage vibrating screen. This multi-stage vibrating screen has upper and lower screens. The upper screen has a larger aperture, such as 8-10 mm for an 18-20 mesh screen, used to trap and disperse agglomerated materials. The lower screen has a smaller aperture, such as 1.5-2 mm for a 60-80 mesh screen, used to remove dust and fine debris. Different varieties of coffee beans have significantly different diameters, and the aperture can be finely adjusted according to the actual variety. Then, by adjusting the frequency and amplitude of the vibrating motor of the multi-stage vibrating screen, the coffee beans are continuously thrown and moved on the screen surface. Agglomerated beans are disintegrated under the impact, while dust and debris fall through the mesh into the dust collection hopper, ultimately obtaining well-dispersed coffee beans. The dispersed coffee beans enter the variable frequency feeding mechanism from the feed inlet. The main body of this variable frequency feeding mechanism is an inclined vibrating feed trough driven by a variable frequency speed control motor. The amplitude and frequency of the vibrating feed trough are precisely controlled by a frequency converter, allowing coffee beans to slide one by one onto the surface of a continuously moving detection carrier at a controlled feeding rate. The detection carrier is a high-strength flat plate with a high-contrast black and white checkerboard pattern formed by precision printing or laser etching, with strict physical dimensional tolerances for the side lengths of the squares. Behind the drop point, a flexible leveling scraper or adjustable airflow leveling curtain is added to gently separate any accidentally overlapping beans, ensuring that each coffee bean is distributed in a single layer within the grid cell, becoming the coffee bean to be detected. Simultaneously, the conveying speed of the detection carrier is acquired in real time by an encoder and matched in a closed loop with the feeding rate of the frequency conversion feeding mechanism, maintaining a stable coffee bean occupancy rate within the grid cell, laying the foundation for establishing a reliable correlation between the image and the grid cell.
[0034] S13. Identify the grid positioning pattern and calibrate the coordinates of the grid cells to establish the world coordinates of the grid cells for image association and removal positioning of the coffee beans to be detected.
[0035] Coordinate calibration involves using image processing techniques to extract the pixel coordinates of the checkerboard corner points and calculating the mapping relationship between the pixel coordinate system and the world coordinate system based on physical dimensions. The world coordinate system is a two-dimensional or three-dimensional physical coordinate system established with the detection carrier plane as a reference, used to define the absolute spatial position of each grid cell. Image association refers to binding the acquired coffee bean image data with the identifier of its corresponding grid cell and its world coordinates. Removal positioning guides the air valve nozzle to accurately aim at the physical center of the target grid cell for purging, based on the world coordinates.
[0036] Specifically, during the idle phase when the inspection carrier is put into transport but before coffee beans are loaded, the system triggers a calibration process. An industrial camera with at least 20 megapixels, deployed upstream of the inspection station or sharing the optical path with the inspection camera, captures a checkerboard image of the inspection carrier surface. Then, a sub-pixel checkerboard corner detection algorithm is used to accurately extract the pixel coordinates of all intersections of black and white squares in the image; for example, a detection algorithm combining Harris corner detection and sub-pixel fitting is used, that is, first, pixel-level corners are detected using the Harris operator, and then a quadratic polynomial is used to fit the grayscale surface to solve for the sub-pixel coordinates. Since the physical side lengths of each checkerboard area are known and the inspection carrier is considered a rigid plane, the system uses a plane calibration method to calculate the intrinsic parameters of the industrial camera and the extrinsic parameters of the inspection carrier plane relative to the industrial camera, establishing a world coordinate system with a corner of the checkerboard as the origin, the X and Y axes parallel to the direction of the square arrangement, and the Z axis perpendicular to the carrier plane. Based on the side length of the smallest grid area and the row and column arrangement rules, the two-dimensional coordinates of the geometric center of each grid cell in the world coordinate system are calculated, and the row and column indices of the grid cells are stored in the system coordinate mapping table corresponding to their world coordinates. When the detection carrier carrying coffee beans arrives at the detection station, the vision system segments the area of a single coffee bean and calculates its centroid pixel coordinates. Then, it calls the pre-calibrated mapping relationship to convert the pixel coordinates into world coordinates and uses nearest neighbor matching to locate the row and column of the grid cell where the coffee bean is located, completing the positional association between the image data and the grid cell. These world coordinates are also written into subsequent rejection instructions to ensure that no matter how the coffee bean is offset within the grid cell, the aiming reference of the array air valve nozzle is always the physical center coordinates of that grid cell, thereby ensuring that the airflow effectively covers the entire grid area and achieves reliable rejection.
[0037] S2. Drive the coffee beans to rotate, collect multi-view image data and point cloud data of the coffee beans, and associate the multi-view image data, point cloud data and grid cells based on world coordinates.
[0038] See attached document Figure 3 In this embodiment, S2 specifically includes S21, generating target tracking data based on world coordinates and the conveying status of the coffee beans to be detected. The target tracking data is used to identify the movement relationship of the coffee beans to be detected at different detection positions.
[0039] The flipping process involves using mechanical devices to force coffee beans to undergo random posture changes along the conveyor path, ensuring that all surface areas are exposed to the camera's field of view. Multi-view image data is a collection of two-dimensional digital images acquired simultaneously from multiple spatial azimuth angles, covering surface information from different orientations of the coffee beans, such as the top, sides, and bottom. Point cloud data is a set of discrete three-dimensional coordinate points on the coffee bean surface acquired using a structured light 3D scanning device, used to reconstruct the three-dimensional shape of the bean. Target tracking data is spatiotemporal index information generated based on world coordinates and conveyor status, used to identify the movement relationship of the coffee bean at different detection positions. Specifically, it includes the coffee bean's entry time, grid row and column index, conveyor speed, and cumulative displacement.
[0040] Specifically, when a coffee bean is assigned to a grid cell in the fabric area, the system marks the current encoder count value as its timestamp origin and continuously extrapolates the real-time displacement of the coffee bean along the conveying direction based on the conveying speed, generating target tracking data. This target tracking data is maintained in the system memory as a dynamically updated tracking table. Each row corresponds to a coffee bean to be inspected, recording its grid cell row and column number, world coordinates, inspection timestamp, and real-time predicted conveying distance. As the coffee bean passes through the subsequent flipping area, multiple inspection stations, and rejection area, the sensors at each station only need to consult this tracking table to accurately pinpoint its arrival time and spatial location, thereby achieving temporal and spatial alignment of the same coffee bean's data at different inspection stages.
[0041] S22, drive the coffee bean to be detected with target tracking data to flip, and collect multi-view image data and point cloud data of the coffee bean to be detected.
[0042] See attached document Figure 4 Furthermore, S22 specifically includes S221, acquiring surface image data of the coffee beans to be tested through a multi-view industrial camera, and acquiring spectral texture image data of the coffee beans through a near-infrared camera, a hyperspectral camera, and a polarization camera.
[0043] S222. Collect point cloud data of coffee beans using a structured light 3D scanning device, and perform initial registration of the point cloud data with surface image data and spectral texture image data according to the collection location.
[0044] S223. Based on the target tracking data, merge the initially registered surface image data, spectral texture image data, and point cloud data to obtain multi-view image data and point cloud data.
[0045] Among them, multi-view industrial cameras refer to visible light array cameras installed at multiple fixed angles and sharing the same trigger signal, used to acquire surface image data of coffee beans to be inspected, that is, to record the visible light two-dimensional texture and contour images of the bean from different perspectives. Near-infrared cameras are imaging devices sensitive to the near-infrared band of 700 nm to 1200 nm; hyperspectral cameras are push-broom or staring imaging devices covering the 400 nm to 1000 nm band and having continuous spectral resolution; polarization cameras are cameras equipped with polarization elements. The three capture spectral texture image data of coffee beans from different physical mechanisms, including information such as the degree of internal browning, moisture distribution, and the perturbation of polarization state by microcracks. Structured light 3D scanning devices are devices that project known coded patterns and use the principle of triangulation to recover the three-dimensional shape of the object surface. The output point cloud data is a high-density point set containing massive spatial point coordinates. Initial registration refers to the operation of spatially aligning the surface images, spectral texture images, and point cloud data acquired synchronously or quasi-synchronously within the same inspection station according to the acquisition position and imaging parameters.
[0046] Specifically, the coffee beans to be tested enter the flipping zone along with the testing carrier. This flipping zone consists of an inclined vibrating trough and adjustable-speed rotating rollers. An eccentric vibrator is located at the bottom of the inclined vibrating trough, causing small-amplitude, high-frequency vibrations that drive the coffee beans forward while simultaneously causing them to tumble randomly. A set of independently adjustable polyurethane rotating rollers is embedded in the middle of the trough. Their surface friction coefficient is adapted to the coffee beans. When the beans pass through the gaps between the rollers, the differential rotation of the rollers applies torque, forcing the beans to complete at least three random tumbling maneuvers. After flipping, the various surfaces of the coffee beans are probabilistically exposed, and they then enter three independent testing stations located at the exit of the turning zone. The imaging optical axes of the three testing stations point to the plane of the testing carrier at 0 degrees, 60 degrees, and 120 degrees, respectively, acquiring images of the top, side, and bottom surfaces of the coffee beans. Each testing station integrates a multimodal imaging module, including a high-resolution multi-view industrial camera, a near-infrared camera, a hyperspectral imager, and a polarization camera. All cameras are synchronously exposed by the same trigger controller according to the line frequency signal, ensuring that synchronous data of the same coffee bean is collected. The light source system uses a combination of an adjustable color temperature ring light and a backlight. The ring light provides diffuse illumination to the front of the coffee bean around the optical axis, while the backlight is placed below the detection carrier to form transmitted light to enhance contour contrast. The light source controller automatically determines the green or roasted bean attribute based on the coffee bean color information fed back in real time by the online colorimeter, and adjusts the color temperature and brightness of the light source to optimize the imaging signal-to-noise ratio, i.e., to maximize the ratio. The imaging signal-to-noise ratio (SNR) is the ratio of the effective signal intensity to the noise intensity in an image, and the formula is: ,in It is the average gray value of the target area of the coffee beans. It is the standard deviation of grayscale in the background area.
[0047] Simultaneously, a structured light 3D scanning device positioned on one side of the inspection station projects digital grating stripes onto the coffee bean. A matching camera captures the deformation stripe images and calculates the dense point cloud data of the coffee bean in real time. After data acquisition at the same inspection station, the system immediately performs initial registration of the surface image data, spectral texture image data, and point cloud data according to the acquisition location and the camera's intrinsic and extrinsic parameters. This involves using the known rigid transformation matrix between the camera and scanner to transform the point cloud coordinates to the surface image coordinate system, ensuring that each pixel in the image can find a corresponding 3D point in the point cloud. Subsequently, based on the timestamp and motion compensation provided by the target tracking data, the initial registration data acquired from the three inspection stations are merged. Using the conveying displacement recorded by the encoder, the multi-view image data and point cloud data of the same coffee bean at 0°, 60°, and 120° positions are unified into an instantaneous coordinate system with the coffee bean's centroid as the origin, forming a complete multi-view image data and point cloud data package. The instantaneous coordinate system has its Z-axis perpendicular to the surface of the detection carrier and pointing to the top of the coffee bean; the X-axis parallel to the conveying direction of the detection carrier; and the Y-axis perpendicular to the conveying direction, satisfying the right-hand coordinate system rule. This point cloud data package covers visible light textures from multiple angles (top, side, and bottom), near-infrared absorption features, hyperspectral full-spectrum response, polarization state changes, and surface 3D morphology, providing complete input for subsequent geometric reconstruction and feature fusion.
[0048] S23. Based on target tracking data and world coordinates, multi-view image data and point cloud data are associated with corresponding grid cells to obtain grid association detection data. The grid association detection data is used for subsequent spatiotemporal alignment and feature fusion.
[0049] Among them, grid-related detection data refers to the structured data unit formed by binding multi-view image data, point cloud data and the world coordinates of the grid cell where the coffee bean is located and the target tracking data; it makes the multimodal detection information of each coffee bean uniquely correspond to its specific spatial position on the detection carrier, and provides spatially labeled input for subsequent spatiotemporal alignment and feature fusion.
[0050] Specifically, the system extracts the row and column indices and world coordinates of the grid cell corresponding to the current coffee bean from the target tracking data. Then, centered on these world coordinates, a spatial window matching the physical size of the grid cell is extracted. Within this spatial window, the precise centroid of the coffee bean is generated using point cloud data, and the system verifies that the centroid falls within the originally assigned grid cell. If there is a positional deviation due to flipping or sliding, the system re-matches to the nearest grid cell and updates the association relationship. Afterward, the system packages the merged multi-view image data and point cloud data, along with the world coordinates, grid row and column indices, and timestamp of the grid cell, into a single grid association detection data file. This grid association detection data file is stored in binary stream format. The file header contains the grid cell identifier and world coordinates, and the data body contains visible light surface image data, near-infrared image data, hyperspectral data cubes, polarization angle images, and point cloud data. Each frame of data includes its three-dimensional displacement vector relative to the center of the grid cell. Through this association, the subsequent spatiotemporal alignment and feature fusion processes can directly read the grid association detection data, quickly index the full modal expression of each coffee bean in a unified world coordinate system, not only eliminating the ambiguity of data correspondence, but also enabling the removal command to be precisely targeted based on the world coordinates of the grid cell, thereby achieving a spatial closed loop from image recognition to physical removal.
[0051] S3. Perform spatiotemporal alignment and feature fusion on multi-view image data and point cloud data to generate fused feature data of coffee beans.
[0052] See attached document Figure 5 In this embodiment, S3 specifically includes S31, performing same coffee bean matching and coordinate unification on multi-view image data and point cloud data to generate alignment detection data and view reliability data.
[0053] Spatiotemporal alignment refers to matching and registering multi-view image data and point cloud data from different inspection stations and at different acquisition times under a unified spatial coordinate system and a common time reference, eliminating data misalignment caused by conveyor motion, camera perspective differences, and acquisition delays. Feature fusion refers to integrating features extracted from surface image data, spectral texture image data, and point cloud data within a unified three-dimensional spatial framework to form a comprehensive feature representation with complementary information. Same coffee bean matching is a spatiotemporal index matching process that assigns data acquired from three stations to the same coffee bean based on the timestamp of the target tracking data, the world coordinates of the grid cells, and the conveyor speed. Coordinate unification is the process of transforming data from each inspection station in an independent time-coordinate system to the same world coordinate system or coffee bean body coordinate system through camera extrinsic calibration and motion compensation. Alignment detection data is a set of data in which multi-view images and point clouds are completely aligned in space after matching and unifying the coordinates of the same coffee bean. The pixels in the image have a traceable correspondence with the three-dimensional points in the point cloud. View reliability data is auxiliary information that quantifies the reliability of each pixel or region in the image data acquired at each detection station. This view reliability data comprehensively considers factors such as the angle between the shooting angle and the normal of the coffee bean surface, occlusion, depth of field sharpness, and illumination uniformity, and is used to guide the weight allocation during subsequent fusion.
[0054] Specifically, the process begins with matching the same coffee bean. Target tracking data for that coffee bean is read from the grid-associative detection data. The timestamps and transport displacement values recorded by the encoders at the 0°, 60°, and 120° detection stations are obtained. Timestamp alignment initially categorizes the three sets of data into the same coffee bean. Next, coordinate unification is performed. Pre-calibrated extrinsic parameter matrices of the cameras and structured light scanners at each detection station are called. The data from the 60° and 120° stations are rotated and translated to the camera coordinate system of the 0° station. Simultaneously, based on the distance the transport carrier moves between the trigger times of each detection station, a motion compensation matrix is used to translate and correct the three sets of point cloud data and surface image data, eliminating positional shifts in the coffee bean during transport. To further improve alignment accuracy, fine registration is performed using point cloud data as a bridge. An iterative nearest-point algorithm is used to globally align the point clouds acquired at the three stations, solving for a precise rigid transformation and synchronously applying it to the corresponding surface and spectral texture images. This ensures that all multi-view data achieves sub-pixel-level alignment within a unified coffee bean body coordinate system, ultimately generating aligned detection data. During the coordinate unification process, viewpoint reliability data is calculated synchronously. For each inspection station's image, the angle between the surface normal of the coffee bean and the optical axis of the camera at that station is calculated pixel by pixel. The closer the angle is to zero degrees, the higher the reliability of the observation; the closer the angle is to ninety degrees, the lower the reliability of the observation. Simultaneously, point cloud data is used to determine whether each surface point is occluded by other beans or protrusions within the coffee bean itself. If occlusion is detected, the occluded area is marked with a reliability of zero. Furthermore, a sharpness factor is generated by combining the local contrast and out-of-focus blur of the captured coffee bean image. The viewpoint reliability of each pixel is obtained by multiplying the normal angle, occlusion status, and sharpness factor after normalization, forming a viewpoint reliability map of the same size as the aligned inspection data. This viewpoint reliability data is stored and passed to subsequent steps for weighted fusion.
[0055] S32. Construct a coffee bean surface model using the point cloud data from the alignment detection data, and map the image defect responses from the alignment detection data to the coffee bean surface model to generate three-dimensional defect distribution data. S33. Perform occlusion compensation and weighted fusion on the three-dimensional defect distribution data based on the viewpoint reliability data to generate fused feature data.
[0056] The coffee bean surface model is a digital model representing the three-dimensional surface morphology of coffee beans, constructed based on point cloud data from the alignment detection data through triangular meshing or parametric surface fitting. It consists of dense triangular facets or non-uniform rational B-spline surfaces (NURBS surfaces), realistically reproducing the contour curvature, indentation depth, and surface undulations of the coffee bean. Image defect response refers to the characteristic response map reflecting coffee bean defects detected and quantified from visible light surface images, near-infrared images, hyperspectral data cubes, and polarization images in the alignment detection data. This includes, but is not limited to, polarization anomalies in areas of uneven color, boundaries of insect-eaten holes, textures of mold patches, and microcracks. Three-dimensional defect distribution data is three-dimensional spatial data that attaches the two-dimensional image defect response to the coffee bean surface model using projection mapping technology. The corresponding defect type and response intensity are labeled on each triangular facet or surface point of the coffee bean surface model. Occlusion compensation refers to supplementing the inference of features of surface areas that are not visible in the image of a coffee bean due to shooting angle or bean self-occlusion at a certain inspection station by using observation data from complementary perspectives of other inspection stations to compensate for the lack of information from a single perspective. Weighted fusion is a weighted sum of the defect responses mapped onto the coffee bean surface model from each inspection station based on the reliability data of the perspective. Data from more reliable sources is given a greater contribution, thereby generating fused feature data that is complete in information and has the optimal signal-to-noise ratio.
[0057] Specifically, point cloud data is first extracted from the alignment detection data. After statistical filtering to remove outliers and noise, a closed triangular mesh model is generated using the Poisson surface reconstruction algorithm to obtain the coffee bean surface model. This coffee bean surface model fully expresses the three-dimensional geometric features of the bean, with each vertex having precise spatial coordinates and normal direction. Then, defect detection preprocessing is performed independently on the surface image data, near-infrared image, hyperspectral data, and polarization image for each detection station. For the visible light surface image, a color threshold-based segmentation algorithm is used to extract uneven color regions, and morphological processing is used to obtain the contours of connected defect regions. For the near-infrared image, the sensitivity of the near-infrared band to moisture is utilized to locate internal browning regions through local gray-scale anomaly detection. For the hyperspectral data cube, feature bands related to mold metabolites are selected for spectral angle mapping to extract the distribution boundaries of mold patches. For the polarization image, the polarization degree image is calculated, and the edge response of microcracks is highlighted by high-frequency component enhancement. The above processing generates the image defect response map corresponding to each detection station. Next, using the three-dimensional space of the coffee bean surface model as a reference, the image defect response maps of each inspection station are back-projected onto the triangular mesh surface according to the calibrated camera imaging model. For each triangular facet in the coffee bean surface model, if the angle between its normal direction and the optical axis of a camera at a certain inspection station is less than 90 degrees and it is not occluded, the response value of the corresponding pixel in the image defect response map of that inspection station is recorded in that facet. When the same facet is visible in multiple inspection stations, weighted fusion is triggered. B. The reliability values of the facet at each inspection station are read from the viewpoint reliability data, and the reliability data is used as weights to perform a weighted average of the defect response values at each inspection station to generate the fused defect response intensity of the facet. For occluded areas visible only at a single inspection station, occlusion compensation is performed using the data from the visible inspection station, and the compensation reliability is marked by combining the point cloud geometric features of the occluded area. Finally, the fused defect response intensity, geometric features, and corresponding world coordinates of all facets are integrated into a multi-dimensional data vector to form the fused feature data of the coffee bean. This fused feature data spatially covers the entire visible surface of the coffee bean and semantically integrates visible light color, near-infrared internal state, hyperspectral material properties, polarization microcrack response, and three-dimensional geometric morphology, providing highly discriminative input information for subsequent stacked perception classification models.
[0058] S4. Input the fused feature data into the pre-trained stacked perception classification model to separate stacked pseudo features and real defect features. When the classification confidence is insufficient, trigger the separation retake and update the fused feature data until the classification confidence reaches the preset standard, and then output the classification result of coffee beans and target grid cells.
[0059] See attached document Figure 6In this embodiment, S4 specifically includes S41, inputting the fused feature data into the stack-aware classification model, and generating stack density data and defect response data through the stack sensitivity attention module in the stack-aware classification model.
[0060] Among them, the pre-trained stack-aware classification model is a deep convolutional neural network trained on a large number of labeled coffee bean samples. Its backbone adopts a residual network architecture and embeds a stack-sensitive attention module before the feature extraction layer. This stack-sensitive attention module can dynamically perceive the spatial anomaly response caused by bean stacking in the fused feature data. The stack-sensitive attention module is a lightweight differentiable network substructure composed of several convolutional layers and activation functions cascaded together. Its internal parameters are jointly optimized with the main network through end-to-end backpropagation, and it is specifically designed to learn how to infer the degree of stacking at each spatial location from the fused feature data.
[0061] Specifically, the pre-training process is divided into three stages: sample preparation, model building, and iterative training. In the sample preparation stage, tens of thousands of raw images and point cloud data of coffee beans are collected. These coffee beans include samples from different origins, varieties, roasting levels, and moisture conditions, encompassing both qualified beans and various defective beans such as black beans, moldy beans, insect-damaged beans, cracked and broken beans, and shriveled and deformed beans. Data is recorded for both isolated single beans and beans stacked to varying degrees. The fusion feature data for each coffee bean is generated according to the S1 to S3 process, and is jointly labeled by human experts and auxiliary detection tools with two tags: the first tag is a quality category tag, with values of high-quality bean, slightly defective bean, or severely defective bean; the second tag is a stacking degree tag, a binary or grayscale image with the same spatial size as the fusion feature data. The stacking contact area is marked manually or using semi-automatic tools, serving as the ground truth for training the stack-sensitive attention module. In the model building stage, the stack-aware classification model uses a residual network as its backbone, with the stack-sensitive attention module embedded after its third residual block. The stack-sensitive attention module consists of two parallel convolutional branches. One branch outputs stack density data, while the other performs element-wise multiplication with the backbone features to suppress features in stacked regions. The backbone network terminates with a global average pooling layer and a three-output fully connected classification head layer, outputting probabilities for the three quality classes. During iterative training, the sample dataset is proportionally divided into training, validation, and test sets, and a multi-task loss function is used for joint optimization. The total loss function consists of two weighted sums: the first is the classification loss, using the cross-entropy loss function, which constrains the model's output quality class probability to match the quality class label; the second is the stack perception loss, using either the binary cross-entropy loss function or the dice coefficient loss function, which constrains the stack density data output by the stack-sensitive attention module to match the stacking degree label. The weight ratios of these two losses are adjusted via hyperparameters, enabling the model to learn to distinguish defect types and simultaneously perceive stacked regions during training. The optimizer uses an adaptive moment estimation optimizer, with the initial learning rate gradually reduced using cosine annealing. In each training cycle, training set samples are input into the model in batches, the total loss is calculated, and the network weights are updated via backpropagation. After several training cycles, the model's classification accuracy and the intersection-over-union ratio of the stacking density estimation are evaluated using the validation set, overfitting trends are monitored, and optimal model parameters are saved. When the validation set loss no longer decreases for several consecutive training cycles, an early stopping mechanism is triggered to terminate training, resulting in a pre-trained stack-aware classification model. This pre-trained model is stored as a weight file and deployed to the production line inference server. In step S4, it is directly loaded and used for forward inference on the fused feature data. It can output stacking density data and defect response data without online training, providing reliable initial discrimination capabilities for subsequent feature decoupling and classification decisions.
[0062] The stacking density data is a heatmap output by the stacking-sensitive attention module, with a spatial size consistent with the input feature map. Each pixel's value ranges from zero to one, representing the estimated contact or overlap density of coffee beans at that location due to stacking. A value closer to one indicates a higher likelihood of close contact or occlusion between beans. The defect response data is an activation response map generated in the feature space by the stacking-aware classification model after initial forward propagation of the input fused feature data. This map addresses various defects such as uneven color, insect holes, mold spots, and microcracks. It integrates information from visible light, near-infrared, hyperspectral, and polarization channels.
[0063] In practice, the fused feature data generated by S3 is fed into the stack-aware classification model in tensor form. The stack-sensitive attention module first performs channel-wise depthwise separable convolution on the fused feature data to extract low-level geometric cues related to stacking, including the curvature of the contact line between adjacent beans, the gray-scale gradient transition in the overlapping area, and abnormal concavities or convexities in the contour. Then, through a squeezed excitation structure consisting of global average pooling and fully connected layers, the inter-channel relationships of the above low-level cues are modeled, generating a set of channel weights to enhance the stack-sensitive feature channels and suppress irrelevant channels. The weighted feature map is then compressed in space dimension by a single-channel 1x1 convolutional layer and a sigmoid activation function is applied to obtain the stack density data. At the same time, the fused feature data propagates forward along the main network, extracting hierarchical features from edge texture to semantic concepts through multiple residual blocks, and generating activation responses for different defect types in multiple intermediate layers of the network. These responses are then upsampled or transposed convolutions to adjust to the same spatial size as the stack density data and merged into defect response data. Stack density data and defect response data are jointly passed to the subsequent feature decoupling module.
[0064] S42. Based on the stacking density data, the defect response data is decoupled to suppress the stacking pseudo-features formed by overlapping shadows, contact boundaries and contour distortion, and the true defect features are obtained.
[0065] See attached document Figure 7 Furthermore, S42 specifically includes S421, generating stacking contribution data based on stacking density data, whereby the stacking contribution data is used to characterize the response components in the defect response data caused by coffee bean stacking. S422, based on the stacking contribution data, decoupling the texture response, edge response, and grayscale response in the defect response data to obtain pseudo-feature response data and candidate defect response data. S423, performing consistency verification between the candidate defect response data and the fused feature data to obtain the true defect features.
[0066] Feature decoupling refers to the process of orthogonally decomposing the mixed defect response data along the stacking contribution dimension to obtain pseudo-feature responses caused by stacking and candidate defect responses unrelated to stacking. Stacking contribution data is an extension of the stacking density data, quantized pixel-by-pixel or region-by-region, characterizing the intensity proportion of the response component caused by coffee bean stacking in the defect response data. It considers both the spatial distribution of stacking density and the differences in sensitivity of different types of defects to coffee bean stacking. Texture response refers to the response components in the defect response data activated by texture descriptors such as local binary modes and gray-level co-occurrence matrices, sensitive to changes in surface roughness such as mold and insect infestation. Edge response refers to the response components in the defect response data activated by gradient operators or edge detection kernels, sensitive to areas of abrupt intensity changes such as hole boundaries and crack contours. Gray-level response refers to the response components in the defect response data activated by brightness statistics or color space transformation, sensitive to differences in brightness such as uneven color and browning areas. False defect response data are features identified after decoupling as being caused by stacking factors such as overlapping shadows, contact boundaries, and contour distortion. Candidate defect response data are features initially identified after decoupling as not originating from stacking but still requiring further verification. Consistency verification is a review step that uses multimodal information from the fused feature data to cross-validate the candidate defect response data, thus eliminating false positives. True defect features are the final feature representations confirmed after consistency verification to originate from inherent quality defects in the coffee beans themselves, and will be directly used for classification.
[0067] Specifically, firstly, stacking contribution data is generated based on the stacking density data. Since different types of defects have varying sensitivities to stacking—for example, uneven color is easily affected by overlapping shadows, while microcracks are relatively insensitive to stacking—a learnable defect type sensitivity weight vector to stacking is maintained. This sensitivity weight vector is multiplied pixel-by-pixel by the stacking density data, and then normalized to obtain stacking contribution data with dimensions completely consistent with the defect response data. Then, based on the stacking contribution data, the texture response, edge response, and grayscale response in the defect response data are decoupled. For the texture response channel, response sub-images activated by local binary mode features are extracted from the defect response data. The product of each spatial location of this sub-image and the corresponding location in the stacking contribution data is calculated as the texture pseudo-feature response. Simultaneously, the texture pseudo-feature response is subtracted from this sub-image to obtain the texture candidate defect response. For the edge response channel, response sub-images activated by the Sobel gradient magnitude are extracted from the defect response data. Similarly, edge pseudo-feature responses and edge candidate defect responses are separated according to stacking contribution. For the grayscale response channel, the response sub-images activated by the saturation and luminance channels of the HSV color space are extracted from the defect response data. Grayscale pseudo-feature responses and grayscale candidate defect responses are obtained in the same way. The pseudo-feature responses of the three channels are merged into pseudo-feature response data, and the candidate defect responses are merged into candidate defect response data. Finally, consistency verification is performed. For each activated region in the candidate defect response data, the corresponding original multimodal data segment is traced back in the fused feature data. It is checked whether the color anomaly in the visible light image corresponds to a surface depression in the point cloud data, whether mold spectral features exist in the hyperspectral band, and whether polarization state changes of microcracks exist in the polarization image. If at least two modalities consistently support the presence of a defect, the candidate defect response passes the verification and is marked as a true defect feature. If only a single modality has a strong response while other modalities have no response, and the region has a high stacking density, it is determined to be a stacked pseudo-feature and is discarded. The true defect features obtained after consistency verification simultaneously contain defect type, location coordinates, and response intensity, and are passed to the subsequent classification decision layer.
[0068] S43. Generate classification confidence based on the actual defect characteristics, and output the classification results of coffee beans and target grid cells after the classification confidence reaches the preset standard.
[0069] See attached document Figure 8Furthermore, S43 specifically includes S431, when the classification confidence level does not reach the preset standard, generating a separation and re-shooting instruction based on the stacking density data and the target grid cell; S432, applying micro-vibration separation to the coffee beans within the target grid cell according to the separation and re-shooting instruction, causing relative displacement of the stacked coffee beans, and obtaining separated coffee beans; S433, re-shooting the separated coffee beans from the same viewpoint, and returning the re-shot image data and point cloud data to update the fusion feature data until the classification confidence level reaches the preset standard.
[0070] The classification confidence score is the maximum probability value in the probability vector output by the classification head layer of the stacked sensing classification model after synthesizing the true defect features. It reflects the degree of confidence the stacked sensing classification model has in the current classification result. The preset standard is a confidence threshold set by the system to distinguish whether the classification result is reliable. It is usually set to 0.9 or flexibly configured according to the tolerance of the actual production line for false positives and false negatives. The classification result refers to the quality category to which the coffee beans are determined, specifically including premium beans, slightly defective beans, and severely defective beans. The target grid cell is the grid row and column index and its world coordinates of the coffee bean corresponding to the classification result on the detection carrier, used for subsequent removal and location. The separation re-tap command is a control signal sent to the physical actuator when the classification confidence score does not reach the preset standard. It includes parameters such as the world coordinates of the target grid cell, the jet pulse width, and the re-tap trigger delay. Micro-vibration separation is a physical operation that applies short, high-frequency excitation to the target grid cell locally through a valve pulse or vibration platform, causing relative slippage or increased gaps between the stacked coffee beans in contact. After separation, the coffee beans are those whose stacking state has been relieved or reduced after being separated by micro-vibration. Same-view re-imaging refers to triggering a second image only from the detection station camera with the closest viewpoint to the initial acquisition, while keeping the coffee beans in their current position after separation, in order to minimize data acquisition time and ensure data comparability.
[0071] Specifically, after obtaining the true defect features, the stacked perception classification model feeds them into a classification head layer composed of a fully connected layer and a flexible maximum function. This head layer outputs the probability distribution of whether the coffee bean belongs to a high-quality bean, a slightly defective bean, or a severely defective bean, and the maximum probability is taken as the classification confidence score. The classification confidence score is compared with a preset standard. If the classification confidence score reaches or exceeds the preset standard, such as 85%, the classification result and the target grid cell bound to the coffee bean in the grid association detection data are directly output, and the process enters the S5 rejection process. If the classification confidence score does not reach the preset standard, it indicates that the current detection data is severely affected by stacking interference, causing the model to be unable to make a reliable judgment, and the separation and re-detection mechanism is activated. First, the region with the highest stacking degree is located based on the stacking density data, and a separation and re-detection command is generated by combining the world coordinates of the target grid cell. This separation and re-detection command is sent to the micro-vibration separation module upstream of the rejection channel. This micro-vibration separation module consists of a high-frequency electromagnetic valve and a microporous airflow plate attached to the bottom of the detection carrier. The valve releases a pulsed airflow within a very short time according to the command. The airflow passes through the microporous plate and forms a local air cushion effect directly below the target grid cell, causing the coffee bean within that grid cell to be subjected to an upward instantaneous impact, jump, and undergo random displacement upon falling back. To prevent the coffee bean from jumping out of the grid cell, the pulse pressure and duration are pre-calibrated to ensure that the maximum bounce height of the coffee bean does not exceed twice the average diameter of the bean. After the micro-vibration, the system waits for the coffee bean to fall back to the detection carrier and stabilize, obtaining the separated coffee bean. Subsequently, a same-viewpoint re-shooting process is triggered. Based on the optimal viewpoint position recorded in the target tracking data for that coffee bean, the corresponding camera module is activated to capture a single frame only for that grid cell, acquiring re-shot image data and point cloud data. The re-shot data is re-associated with the target tracking data and world coordinates along the original data processing pipeline to generate updated grid-related detection data. After S3 spatiotemporal alignment and feature fusion, updated fused feature data is generated and sent again to the stacked perception classification model for a new round of classification. This closed-loop iterative process continues, recalculating the classification confidence score after each retake until the classification confidence score reaches a preset standard or the maximum number of retakes is reached. Then, the final classification result is output, ensuring controllable production line cycle time. Through this adaptive retake mechanism, the system significantly reduces the risk of misclassification and missed detections caused by stacking while maintaining high detection efficiency.
[0072] S5. Generate a rejection instruction based on the classification result and the world coordinates corresponding to the target grid cell. Based on the rejection instruction, control the corresponding air valve nozzle to divert the coffee beans to the hopper corresponding to the classification result.
[0073] See attached document Figure 9 In this embodiment, S5 specifically includes S51, determining the target injection position based on the world coordinates corresponding to the target grid cell, and determining the target silo based on the classification result. The target injection position is the physical center of the target grid cell.
[0074] The target blowing position refers to the spatial coordinates of the point aimed at by the air valve nozzle when performing the blowing action. In this scheme, this position is fixedly defined as the physical center of the target grid cell to ensure that the airflow covers the entire grid area. The physical center of the target grid cell is the geometric center point calculated based on the world coordinates of the four corner points of the grid cell. Its X-axis and Y-axis coordinates are the arithmetic mean of the corresponding coordinates of the four corner points, and the Z-axis coordinate is the height value of the detection carrier plane. The target silo is the material collection container determined according to the classification results. This system has at least three silos: a good-quality silo for collecting high-quality beans, a secondary bean silo for collecting slightly defective beans, and a waste bean silo for collecting heavily defective beans. The inlet of each silo is located in a different falling trajectory area at the end of the detection carrier.
[0075] Specifically, after obtaining the classification results and target grid cells for the coffee beans to be removed from S4, the blow position calculation process is immediately initiated. First, the world coordinates of the four corner points of the target grid cell are read from the system coordinate mapping table: the top left, top right, bottom right, and bottom left corners. The physical center coordinates of the grid cell, i.e., the target blow position, are calculated by averaging the values of the diagonal points. If the grid cell is a standard square, the physical center coordinates can also be obtained directly by adding half the side length of the square to the coordinates of the top left corner. Simultaneously, the row and column indices of the grid cell are called to verify whether the physical center coordinates are consistent with the world coordinates of the grid cell written in the S1 calibration stage. If deviations occur due to slight deformation or vibration of the detection carrier during transport, the original coordinates from the calibration stage are used for correction to ensure absolute accuracy of the blow aiming. While determining the target blow position, the target hopper is matched based on the classification results. For beans classified as high-quality, the target hopper is set as the good-quality hopper. This hopper is located directly below the natural falling trajectory of the detection carrier, and the high-quality beans fall freely into it without interference from the jetting airflow. For beans classified as slightly defective, the target hopper is set as the secondary bean hopper. This hopper is located on one side of the natural falling trajectory, and the movement trajectory of the coffee beans needs to be altered by the jetting airflow to deviate from its original path before falling into it. For beans classified as severely defective, the target hopper is set as the waste bean hopper. This hopper is located on the other side of the natural falling trajectory or at a greater distance, and a stronger jetting airflow is needed to cause a greater trajectory deviation before the coffee beans fall into it. The correspondence between the target jetting location and the target hopper is encapsulated into a rejection task data package and passed to the S52 for nozzle matching and instruction generation.
[0076] S52. Based on the target blowing position and the coffee bean conveying status, determine the corresponding air valve nozzle from the array air valve nozzle and generate a rejection command containing the blowing sequence. The airflow range of the corresponding air valve nozzle covers the target grid cell.
[0077] The array of air valve nozzles consists of a group of independently controllable high-pressure air valve nozzles arranged at equal intervals along the width of the detection carrier. Each nozzle corresponds to one or more grid cell columns in the transverse direction of the detection carrier. The nozzle spacing is precisely matched with or an integer multiple of the column spacing of the grid cells. A corresponding air valve nozzle refers to the nozzle or several adjacent nozzles in the array whose airflow coverage area covers the grid cell containing the target blowing position. The airflow coverage area is a circular or elliptical effective blowing area centered on the nozzle outlet and at the height of the detection carrier plane. The diameter or major axis of this effective blowing area is greater than the diagonal length of the grid cell, ensuring that the coffee bean can be effectively blown regardless of its location within the grid cell. The conveying status refers to the current movement speed of the detection carrier and the real-time position information of the coffee bean. The linear velocity is obtained by converting the pulse frequency read in real time by the encoder, and combined with the coffee bean's entry timestamp and cumulative displacement in the target tracking data, the remaining conveying distance of the coffee bean from the blowing station is calculated. The blowing sequence refers to the precise time parameters of the opening time and duration of the air valve nozzle specified in the rejection instruction. The opening time is calculated by dividing the remaining conveying distance by the conveying speed, and the duration is determined by a combination of the trajectory deflection required by the target hopper, the nozzle air pressure, and the coffee bean quality.
[0078] Specifically, the installation position world coordinates and airflow range parameters of each nozzle are first read from the configuration table of the array air valve nozzles. The X-axis and Y-axis coordinates of the target blowing position are matched with the coverage area of each nozzle one by one. If the target blowing position falls within the airflow range of a certain nozzle, then that nozzle is identified as the corresponding air valve nozzle. When the target grid cell is located at the boundary of the coverage areas of two adjacent nozzles, these two nozzles can be selected simultaneously as the corresponding air valve nozzles and work together with a smaller blowing air pressure to avoid insufficient trajectory offset caused by the deflection of a single nozzle. After selecting the corresponding air valve nozzle, the current pulse count value of the encoder is read. Combined with the encoder origin count value of the coffee bean when it enters the fabric area for inspection in the target tracking data, the cumulative conveying displacement of the coffee bean since its entry into the fabric area is calculated. Given the fixed installation distance between the center line of the blowing station and the starting point of the fabric area, the cumulative conveying displacement is subtracted to obtain the remaining conveying distance of the coffee bean from the blowing station. The remaining conveying distance is divided by the conveying speed fed back by the encoder in real time to obtain the estimated arrival time, which is the reference for the start time in the blowing sequence. When determining the duration, a preset blowing parameter table is called according to the type of the target hopper. For heavily defective beans, a larger trajectory offset is required, and the blowing duration is set to the first preset value; for lightly defective beans, a smaller offset is required, and the blowing duration is set to the second preset value, which is less than the first preset value. For high-quality beans, blowing is not triggered, and the duration is zero. In addition, an advance compensation time constant is introduced to compensate for the mechanical response delay of the air valve from receiving the electrical signal to full opening, ensuring that the peak time of the actual airflow pulse is precisely aligned with the time when the coffee bean arrives at the center point of the blowing position. The start time, duration, nozzle number, and target hopper information are packaged according to the communication protocol to generate a rejection instruction containing the blowing sequence, which is sent to the air valve drive controller.
[0079] S53. Control the corresponding air valve nozzle to blow towards the target blowing position according to the rejection instruction, so that the coffee beans enter the target hopper corresponding to the classification result.
[0080] The corresponding air valve nozzle is the selected actuator nozzle in S52, which is driven by a high-speed solenoid valve. The response time from receiving the trigger signal to the interruption of airflow is in the sub-millisecond level. It works with a compressed air source and a precision pressure regulating valve to provide a stable and adjustable blowing air pressure.
[0081] Specifically, after receiving a rejection command, the air valve drive controller buffers it in a first-in-first-out queue and starts a high-precision hardware timer. The timer's timing reference is synchronized with the encoder pulse to ensure timeline consistency. When the timer reaches the opening moment specified in the rejection command, the controller immediately sends an opening electrical signal to the solenoid valve of the corresponding air valve nozzle. After the solenoid valve coil is energized, it drives the valve core to move rapidly. Compressed air is ejected at high speed from the air tank through pipelines and pressure regulating valves from the nozzle outlet, forming a high-pressure airflow directed towards the target blowing position. Since the target blowing position is the physical center of the target grid cell, and the airflow range of the nozzle completely covers the grid cell, the high-pressure airflow can reliably act on the surface of the coffee bean regardless of its actual posture and offset position within the grid cell. Under the action of the airflow impulse, the coffee bean gains lateral momentum, and its trajectory deviates from the original free-fall parabola, deflecting along the airflow direction and entering the feed inlet of the target hopper.
[0082] For coffee beans classified as high-quality, the blowing duration in the rejection instruction is zero. The controller does not trigger the solenoid valve, and the coffee beans are horizontally ejected at normal conveying speed at the end of the detection carrier, falling directly into the good-quality bean bin below under gravity. For coffee beans classified as slightly defective, the corresponding air valve nozzle blows for a preset second duration, giving the coffee beans a smaller lateral velocity component, causing them to fall into the secondary bean bin on one side. For coffee beans classified as severely defective, the corresponding air valve nozzle blows for a preset first duration, giving the coffee beans a larger lateral velocity component, causing them to fall into the more distant waste bean bin. After each blowing cycle, the controller records the actual trigger time, blowing duration, and nozzle number, generating a rejection execution log and sending it back to the main control system for online statistical analysis of the sorting ratio and rejection rate of each grade of coffee beans. Through the combination of the above-mentioned physical center aiming, airflow covering grid units, and graded timed blowing scheme, the system achieves precise spatial positioning and error-free diversion of individual coffee beans, ensuring the automatic separation of high-quality beans, slightly defective beans, and heavily defective discard beans.
[0083] This application also provides a coffee bean identification system based on a stacked perception classification model, which can be applied to the method of any of the above embodiments.
[0084] See attached document Figure 10 A coffee bean identification system based on a stacked perception classification model includes a cloth screening device 1, a detection carrier 2, a grid calibration module 3, a flipping drive mechanism 4, a multi-view acquisition module 5, a data processing module 6, a stacked perception classification module 7, a rejection control module 8, an air valve nozzle array 9, and multiple hoppers 10.
[0085] The cloth screening device 1 is used to screen coffee beans and spread them into a single layer, so that the coffee beans enter the detection carrier 2.
[0086] The surface of the detection carrier 2 is provided with a grid positioning pattern, which is used to hold coffee beans after they have been processed with a single layer of cloth.
[0087] The grid calibration module 3 is used to establish the world coordinates of the grid cells based on the grid positioning pattern.
[0088] The flipping drive mechanism 4 is used to drive the coffee beans located on the detection carrier 2 to flip.
[0089] The multi-view acquisition module 5 is used to acquire multi-view image data and point cloud data of coffee beans when the flipping drive mechanism 4 drives the coffee beans to flip, and associate the multi-view image data and point cloud data with grid cells based on world coordinates.
[0090] Data processing module 6 is used to perform spatiotemporal alignment and feature fusion on multi-view image data and point cloud data to generate fused feature data of coffee beans.
[0091] The stacking-aware classification module 7 contains a pre-trained stacking-aware classification model, which is used to receive fused feature data, separate stacking pseudo features and real defect features, and trigger a separation re-shot command when the classification confidence is insufficient, so that the flipping drive mechanism 4 and the multi-view acquisition module 5 re-acquire the corresponding coffee beans and update the fused feature data until the classification confidence reaches the preset standard, and then output the classification result and target grid cell.
[0092] The rejection control module 8 is used to generate rejection commands based on the classification results and the world coordinates corresponding to the target mesh cell, and send the rejection commands to the corresponding air valve nozzle.
[0093] The air valve nozzle array 9 diverts coffee beans to the bin 10 corresponding to the sorting result based on the rejection command.
[0094] In this system, the fabric screening device 1 places a single layer of coffee bean fabric onto the detection carrier 2. The grid calibration module 3 and the multi-view acquisition module 5 are electrically connected. After acquiring the checkerboard image of the detection carrier 2, the world coordinates of the grid cells are calculated and sent to the multi-view acquisition module 5 and the rejection control module 8. When acquiring multi-view image data and point cloud data of the coffee beans, the multi-view acquisition module 5 uses the world coordinates as a spatial reference, binds the data to the grid cells, and outputs the data to the data processing module 6. The data processing module 6 performs spatiotemporal alignment and feature fusion on the input data, and the generated fused feature data is transmitted to the stacked perception classification module 7. The stacked perception classification module 7 carries a pre-trained model and sends the classification results and target grid cells to the rejection control module 8. Simultaneously, when the classification confidence is insufficient, the stacked perception classification module 7 generates a separation retake command. This separation retake command is fed back to the flipping drive mechanism 4 and the multi-view acquisition module 5, triggering local micro-vibration and same-view retake. The retake data is updated by the data processing module 6 with fused feature data and then input back into the stacked perception classification module 7, forming a closed-loop iteration. The rejection control module 8 generates rejection instructions based on the received classification results and the world coordinates corresponding to the target grid cell, and sends the rejection instructions to the solenoid valve driver of the corresponding air valve nozzle in the air valve nozzle array 9 via fieldbus or high-speed I / O, controlling the nozzle to blow at a precise time so that the coffee beans fall into the corresponding hopper 10.
[0095] Unless otherwise defined, the technical or scientific terms used in this application shall have the ordinary meaning understood by one of ordinary skill in the art to which this application pertains. The terms "first," "second," "third," and similar terms used in this application specification and claims do not indicate any order, quantity, or importance, but are merely used to distinguish different components. The terms "an" or "a" and similar terms do not indicate a quantity limitation, but rather indicate the presence of at least one. The terms "comprising" or "including" and similar terms mean that the elements or objects preceding "comprising" or "including" encompass the elements or objects listed following "comprising" or "including" and their equivalents, and do not exclude other elements or objects. "Above," "below," "left," "right," etc., are used only to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0096] The above are all preferred embodiments of this application, and are not intended to limit the scope of protection of this application. Therefore, all equivalent changes made in accordance with the structure, shape and principle of this application should be covered within the scope of protection of this application.
Claims
1. A method for coffee bean identification based on a stacked sensing classification model, characterized in that: This includes S1, sieving coffee beans and applying a single-layer cloth to allow the coffee beans to enter a detection carrier with a grid positioning pattern, and establishing the world coordinates of the grid cells; S2. Drive the coffee beans to rotate, collect multi-view image data and point cloud data of the coffee beans, and associate the multi-view image data and point cloud data with the grid cells based on the world coordinates; S3. Perform spatiotemporal alignment and feature fusion on the multi-view image data and the point cloud data to generate fused feature data of coffee beans; S4. Input the fused feature data into the pre-trained stacked perception classification model to separate stacked pseudo features and real defect features. When the classification confidence is insufficient, trigger the separation retake and update the fused feature data until the classification confidence reaches the preset standard, and then output the classification result of coffee beans and target grid cell. S5. Generate a rejection instruction based on the classification result and the world coordinates corresponding to the target grid cell, and control the corresponding air valve nozzle to divert coffee beans to the hopper corresponding to the classification result based on the rejection instruction.
2. The method for coffee bean identification based on a stacked sensing classification model according to claim 1, characterized in that: S1 specifically includes S11, vibrating and screening the coffee beans to remove dust, debris and agglomerated materials to obtain dispersed coffee beans; S12. The dispersed coffee beans are spread into a single layer by a frequency conversion cloth mechanism, so that the dispersed coffee beans enter the detection carrier with a grid positioning pattern to obtain the coffee beans to be detected. S13. Identify the grid positioning pattern and calibrate the coordinates of the grid cells to establish the world coordinates of the grid cells for image association and removal positioning of the coffee beans to be detected.
3. The method for coffee bean identification based on a stacked sensing classification model according to claim 2, characterized in that: S2 specifically includes S21, generating target tracking data based on the world coordinates and the delivery status of the coffee bean to be detected, wherein the target tracking data is used to identify the movement relationship of the coffee bean to be detected at different detection positions; S22. Drive the coffee bean to be detected with the target tracking data to flip, and collect multi-view image data and point cloud data of the coffee bean to be detected; S23. Based on the target tracking data and the world coordinates, associate the multi-view image data, the point cloud data and the corresponding grid cells to obtain grid association detection data. The grid association detection data is used for subsequent spatiotemporal alignment and feature fusion.
4. The method for coffee bean identification based on a stacking-aware classification model according to claim 3, characterized in that: S22 specifically includes S221, acquiring surface image data of the coffee beans to be tested through a multi-view industrial camera, and acquiring spectral texture image data of the coffee beans through a near-infrared camera, a hyperspectral camera, and a polarization camera; S222. Collect point cloud data of coffee beans using a structured light 3D scanning device, and perform initial registration of the point cloud data with the surface image data and the spectral texture image data according to the acquisition position; S223. Based on the target tracking data, the initially registered surface image data, the spectral texture image data, and the point cloud data are merged to obtain the multi-view image data and the point cloud data.
5. The method for coffee bean identification based on a stacked sensing classification model according to claim 1, characterized in that: S3 specifically includes S31, performing same coffee bean matching and coordinate unification on the multi-view image data and the point cloud data to generate alignment detection data and view reliability data; S32. Construct a coffee bean surface model using the point cloud data in the alignment detection data, and map the image defect response in the alignment detection data to the coffee bean surface model to generate three-dimensional defect distribution data. S33. Based on the viewpoint reliability data, perform occlusion compensation and weight fusion on the three-dimensional defect distribution data to generate the fused feature data.
6. The method for coffee bean identification based on a stacked sensing classification model according to claim 1, characterized in that: S4 specifically includes S41, inputting the fused feature data into the stack-aware classification model, and generating stack density data and defect response data through the stack-aware classification model's stack-sensitive attention module; S42. Based on the stacking density data, the defect response data is decoupled to suppress stacking pseudo-features formed by overlapping shadows, contact boundaries and contour distortion, and the real defect features are obtained. S43. Generate classification confidence based on the actual defect characteristics, and output the classification result of coffee beans and target grid cells after the classification confidence reaches the preset standard.
7. The method for coffee bean identification based on a stacked sensing classification model according to claim 6, characterized in that: S42 specifically includes S421, generating stacking contribution data based on the stacking density data, wherein the stacking contribution data is used to characterize the response component in the defect response data caused by coffee bean stacking; S422. Based on the stacked contribution data, decouple the texture response, edge response and grayscale response in the defect response data to obtain pseudo-feature response data and candidate defect response data. S423. Perform consistency verification between the candidate defect response data and the fused feature data to obtain the true defect features.
8. The method for coffee bean identification based on a stacked sensing classification model according to claim 6, characterized in that: S43 specifically includes S431, when the classification confidence level does not reach the preset standard, generating a separation retake instruction based on the stacking density data and the target grid cell; S432. Apply micro-vibration separation to the coffee beans in the target grid cell according to the separation re-beat command, so that the stacked coffee beans produce relative displacement, and obtain the separated coffee beans. S433. Re-capture the separated coffee beans from the same perspective, and return the re-captured image data and point cloud data to update the fused feature data until the classification confidence reaches the preset standard.
9. The method for coffee bean identification based on a stacking-aware classification model according to claim 1, characterized in that: S5 specifically includes S51, determining the target injection position based on the world coordinates corresponding to the target grid cell, and determining the target silo based on the classification result, wherein the target injection position is the physical center of the target grid cell; S52. Based on the target blowing position and the coffee bean conveying status, determine the corresponding air valve nozzle from the array air valve nozzle and generate a rejection command containing the blowing sequence, wherein the airflow range of the corresponding air valve nozzle covers the target grid cell. S53. Control the corresponding air valve nozzle to blow towards the target blowing position according to the rejection instruction, so that the coffee beans enter the target hopper corresponding to the classification result.
10. A coffee bean identification system based on a stacked sensing classification model, characterized in that: It includes a fabric screening device (1), a detection carrier (2), a grid calibration module (3), a flipping drive mechanism (4), a multi-view acquisition module (5), a data processing module (6), a stacking sensing and classification module (7), a rejection control module (8), an air valve nozzle array (9), and multiple hoppers (10); The cloth screening device (1) is used to screen coffee beans and make them into a single layer, so that the coffee beans enter the detection carrier (2); The surface of the detection carrier (2) is provided with a grid positioning pattern for carrying coffee beans after they have been processed with a single layer of fabric; The grid calibration module (3) is used to establish the world coordinates of the grid cells according to the grid positioning pattern; The flipping drive mechanism (4) is used to drive the coffee beans located on the detection carrier (2) to flip; The multi-view acquisition module (5) is used to acquire multi-view image data and point cloud data of coffee beans when the flipping drive mechanism (4) drives the coffee beans to flip, and associate the multi-view image data and point cloud data with the grid cell based on the world coordinates; The data processing module (6) is used to perform spatiotemporal alignment and feature fusion on the multi-view image data and the point cloud data to generate fused feature data of coffee beans; The stacking perception classification module (7) contains a pre-trained stacking perception classification model, which is used to receive the fused feature data, separate stacking pseudo features and real defect features, and trigger a separation re-shot instruction when the classification confidence is insufficient, so that the flipping drive mechanism (4) and the multi-view acquisition module (5) re-acquire the corresponding coffee beans and update the fused feature data until the classification confidence reaches the preset standard and then output the classification result and target grid cell. The rejection control module (8) is used to generate rejection instructions based on the classification results and the world coordinates corresponding to the target grid cell, and send the rejection instructions to the corresponding air valve nozzle; The air valve nozzle array (9) diverts coffee beans to the bins (10) corresponding to the sorting results based on the rejection command.
