A pet food raw material quality detection system and method based on deep learning

CN122966564APending Publication Date: 2026-10-23JIANGSU CHOMPING PET PROD CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611110570.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-24
Publication Date
2026-10-23

AI Technical Summary

Technical Problem

在实际检测流程中,冷冻类原料从冷库转移至检测工位后,因环境温度差异,其表面会发生肉眼可见的物理状态变化,形成局部灰白色、边缘模糊的低对比度区域,该低对比度区域在图像中呈现的漫反射特征与早期霉斑的特征高度近似,两者在色彩分布、纹理方向性和边界清晰度上均缺乏可被稳定区分的差异,现有深度学习检测模型将此类物理变化误判为霉变缺陷的情况频繁出现,迫使检测系统在灵敏度和误报率之间做出不利权衡,影响了自动检测的实用价值

Benefits of technology

1.在深度学习模型完成初步检测后,并不直接依赖模型输出的分类置信度做出最终判断,而是将被识别出的灰白色低对比度区域作为分析起点,回溯至可见光图像序列中该区域在多帧间的动态变化过程,通过提取散射中心并计算散射中心密度在连续多帧间的变化率,将物理微孔塌缩导致的散射源数量衰减趋势与霉变区域散射源数量的相对稳定状态区分开来;同时提取骨架线并计算骨架线分形维数在连续多帧间的迂曲度变化量,将物理微孔坍塌时骨架趋于简化的单向变化模式与霉变菌丝生长时骨架反复波动的模式区分开来,由此将静态纹理混淆问题转化为两个独立且互补的动态形变特征的分析问题,使物理变化区域与霉变缺陷区域在二维特征空间中形成可分离的分布,克服了单帧静态图像中两者特征高度重叠的局限。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122966564A_ABST
    Figure CN122966564A_ABST
Patent Text Reader

Abstract

The application discloses a pet food raw material quality detection system and method based on deep learning, and particularly relates to the field of image recognition and deep learning technology, and is used for solving the misjudgment problem caused by the fact that the existing deep learning detection method cannot distinguish the surface physical change of frozen pet food raw materials from early mold defect. By acquiring a visible light image sequence, a deep learning defect detection model is used to identify a grayish white low-contrast region, a scattering center is extracted in a plurality of continuous frames in the region, and a scattering center density change rate is calculated; meanwhile, a skeleton line is extracted and a tortuosity change amount of a skeleton line fractal dimension is calculated; the change rate and the tortuosity change amount are input into a classifier, and a discrimination result of a physical change region or a mold defect region is output.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of image recognition and deep learning technology, and more specifically, to a deep learning-based system and method for detecting the quality of pet food ingredients. Background Technology

[0002] The quality of pet food ingredients directly affects pet health and product safety. In practical applications, deep learning-based image detection methods can be used to screen ingredients for quality. Convolutional neural networks and other models are typically used to extract color, texture, and morphological features from visible light images of ingredients, automatically identifying defects such as mold and foreign matter. In actual testing processes, frozen ingredients undergo visible physical changes after being transferred from cold storage to the testing station due to temperature differences. This results in localized grayish-white, low-contrast areas with blurred edges. The diffuse reflection characteristics of these low-contrast areas in the image are highly similar to those of early mold spots. The two lack reliably distinguishable differences in color distribution, texture direction, and boundary clarity. Existing deep learning detection models frequently misclassify such physical changes as mold defects, forcing the detection system to make an unfavorable trade-off between sensitivity and false alarm rate, thus affecting the practical value of automated detection.

[0003] The root cause of the aforementioned misjudgment problem lies in the fact that the changes in the surface physical properties of frozen raw materials under normal temperature testing conditions create a similar but different appearance in visible light images as early mold defects caused by microbial growth. Existing deep learning-based detection methods rely on defect patterns learned from training samples. When non-defective physical changes fall into the feature space that highly overlaps with mold defects, the model lacks sufficient discriminative ability to separate the two. This leads to the misidentification of normal raw materials as defective products, resulting in unnecessary waste or manual re-inspection. As a result, conventional deep learning image detection methods are significantly less reliable when dealing with such frozen raw materials, becoming a bottleneck restricting their large-scale application in the quality control of all categories and processes of pet food raw materials. Summary of the Invention

[0004] In order to overcome the above-mentioned defects of the prior art, the present invention provides a deep learning-based pet food raw material quality detection system and method to solve the problems mentioned in the background art.

[0005] To achieve the above objectives, the present invention provides the following technical solution: A deep learning-based method for detecting the quality of pet food ingredients includes the following steps: S1: Acquire a sequence of visible light images of the frozen pet food raw material to be tested at multiple consecutive moments in the testing environment; S2: Use a deep learning defect detection model to detect each frame of the visible light image sequence, identify the target frame with a gray-white low-contrast area, and determine the location of the gray-white low-contrast area. S3: Select multiple consecutive frames containing the target frame in the visible light image sequence, extract the scattering center of the gray-white low-contrast region in each of the multiple consecutive frames based on the position, and calculate the rate of change of the density of the scattering center between the multiple consecutive frames. S4: Extract the skeleton lines of the gray-white low-contrast region in each of several consecutive frames, and calculate the change in the tortuosity of the fractal dimension of the skeleton lines between consecutive frames. S5: Input the rate of change and the change in tortuosity into the classifier, and output the discrimination result of whether the gray-white low-contrast area is a physical change area or a mold defect area.

[0006] Furthermore, a sequence of visible light images of the frozen pet food ingredient to be tested at multiple consecutive moments in the testing environment is acquired, including: Place the frozen pet food ingredients to be tested at the testing station; Under the condition of keeping the intensity and angle of visible light illumination constant, multiple frames of images of the surface of the frozen pet food raw material to be tested are continuously acquired at equal time intervals to form a visible light image sequence.

[0007] Furthermore, a deep learning defect detection model is used to detect defects in each frame of the visible light image sequence, identifying target frames containing low-contrast gray-white regions and determining the location of these regions, including: A deep learning defect detection model is trained using a sequence of sample visible light images. The sample visible light image sequence is marked with the location and category labels of gray-white low-contrast regions. During training, a contrast learning target is constructed based on local region pairs extracted from adjacent frames of the same sample visible light image sequence, so that the deep learning defect detection model learns the visual continuity features of gray-white low-contrast regions between adjacent frames. The visible light image sequence is input frame by frame into the trained deep learning defect detection model. Pixel-by-pixel local region analysis is performed on each frame. The visual continuity features of the corresponding local regions between adjacent frames are calculated. Local regions with visual continuity features lower than a preset continuity threshold are identified as gray-white low-contrast regions. The target frame containing gray-white low-contrast regions and the location of the gray-white low-contrast regions are output.

[0008] Furthermore, a contrastive learning objective is constructed based on local region pairs extracted from adjacent frames of the same sample visible light image sequence. This includes: in the sample visible light image sequence, frames containing gray-white low-contrast regions are used as anchor frames; local image patches of gray-white low-contrast regions in the anchor frames are extracted as anchor samples; local image patches at corresponding positions in adjacent frames of the anchor frames are extracted as positive samples; and local image patches in the anchor frames that do not contain gray-white low-contrast regions are extracted as negative samples. The deep learning defect detection model is trained with the optimization objective that the distance between the anchor samples and positive samples in the feature space is less than the distance between the anchor samples and negative samples in the feature space.

[0009] Furthermore, in the visible light image sequence, multiple consecutive frames containing the target frame are selected. Based on location, the scattering centers of the gray-white low-contrast region are extracted in each of the consecutive frames. The rate of change of the density of the scattering centers between the consecutive frames is calculated, including: In a visible light image sequence, several frames are selected forward and backward from the target frame to form a series of consecutive frames containing the target frame. Within the gray-white low-contrast region of each of several consecutive frames, the local brightness maxima are detected as scattering centers, constrained by position. The number of scattering centers in the gray-white low-contrast region in each of several consecutive frames is counted, and the density of scattering centers is obtained by dividing the number of scattering centers by the area of ​​the gray-white low-contrast region, thus forming a temporal sequence of the density of scattering centers as the frame number changes. By performing a first-order difference operation on the time sequence, the rate of change of the density of the scattering centers across multiple consecutive frames is obtained.

[0010] Furthermore, within the gray-white low-contrast region of each of several consecutive frames, local brightness maxima are detected as scattering centers with position as constraint. This includes: within the gray-white low-contrast region of each frame, moving a detection window of a preset size with a step size of a single pixel, identifying the pixel with the maximum brightness value within the detection window that exceeds the average brightness value of all pixels within the detection window as a local brightness maxima; and using the set of all local brightness maxima within the gray-white low-contrast region as the scattering center.

[0011] Furthermore, the skeleton lines of the gray-white low-contrast region are extracted in each of several consecutive frames, and the change in tortuosity of the fractal dimension of the skeleton lines across these frames is calculated, including: Binarize the gray-white low-contrast region in each of multiple consecutive frames to obtain a binary image of the gray-white low-contrast region. Perform morphological thinning on the binary image to extract the skeleton lines of the gray-white low-contrast region; The fractal dimension of the skeleton line is calculated using the box counting method, forming a temporal sequence in which the fractal dimension changes with the frame number; Perform a first-order difference operation on the time series and take the mean of the absolute values ​​of the first-order difference results as the change in tortuosity of the fractal dimension of the skeleton line across multiple consecutive frames.

[0012] Furthermore, the box counting method is used to calculate the fractal dimension of the skeleton line, including: covering the skeleton line with square boxes of different side lengths and counting the number of square boxes that intersect the skeleton line for each side length; fitting a straight line with the logarithm of each side length as the x-axis and the logarithm of the number of square boxes that intersect the skeleton line for the corresponding side length as the y-axis, and taking the absolute value of the slope of the straight line as the fractal dimension of the skeleton line.

[0013] Furthermore, the rate of change and the change in tortuosity are input into the classifier, and the output is the discrimination result of whether the gray-white low-contrast area is a physical change area or a mold defect area, including: The rate of change and the change in tortuosity are combined to form a two-dimensional feature vector; The two-dimensional feature vector is input into a pre-trained binary classifier. The training samples of the binary classifier include sample pairs of change rate and tortuosity change of gray-white low-contrast regions labeled as physical change regions, and sample pairs of change rate and tortuosity change of gray-white low-contrast regions labeled as mold defect regions. Obtain the discrimination results of the physical change area or mold defect area output by the binary classifier.

[0014] On the other hand, the present invention provides a deep learning-based pet food ingredient quality testing system, comprising the following modules: The image acquisition module is used to acquire a sequence of visible light images of the frozen pet food raw material to be tested at multiple consecutive moments in the testing environment; The defect detection module is used to detect each frame of the visible light image sequence using a deep learning defect detection model, identify target frames with gray-white low-contrast areas and determine the location of the gray-white low-contrast areas. The scattering analysis module is used to select multiple consecutive frames containing the target frame in a visible light image sequence, extract the scattering center of the gray-white low-contrast region in each of the multiple consecutive frames based on the location, and calculate the rate of change of the density of the scattering center between the multiple consecutive frames. The skeleton analysis module is used to extract the skeleton lines of the gray-white low-contrast region in each of several consecutive frames and calculate the change in the tortuosity of the fractal dimension of the skeleton lines between consecutive frames. The classification and discrimination module is used to input the rate of change and the change in tortuosity into the classifier, and output the discrimination result of whether the gray-white low-contrast area is a physical change area or a mold defect area.

[0015] Compared with the prior art, the present invention has the following beneficial effects: 1. After the deep learning model completes the initial detection, it does not directly rely on the classification confidence score output by the model to make the final judgment. Instead, it takes the identified gray-white low-contrast area as the starting point for analysis and traces back to the dynamic change process of this area in the visible light image sequence across multiple frames. By extracting the scattering center and calculating the rate of change of the scattering center density across consecutive frames, it distinguishes the attenuation trend of the number of scattering sources caused by the collapse of physical micropores from the relatively stable state of the number of scattering sources in the moldy area. At the same time, it extracts the skeleton line and calculates the change in the tortuosity of the skeleton line fractal dimension across consecutive frames, distinguishing the unidirectional change pattern of the skeleton tending to simplify when the physical micropores collapse from the pattern of repeated fluctuations of the skeleton when the moldy hyphae grow. Thus, the static texture confusion problem is transformed into the analysis problem of two independent and complementary dynamic deformation features, so that the physical change area and the moldy defect area form a separable distribution in the two-dimensional feature space, overcoming the limitation of the high overlap of the two features in a single frame static image.

[0016] 2. The rate of change and the change in tortuosity together form a two-dimensional feature vector, which is input into the classifier for comprehensive discrimination. The two features provide independent evidence from the perspectives of the temporal evolution of the number of scattering sources and the complexity fluctuation of the skeleton deformation, respectively. This reduces the probability of misjudgment caused by noise or random fluctuations when relying on a single feature for discrimination. The entire discrimination process is completed based on the position information output by the deep learning model. There is no need to retrain or restructure the original deep learning model. This can significantly reduce the probability of misreporting physical change areas as moldy defect areas without sacrificing detection sensitivity. It reduces unnecessary waste and manual re-inspection workload, and substantially improves the applicability and reliability of automatic detection methods for frozen pet food raw materials. Attached Figure Description

[0017] Figure 1 This is a flowchart of a deep learning-based method for detecting the quality of pet food ingredients according to the present invention. Figure 2 This is a schematic diagram of the structure of a deep learning-based pet food raw material quality detection system according to the present invention. Detailed Implementation

[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.

[0019] Example 1: Figure 1 This invention presents a deep learning-based method for detecting the quality of pet food ingredients, comprising the following steps: S1: Acquire a sequence of visible light images of the frozen pet food raw material to be tested at multiple consecutive moments in the testing environment; S2: Use a deep learning defect detection model to detect each frame of the visible light image sequence, identify the target frame with a gray-white low-contrast area, and determine the location of the gray-white low-contrast area. S3: Select multiple consecutive frames containing the target frame in the visible light image sequence, extract the scattering center of the gray-white low-contrast region in each of the multiple consecutive frames based on the position, and calculate the rate of change of the density of the scattering center between the multiple consecutive frames. S4: Extract the skeleton lines of the gray-white low-contrast region in each of several consecutive frames, and calculate the change in the tortuosity of the fractal dimension of the skeleton lines between consecutive frames. S5: Input the rate of change and the change in tortuosity into the classifier, and output the discrimination result of whether the gray-white low-contrast area is a physical change area or a mold defect area.

[0020] The frozen pet food ingredients to be tested are placed at the testing station. The testing station is equipped with a horizontally installed transparent support platform made of optical-grade quartz glass. Drainage channels and guide plates are installed beneath the platform to collect condensation from the surface of the frozen pet food ingredients. The frozen pet food ingredients are placed in a single layer on the transparent support platform, with no overlap between the particles. Limiting strips are located on both sides of the transparent support platform. The spacing between the limiting strips is adjustable according to the maximum particle size of the frozen pet food ingredients. Adjustment is made by loosening the locking screws at the bottom of the limiting strips, moving the strips along the slide to the target position, and then locking them. The entire testing station is placed in a constant temperature and humidity environment. The difference between the ambient temperature and the cold storage temperature is controlled within a preset range, for example, the ambient temperature is maintained between 10°C and 15°C, and the relative humidity does not exceed 50%. A contact thermocouple temperature sensor is installed on one side of the transparent support platform. The temperature sensing end of the contact thermocouple temperature sensor is in close contact with the lower surface of the frozen pet food raw material to be tested. The contact thermocouple temperature sensor measures the body temperature of the frozen pet food raw material to be tested in real time and uploads it to the host computer.

[0021] Under constant visible light illumination intensity and angle, multiple frames of images of the surface of the frozen pet food raw material to be tested are continuously acquired at equal time intervals to form a visible light image sequence. An illumination device and an image acquisition device are installed above the inspection station. The illumination device includes two symmetrically arranged LED strip light sources. The optical axes of the two LED strip light sources form an angle of 45 degrees with the normal direction of the transparent support platform. The light from the two LED strip light sources uniformly covers the entire support surface of the transparent support platform. The two LED strip light sources are driven by the same constant current source. The constant current source integrates a light intensity closed-loop control loop. The light intensity closed-loop control loop uses a silicon photodiode installed at the edge of the transparent support platform as a light intensity feedback element. The silicon photodiode linearly converts the received illuminance into a voltage signal. The silicon photodiode compares the voltage signal with a preset reference voltage. The difference signal is sent to a PID controller. The control quantity output by the PID controller is used to adjust the output current of the constant current source, dynamically adjusting the output current so that the voltage signal of the silicon photodiode always approaches the reference voltage. The mechanical support of the LED strip light source is rigidly fixed to the frame of the testing station by bolts. The frame of the testing station is made of heat-treated and aged aluminum alloy profiles, which does not change the illumination angle of the LED strip light source when subjected to minor vibrations.

[0022] The image acquisition device includes a global shutter CMOS industrial camera and a fixed-focus lens. The global shutter CMOS industrial camera is connected to the fixed-focus lens via a C-interface. The global shutter CMOS industrial camera is vertically mounted directly above the transparent support platform, with its optical axis coinciding with the normal of the transparent support platform. The focal length and object distance of the fixed-focus lens are selected according to the dimensions of the transparent support platform, ensuring that the field of view of the global shutter CMOS industrial camera precisely covers the effective support surface of the transparent support platform. The global shutter CMOS industrial camera is connected to the host computer via a gigabit Ethernet cable, and image data is transmitted in uncompressed Bayer format. The exposure time of the global shutter CMOS industrial camera is pre-calibrated based on the lighting conditions and the surface reflectivity of the frozen pet food raw material to be tested. The calibration process involves acquiring a set of images of a reference plate with a standard diffuse grayscale at different exposure times. The exposure time that results in the median value of the brightness histogram in the grayscale image of the reference plate being between 50% and 60% of the saturation value of the global shutter CMOS industrial camera is selected as the fixed exposure time, which remains unchanged in all subsequent image acquisitions.

[0023] The method for determining the equal time interval is as follows: Several batches of frozen pet food raw material samples known to have only physically changed areas and several batches of frozen pet food raw material samples known to have only mold defects are pre-selected. For each batch of samples, multiple frames of visible light image sequences are continuously acquired under different time interval conditions. The values ​​of different time intervals increase from 20 milliseconds to 200 milliseconds, with a step size of 10 milliseconds. For each time interval, according to the subsequent S3 extraction of the scattering center density change rate feature and S4 extraction of the tortuosity change feature, the change rate feature distribution and tortuosity change feature distribution of the frozen pet food raw material samples known to have only physically changed areas and the frozen pet food raw material samples known to have only mold defects are input into linear discriminant analysis. The ratio of inter-class divergence to intra-class divergence in the feature space of the frozen pet food raw material samples known to have only physically changed areas and the frozen pet food raw material samples known to have only mold defects are calculated at each time interval. The time interval that maximizes the ratio of inter-class divergence to intra-class divergence is selected as the equal time interval. The selected equal time interval is written to the programmable logic controller (PLC), which generates pulse signals at equal time intervals. The rising edge of each pulse triggers a global shutter CMOS industrial camera to expose and acquire one frame. The time difference between the rising edges of two adjacent pulses is equal to the selected equal time interval. During continuous acquisition, the PLC sends an enable signal and begins to continuously output pulses. The global shutter CMOS industrial camera continuously exposes and buffers the image data before uploading it to the host computer, until the host computer sends a stop command, forming a visible light image sequence. Each frame in the visible light image sequence is named and stored as a 16-bit PNG file according to the acquisition timestamp sequence. The file name includes the acquisition timestamp and frame number.

[0024] A deep learning defect detection model is trained using a sequence of sample visible light images. The sample visible light image sequence is marked with the location and category labels of gray-white low-contrast regions. During training, a contrast learning target is constructed based on local region pairs extracted from adjacent frames of the same sample visible light image sequence, so that the deep learning defect detection model learns the visual continuity features of gray-white low-contrast regions between adjacent frames.

[0025] Deep learning defect detection models employ encoders The decoder structure consists of a encoder composed of stacked convolutional blocks. Each convolutional block contains a convolutional layer, a batch normalization layer, and a ReLU activation layer. Adjacent convolutional blocks are downsampled using max pooling layers, while the decoder is upsampled using deconvolutional layers. Convolutional blocks of corresponding scales in the decoder and encoder are fused via skip connections. The decoder outputs a pixel-wise feature map with the same resolution as the input image, where each pixel corresponds to a feature vector. The training of the deep learning defect detection model is divided into two stages: a pre-training stage and a contrastive learning fine-tuning stage. The pre-training stage uses a publicly available general image dataset, employing the deep learning defect detection model as an autoencoder for reconstruction training to obtain initial weights that are responsive to general image textures and edges. In the comparative learning fine-tuning stage, a sample visible light image sequence was used. This sequence was obtained from multiple batches of frozen pet food raw materials to be tested, acquired at the testing station according to S1. Each frame in the sample visible light image sequence had its location and category labels for the gray-white low-contrast areas manually marked. The location labels were the contour coordinate sequences of the gray-white low-contrast areas, and the category labels included two types: areas of physical change and areas of mold defects. In the sample visible light image sequence, frames containing gray-white low-contrast areas were used as anchor frames. Local image patches of the gray-white low-contrast areas within the anchor frames were extracted as anchor samples. Local image patches with the same pixel coordinate range as the anchor samples in adjacent frames were extracted as positive samples. Local image patches that did not contain gray-white low-contrast areas in the anchor frames were extracted as negative samples. Adjacent frames were the frames preceding and following the anchor frame in the sample visible light image sequence. The sizes of the anchor samples, positive samples, and negative samples were all uniformly scaled to a preset size using bilinear interpolation, for example, 64 pixels × 64 pixels. Anchor samples, positive samples, and negative samples are input into the encoder. The encoder outputs feature vectors for the anchor samples, positive samples, and negative samples. The dimensions of the feature vectors for the anchor samples, positive samples, and negative samples are determined by the number of output channels of the encoder. The contrastive learning objective is constructed as follows: the Euclidean distance between the feature vectors of the anchor samples and the positive samples is used as the first distance; the Euclidean distance between the feature vectors of the anchor samples and the negative samples is used as the second distance. The optimization objective is to make the first distance less than the second distance. A margin hyperparameter is introduced, such that the difference between the second distance and the first distance is greater than the margin hyperparameter. For example, the margin hyperparameter is set to 0.5. The loss function is the contrastive loss function, defined as follows: the loss is 0 when the difference between the second distance and the first distance is greater than the margin hyperparameter; the loss is the margin hyperparameter minus the difference between the second distance and the first distance when the difference between the second distance and the first distance is less than or equal to the margin hyperparameter.During training, a stochastic gradient descent optimizer is used, with an initial learning rate set to, for example, 0.001. After each iteration of the visible light image sequence, the learning rate is decayed to the previous learning rate multiplied by a decay factor, for example, 0.95. The batch size is set to 4 or 8 depending on the GPU memory capacity. Training is iterated until the contrastive loss function converges. In the deep learning defect detection model trained through the contrastive learning fine-tuning phase, the feature vectors output by the encoder part form clusters in the feature space for the feature vectors of normal background regions, physically changed regions, and mold defect regions. The feature vectors corresponding to physically changed regions exhibit continuity and stability between adjacent frames, while the feature vectors corresponding to normal background regions exhibit random fluctuations between adjacent frames.

[0026] The visible light image sequence is input frame by frame into the trained deep learning defect detection model. For each frame, pixel-by-pixel local region analysis is performed, calculating the visual continuity features of corresponding local regions between adjacent frames. Local regions with visual continuity features below a preset continuity threshold are identified as gray-white low-contrast regions, and the target frame containing these gray-white low-contrast regions and their locations are output. The current frame to be detected and its reference frame (the frame preceding the current frame in the visible light image sequence) are input into the encoder of the trained deep learning defect detection model. The encoder outputs pixel-by-pixel feature maps of both the current and reference frames. For each pixel position in the pixel-by-pixel feature map of the current frame to be detected, the feature vector at that pixel position is extracted. Simultaneously, the feature vector at the same pixel position in the reference frame is extracted. The cosine similarity between the two feature vectors is calculated as the visual continuity feature, with the cosine similarity value ranging from [value missing]. 1 to 1. The preset continuity threshold is determined through offline statistical methods. The offline statistical method is as follows: using the visible light image sequence of the training phase samples, the visual continuity feature values ​​of all pixel positions labeled as normal background regions between adjacent frames are collected into a first set, and the visual continuity feature values ​​of all pixel positions labeled as gray-white low-contrast regions between adjacent frames are collected into a second set. The mean and standard deviation of the first set are calculated, as are the mean and standard deviation of the second set. The goal is to maximize the classification Youden index of the first and second sets under the preset continuity threshold. The preset continuity threshold is determined by traversing and searching within the range of 0 to 1 with a preset step size. For each pixel position in the current frame to be detected, the visual continuity feature of the pixel position is compared with the preset continuity threshold. Pixel positions with visual continuity features lower than the preset continuity threshold are marked as candidate pixels. Connected component analysis is performed on all candidate pixels. Connected components with an area smaller than a preset area threshold are filtered out as noise. The preset area threshold is set based on the minimum detection size of the gray-white low-contrast region; for example, the preset area threshold is 100 pixels. Connected components with an area not less than a preset area threshold are defined as gray-white low-contrast regions. The position of the gray-white low-contrast region is represented by the contour coordinate sequence of the connected component, which consists of the coordinates of all pixels on the boundary of the connected component arranged in counterclockwise order. The current frame to be detected containing the gray-white low-contrast region is the target frame. The target frame and the position of the gray-white low-contrast region are used together as the output of the deep learning defect detection model, and the position of the gray-white low-contrast region is used in subsequent steps S3 and S4.

[0027] In a visible light image sequence, several frames are selected both forward and backward from the target frame to form a continuous multi-frame sequence containing the target frame. The target frame is determined by the frame with a gray-white low-contrast region output by S2, and its frame number in the visible light image sequence is known. Forward selection starts from the frame before the target frame and proceeds frame by frame towards an earlier time, while backward selection starts from the frame after the target frame and proceeds frame by frame towards a later time. The number of frames selected forward is equal to the number of frames selected backward. The number of selected frames is set based on the equal time interval and the expected rate of change of the gray-white low-contrast region. The expected rate of change is related to the surface temperature rise rate of the frozen pet food raw material to be tested after it is transferred from the cold storage to the testing station. The surface temperature rise rate is measured in a preliminary experiment using a contact thermocouple temperature sensor. The number of selected frames ensures that the total time span of the continuous multi-frame sequence covers the complete cycle from the appearance of the gray-white low-contrast region to the point where its area changes tend to stabilize. For example, if the number of selected frames is 5, then 5 frames are selected forward and 5 frames are selected backward, plus the target frame, for a total of 11 frames to form a continuous multi-frame sequence containing the target frame. Each frame in a series of consecutive frames retains the original image data and the frame number of the original image data in the visible light image sequence. The frame number is used to construct the subsequent time sequence.

[0028] Within each of several consecutive frames, in the gray-white low-contrast region, the local brightness maxima are detected as scattering centers, constrained by the position of the gray-white low-contrast region. The position of the gray-white low-contrast region is given by the contour coordinate sequence output by S2, which defines the boundary of the gray-white low-contrast region in each frame image. For each frame in several consecutive frames, the grayscale image of the frame image is read. The grayscale image is obtained by weighted averaging of the color images of the visible light image sequence. The weighted averaging transformation coefficients are red channel multiplied by 0.299, green channel multiplied by 0.587, and blue channel multiplied by 0.114. On the grayscale image, a binary mask is generated with the contour coordinate sequence as the boundary. The binary mask has a value of 1 for pixel positions inside the contour coordinate sequence and a value of 0 for pixel positions outside the contour coordinate sequence. Subsequent scattering center detection is performed only within the pixel positions where the binary mask has a value of 1. Within the area where the binary mask value is 1, a detection window of a preset size is moved in steps of one pixel. The preset size is set according to the expected physical scale of the scattering center, which corresponds to the imaging point in the image of the micropore formed by the sublimation of ice crystals on the surface of the frozen pet food raw material to be detected. The imaging size of the micropore is related to the magnification of the fixed-focus lens and the actual diameter of the micropore. The actual diameter range of the micropore is obtained through microscope prediction. For example, the actual diameter range of the micropore is 0.02 mm to 0.2 mm, which corresponds to the imaging size range in the image, for example, 1 pixel to 10 pixels. Therefore, the preset size is, for example, a square window of 5 pixels × 5 pixels. The detection window slides pixel by pixel within the region, from left to right and from top to bottom, moving one pixel at a time. For each position the detection window stops at, the average brightness of all pixels within the window is calculated, and the pixel with the highest brightness value is found. The brightness value of this pixel is compared to the average brightness value of all pixels within the window. If the brightness value of the pixel with the highest brightness value exceeds the average brightness value and is located within the central region of the detection window (e.g., a region no more than one pixel from the geometric center of the window), then this pixel is identified as a local luminance maximum. After traversing all pixel positions satisfying the detection window sliding condition within the region where the binary mask value is 1, the set of all local luminance maximum points within the gray-white low-contrast region is taken as the scattering center. The coordinates of each local luminance maximum point in the scattering center and its brightness value in the frame image are recorded. Each frame in a series of consecutive frames independently performs scattering center detection according to the above process, resulting in a separate set of scattering centers for each frame.

[0029] The density of scattering centers is calculated by counting the number of scattering centers within the gray-white low-contrast region in each of several consecutive frames. This density is then divided by the area of ​​the gray-white low-contrast region, forming a temporal sequence showing the change in scattering center density with frame number. Each frame in the series corresponds to a frame number, which is numbered sequentially according to the acquisition time in the visible light image sequence; a smaller frame number indicates an earlier acquisition time. For each frame in the series, the number of scattering centers is the total number of locally maxima detected, and the area of ​​the gray-white low-contrast region is the area of ​​the connected region enclosed by the contour coordinate sequence. The area is calculated by counting the total number of pixels with a value of 1 in the binary mask. The area of ​​each pixel is calculated based on the magnification of the fixed-focus lens and the pixel size of the global shutter CMOS industrial camera. The pixel size is the factory parameter of the global shutter CMOS industrial camera, for example, a pixel size of 3.45 μm × 3.45 μm. The density of scattering centers is defined as the number of scattering centers divided by the area of ​​the gray-white low-contrast region, with the unit being centers per square millimeter. The frame number of each frame in a series of consecutive frames is used as the horizontal axis of the time sequence, and the density of the scattering centers corresponding to the frame number is used as the vertical axis of the time sequence, forming a time sequence in which the density of the scattering centers changes with the frame number. The frame number of the horizontal axis in the time sequence is offset from the frame number of the target frame. The frame number offset of the target frame is 0, the frame number offset of the frame selected forward is negative, and the frame number offset of the frame selected backward is positive.

[0030] A first-order difference operation is performed on the time series to obtain the rate of change of the density of scattering centers across multiple consecutive frames. The first-order difference operation is defined as follows: for the (i+1)th element in the time series, the density value of the scattering centers of the (i+1)th element is subtracted from the density value of the scattering centers of the ith element. This difference is used as the ith difference value, with i iterating from 1 to the length of the time series minus 1. The first-order difference operation yields a difference sequence, the length of which is one less than the length of the time series. Each difference value in the difference sequence corresponds to a frame number interval, which is the difference in frame numbers between two adjacent frames across multiple consecutive frames. The rate of change of the density of scattering centers across multiple consecutive frames is the mean of all difference values ​​in the difference sequence, expressed in units of square millimeters per frame interval. This rate of change will be used as the first dimension of the two-dimensional feature vector input to the binary classifier in S5.

[0031] The gray-white low-contrast regions in each of several consecutive frames are binarized to obtain binary images of these regions. These consecutive frames are selected from the visible light image sequence by S3, with each frame corresponding to a frame number. The positions of the gray-white low-contrast regions are given by the contour coordinate sequence output by S2. For each frame in the consecutive frames, a color image is read from the visible light image sequence. The red channel value of each pixel in the color image is multiplied by 0.299, the green channel value by 0.587, and the blue channel value by 0.114, and then summed to obtain a grayscale image. On the grayscale image, the grayscale values ​​of all pixels within the contour coordinate sequence are extracted, and a grayscale value distribution histogram is calculated. Each gray value from 0 to 255 in the grayscale value set is sequentially used as a candidate threshold. Pixels with gray values ​​greater than or equal to the candidate threshold are divided into a first pixel group, and pixels with gray values ​​less than the candidate threshold are divided into a second pixel group. The proportion of pixels in the first pixel group to the total number of pixels in the grayscale value set is calculated, along with the average gray value of the first pixel group. The proportion of pixels in the second pixel group to the total number of pixels in the grayscale value set is calculated, along with the average gray value of the second pixel group. Finally, the overall average gray value of the grayscale value set is calculated. The proportions of the first and second pixel groups are multiplied, and then multiplied by the square of the difference between the average gray values ​​of the first and second pixel groups to obtain the inter-class variance corresponding to the candidate threshold. All candidate thresholds are iterated through, and the candidate threshold that maximizes the inter-class variance is selected as the binarization threshold. Pixels with grayscale values ​​greater than or equal to the binarization threshold within the contour coordinate sequence are assigned a value of 1, pixels with grayscale values ​​less than the binarization threshold are assigned a value of 0, and all pixels outside the contour coordinate sequence are assigned a value of 0. This generates a binary image with the same size as the grayscale image. In the binary image, pixels with a value of 1 form the foreground of the grayscale low-contrast region, and pixels with a value of 0 form the background. This process is repeated for each frame in a series of consecutive frames to obtain the corresponding binary image for each frame.

[0032] Morphological thinning is performed on the binary image to extract the skeleton lines of the low-contrast gray-white regions. The morphological thinning operation employs a parallel iterative thinning method, repeatedly deleting foreground pixels with a value of 1 in the binary image. Each iteration includes a first sub-iteration and a second sub-iteration. The first sub-iteration deletes foreground pixels that simultaneously meet all of the following conditions: the number of pixels with a value of 1 in the eight-neighborhood of the foreground pixel is between 2 and 6; starting from the pixel directly above the foreground pixel in its eight-neighborhood, the changes in the values ​​of adjacent pixels are checked clockwise, with the number of times an adjacent pixel's value changes from 0 to 1 or from 1 to 0 counted as 1; the product of the pixel values ​​of the pixel directly above, to the right, and below the foreground pixel in its eight-neighborhood is 0; and the product of the pixel values ​​of the pixel directly to the right, below, and to the left of the foreground pixel in its eight-neighborhood is 0. The second sub-iteration deletes foreground pixels that simultaneously meet all of the following conditions: the number of pixels with a value of 1 in the eight-neighborhood of the foreground pixel is between 2 and 6; starting from the pixel directly above the foreground pixel in its eight-neighborhood, the values ​​of adjacent pixels are checked one by one in a clockwise direction; the product of the pixel values ​​of the pixel directly above, to the right, and to the left of the foreground pixel in its eight-neighborhood is 0; the product of the pixel values ​​of the pixel directly above, below, and to the left of the foreground pixel in its eight-neighborhood is 0. The first and second sub-iterations are repeated until no more foreground pixels can be deleted. The remaining pixels with a value of 1 form the skeleton lines of the gray-white low-contrast region, which are stored as a set of pixel coordinates. Morphological thinning is performed on the binary image for each of several consecutive frames to obtain the corresponding skeleton lines for each frame.

[0033] The fractal dimension of the skeleton lines is calculated using box counting, forming a temporal sequence in which the fractal dimension changes with the frame number. For the skeleton lines in each frame across multiple consecutive frames, the minimum bounding rectangle of the skeleton lines is determined. A grid is created within the minimum bounding rectangle, with grid cells consisting of square boxes with fixed side lengths. The side length of the square boxes starts at 1 pixel and increases in powers of 2, for example, 1 pixel, 2 pixels, 4 pixels, 8 pixels, 16 pixels, 32 pixels, until the side length of the square box exceeds the shorter side of the minimum bounding rectangle. For each square box side length value, the grid is overlaid on the minimum bounding rectangle, and the number of square boxes containing at least one skeleton line pixel is counted. The side length value and the corresponding number of square boxes are recorded. The natural logarithm of the square box side length value and the natural logarithm of the corresponding number of square boxes are calculated, resulting in a scatter plot with the natural logarithm of the square box side length value as the x-axis and the natural logarithm of the corresponding number of square boxes as the y-axis. The least squares method is used to fit a straight line to the scattered points. The average value of the x-coordinate and the average value of the y-coordinate are calculated. The difference between the x-coordinate and the average x-coordinate of each scattered point is multiplied by the product of the difference between the y-coordinate and the average y-coordinate of each scattered point. The products of all scattered points are summed to obtain the first cumulative sum. The square of the difference between the x-coordinate and the average x-coordinate of each scattered point is calculated. All squares are summed to obtain the second cumulative sum. The first cumulative sum is divided by the second cumulative sum, and the absolute value of the quotient is taken as the fractal dimension of the skeleton line of the current frame. If the skeleton line is empty, the fractal dimension of the current frame is set to 0. The frame number of each frame in a series of consecutive frames is combined with the calculated fractal dimension. The frame number adopts the same representation method as the temporal sequence in S3, that is, the frame number of the target frame is used as the reference, the frame number of the target frame is offset by 0, the frame number of the forward selected frame is offset by a negative value, and the frame number of the backward selected frame is offset by a positive value, forming a temporal sequence in which the fractal dimension changes with the frame number.

[0034] A first-order differencing operation is performed on the time series, and the mean of the absolute values ​​of the first-order differencing results is taken as the change in tortuosity of the fractal dimension of the skeleton line across multiple consecutive frames. The first-order differencing operation is as follows: For the (i+1)th element in the time series, the fractal dimension of the (i+1)th element is subtracted from the fractal dimension of the ith element to obtain the ith difference value. This process iterates from 1 to the length of the time series minus 1, resulting in a set of difference values. The absolute value of each difference value in the set is taken, and the arithmetic mean of all the absolute values ​​is calculated. This arithmetic mean is the change in tortuosity of the fractal dimension of the skeleton line across multiple consecutive frames. This change in tortuosity will be used as the second dimension component of the two-dimensional feature vector input to the binary classifier in S5.

[0035] The rate of change and the change in tortuosity are combined to form a two-dimensional feature vector. The rate of change, calculated by S3, is the rate of change of the density of scattering centers across multiple consecutive frames, with units of units per square millimeter per frame interval. The change in tortuosity, calculated by S4, is the change in tortuosity of the fractal dimension of the skeleton lines across multiple consecutive frames; this change in tortuosity is dimensionless. The rate of change is used as the first dimension component, and the change in tortuosity as the second dimension component, forming a two-dimensional feature vector containing two elements. Before forming the two-dimensional feature vector, both the rate of change and the change in tortuosity are standardized to ensure comparability on a numerical scale. The standardization process is as follows: Based on the rate of change values ​​of all labeled samples in the training sample set, the mean and standard deviation of the rate of change are calculated. The current rate of change is subtracted from the mean rate of change and then divided by the standard deviation to obtain the standardized rate of change. Similarly, based on the tortuosity change values ​​of all labeled samples in the training sample set, the mean and standard deviation of the tortuosity change are calculated. The current tortuosity change is subtracted from the mean tortuosity change and then divided by the standard deviation to obtain the standardized tortuosity change. The standardized rate of change and the standardized tortuosity change are combined to form a standardized two-dimensional feature vector.

[0036] The standardized two-dimensional feature vectors are input into a pre-trained binary classifier. The binary classifier uses a linear support vector machine (SVM). The decision function of the SVM is to calculate the inner product of the standardized two-dimensional feature vector and the weight vector, add a bias term to the inner product, and then take the sign function. The weight vector and bias term are parameters optimized and determined during the training process of the SVM. The training process of the SVM is as follows: several batches of frozen pet food raw materials to be tested are collected. Each batch of frozen pet food raw materials to be tested is processed according to S1 to S4, and sample pairs of change rate and tortuosity change corresponding to each detected gray-white low-contrast region are obtained. The category label of each gray-white low-contrast region is determined by comparing it with the laboratory culture and identification results. The laboratory culture and identification involves placing the raw material sample corresponding to the gray-white low-contrast region in a constant temperature and humidity incubator for a preset time and observing the colony growth. If colony growth is observed, the category label of the gray-white low-contrast region is marked as a mold defect region; if no colony growth is observed, the category label of the gray-white low-contrast region is marked as a physical change region. The sample pairs of change rate and tortuosity change corresponding to gray-white low-contrast regions labeled as physical change areas are used as positive class training samples, and the sample pairs of change rate and tortuosity change corresponding to gray-white low-contrast regions labeled as mold defect areas are used as negative class training samples. These positive and negative training samples together constitute the training sample set. The mean and standard deviation of the change rate and tortuosity change values ​​for each training sample in the training sample set are calculated for standardization. The standardized change rate and standardized tortuosity change of all training samples in the training sample set are combined to form a standardized two-dimensional feature vector. A linear support vector machine (SVM) determines the weight vector and bias term by solving a convex quadratic programming problem. The optimization objective of the convex quadratic programming problem is to maximize the classification margin between positive and negative training samples, while a penalty coefficient is introduced to penalize misclassified training samples. The penalty coefficient is determined as follows: the training sample set is randomly divided into several subsets. Each time, one subset is selected as the validation subset, and the remaining subsets are combined to form the training subset. A linear support vector machine is trained sequentially using the training subset on a set of candidate penalty coefficients, and the classification accuracy is evaluated using the validation subset. The candidate penalty coefficient that maximizes the average classification accuracy across all validation subsets is selected as the penalty coefficient. For example, the candidate penalty coefficient can range from 10 on a logarithmic scale. -3 Up to 10 3 A set of values ​​is selected, increasing in powers of 10. After training, the specific values ​​of the weight vector and bias term are obtained.

[0037] Obtain the discrimination results of the binary classifier for physical change regions or mold defect regions. Input the standardized two-dimensional feature vector into the trained linear support vector machine (SVM). Calculate the dot product between the weight vector and the standardized two-dimensional feature vector. Add a bias term to the dot product to obtain the decision value. If the decision value is greater than 0, the SVM outputs a discrimination result for a physical change region; if the decision value is less than or equal to 0, the SVM outputs a discrimination result for a mold defect region. The discrimination results are output in label form: a label value of 0 indicates a gray-white low-contrast region is a physical change region, and a label value of 1 indicates a gray-white low-contrast region is a mold defect region. The discrimination results are directly used to guide the sorting decisions of frozen pet food raw materials to be tested. Frozen pet food raw materials with a discrimination result of mold defect region are rejected from the production line, while frozen pet food raw materials with a discrimination result of physical change region are released to subsequent processing steps.

[0038] Example 2: Figure 2 A schematic diagram of a deep learning-based pet food ingredient quality testing system is provided. This system includes the following modules: The image acquisition module is used to acquire a sequence of visible light images of the frozen pet food raw material to be tested at multiple consecutive moments in the testing environment; The defect detection module is used to detect each frame of the visible light image sequence using a deep learning defect detection model, identify target frames with gray-white low-contrast areas and determine the location of the gray-white low-contrast areas. The scattering analysis module is used to select multiple consecutive frames containing the target frame in a visible light image sequence, extract the scattering center of the gray-white low-contrast region in each of the multiple consecutive frames based on the location, and calculate the rate of change of the density of the scattering center between the multiple consecutive frames. The skeleton analysis module is used to extract the skeleton lines of the gray-white low-contrast region in each of several consecutive frames and calculate the change in the tortuosity of the fractal dimension of the skeleton lines between consecutive frames. The classification and discrimination module is used to input the rate of change and the change in tortuosity into the classifier, and output the discrimination result of whether the gray-white low-contrast area is a physical change area or a mold defect area.

[0039] The calculations involved in the embodiments are all dimensionless numerical calculations, and the preset parameters and thresholds in the calculations are set by those skilled in the art according to the actual situation.

[0040] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, in the form of a computer program product.

[0041] Those skilled in the art will recognize that the modules and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and inventive constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0042] In addition, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module.

[0043] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.

[0044] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0045] In conclusion, the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for detecting the quality of pet food ingredients based on deep learning, characterized in that, Includes the following steps: S1: Acquire a sequence of visible light images of the frozen pet food raw material to be tested at multiple consecutive moments in the testing environment; S2: Use a deep learning defect detection model to detect each frame of the visible light image sequence, identify the target frame with a gray-white low-contrast area, and determine the location of the gray-white low-contrast area. S3: Select multiple consecutive frames containing the target frame in the visible light image sequence, extract the scattering center of the gray-white low-contrast region in each of the multiple consecutive frames based on the position, and calculate the rate of change of the density of the scattering center between the multiple consecutive frames. S4: Extract the skeleton lines of the gray-white low-contrast region in each of several consecutive frames, and calculate the change in the tortuosity of the fractal dimension of the skeleton lines between consecutive frames. S5: Input the rate of change and the change in tortuosity into the classifier, and output the discrimination result of whether the gray-white low-contrast area is a physical change area or a mold defect area.

2. The method for detecting the quality of pet food raw materials based on deep learning according to claim 1, characterized in that, Acquire a sequence of visible light images of the frozen pet food ingredient to be tested at multiple consecutive moments in the testing environment, including: Place the frozen pet food ingredients to be tested at the testing station; Under the condition of keeping the intensity and angle of visible light illumination constant, multiple frames of images of the surface of the frozen pet food raw material to be tested are continuously acquired at equal time intervals to form a visible light image sequence.

3. The method for detecting the quality of pet food raw materials based on deep learning according to claim 1, characterized in that, A deep learning-based defect detection model is used to detect defects in each frame of a visible light image sequence, identifying target frames containing low-contrast gray-white regions and determining the location of these regions. This includes: A deep learning defect detection model is trained using a sequence of sample visible light images. The sample visible light image sequence is marked with the location and category labels of gray-white low-contrast regions. During training, a contrast learning target is constructed based on local region pairs extracted from adjacent frames of the same sample visible light image sequence, so that the deep learning defect detection model learns the visual continuity features of gray-white low-contrast regions between adjacent frames. The visible light image sequence is input frame by frame into the trained deep learning defect detection model. Pixel-by-pixel local region analysis is performed on each frame. The visual continuity features of the corresponding local regions between adjacent frames are calculated. Local regions with visual continuity features lower than a preset continuity threshold are identified as gray-white low-contrast regions. The target frame containing gray-white low-contrast regions and the location of the gray-white low-contrast regions are output.

4. The method for detecting the quality of pet food raw materials based on deep learning according to claim 3, characterized in that, The contrastive learning objective is constructed based on local region pairs extracted from adjacent frames of the same sample visible light image sequence. This includes: in the sample visible light image sequence, frames containing gray-white low-contrast regions are used as anchor frames; local image patches of gray-white low-contrast regions in the anchor frames are extracted as anchor samples; local image patches at corresponding positions in adjacent frames of the anchor frames are extracted as positive samples; and local image patches in the anchor frames that do not contain gray-white low-contrast regions are extracted as negative samples. The deep learning defect detection model is trained with the optimization objective that the distance between the anchor samples and positive samples in the feature space is less than the distance between the anchor samples and negative samples in the feature space.

5. The method for detecting the quality of pet food raw materials based on deep learning according to claim 1, characterized in that, In a visible light image sequence, select multiple consecutive frames containing the target frame. Based on location, extract the scattering centers of the gray-white low-contrast region in each of the consecutive frames. Calculate the rate of change of the density of the scattering centers across the consecutive frames, including: In a visible light image sequence, several frames are selected forward and backward from the target frame to form a series of consecutive frames containing the target frame. Within the gray-white low-contrast region of each of several consecutive frames, the local brightness maxima are detected as scattering centers, constrained by position. The number of scattering centers in the gray-white low-contrast region in each of several consecutive frames is counted, and the density of scattering centers is obtained by dividing the number of scattering centers by the area of ​​the gray-white low-contrast region, thus forming a temporal sequence of the density of scattering centers as the frame number changes. By performing a first-order difference operation on the time sequence, the rate of change of the density of the scattering centers across multiple consecutive frames is obtained.

6. The method for detecting the quality of pet food raw materials based on deep learning according to claim 5, characterized in that, Within a gray-white low-contrast region of each consecutive frame, local luminance maxima are detected as scattering centers, constrained by position. This includes: moving a detection window of a preset size within the gray-white low-contrast region of each frame with a step size of a single pixel; identifying the pixel with the maximum luminance value within the detection window that exceeds the average luminance value of all pixels within the detection window as a local luminance maxima; and using the set of all local luminance maxima within the gray-white low-contrast region as the scattering center.

7. The method for detecting the quality of pet food raw materials based on deep learning according to claim 1, characterized in that, Extract the skeleton lines of the gray-white low-contrast region in each of several consecutive frames, and calculate the change in tortuosity of the fractal dimension of the skeleton lines across multiple frames, including: Binarize the gray-white low-contrast region in each of multiple consecutive frames to obtain a binary image of the gray-white low-contrast region. Perform morphological thinning on the binary image to extract the skeleton lines of the gray-white low-contrast region; The fractal dimension of the skeleton line is calculated using the box counting method, forming a temporal sequence in which the fractal dimension changes with the frame number; Perform a first-order difference operation on the time series and take the mean of the absolute values ​​of the first-order difference results as the change in tortuosity of the fractal dimension of the skeleton line across multiple consecutive frames.

8. The method for detecting the quality of pet food raw materials based on deep learning according to claim 7, characterized in that, The fractal dimension of the skeleton line is calculated using the box counting method, which includes: covering the skeleton line with square boxes of different side lengths and counting the number of square boxes that intersect the skeleton line for each side length; fitting a straight line with the logarithm of each side length as the x-axis and the logarithm of the number of square boxes that intersect the skeleton line for the corresponding side length as the y-axis, and taking the absolute value of the slope of the straight line as the fractal dimension of the skeleton line.

9. The method for detecting the quality of pet food raw materials based on deep learning according to claim 1, characterized in that, Input the rate of change and the change in tortuosity into the classifier, and output the discrimination result of whether the gray-white low-contrast area is a physical change area or a mold defect area, including: The rate of change and the change in tortuosity are combined to form a two-dimensional feature vector; The two-dimensional feature vector is input into a pre-trained binary classifier. The training samples of the binary classifier include sample pairs of change rate and tortuosity change of gray-white low-contrast regions labeled as physical change regions, and sample pairs of change rate and tortuosity change of gray-white low-contrast regions labeled as mold defect regions. Obtain the discrimination results of the physical change area or mold defect area output by the binary classifier.

10. A deep learning-based pet food ingredient quality testing system, used to implement the deep learning-based pet food ingredient quality testing method according to any one of claims 1-9, characterized in that, Includes the following modules: The image acquisition module is used to acquire a sequence of visible light images of the frozen pet food raw material to be tested at multiple consecutive moments in the testing environment; The defect detection module is used to detect each frame of the visible light image sequence using a deep learning defect detection model, identify target frames with gray-white low-contrast areas and determine the location of the gray-white low-contrast areas. The scattering analysis module is used to select multiple consecutive frames containing the target frame in a visible light image sequence, extract the scattering center of the gray-white low-contrast region in each of the multiple consecutive frames based on the location, and calculate the rate of change of the density of the scattering center between the multiple consecutive frames. The skeleton analysis module is used to extract the skeleton lines of the gray-white low-contrast region in each of several consecutive frames and calculate the change in the tortuosity of the fractal dimension of the skeleton lines between consecutive frames. The classification and discrimination module is used to input the rate of change and the change in tortuosity into the classifier, and output the discrimination result of whether the gray-white low-contrast area is a physical change area or a mold defect area.