Image recognition method and system for material type and capacity
By segmenting and gamma transforming the image of the storage bin of the fully automatic healthy drink machine, combined with a seasonal training model, the problem of decreased recognition accuracy caused by lighting and seasonal changes was solved, and highly accurate recognition of material type and capacity was achieved.
Patent Information
- Application Number
- CN202511104270.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-07
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2045-08-07
AI Technical Summary
The image recognition accuracy of fully automatic health drink machines decreases under different lighting environments and seasonal changes.
By segmenting the material images in the storage silo, obtaining superpixel blocks, analyzing the grayscale, gradient, and saturation information of the pixels, and dividing them into light-explosive, light-weak, and normal areas, gamma transform is used for image enhancement. The ResNet50 multi-task classification model is trained according to seasonal changes to identify material types and capacities.
The accuracy of material type and capacity identification has been improved, especially under different lighting environments and seasonal changes, with the identification accuracy reaching over 96%.
Smart Images

Figure CN120599528B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of material identification, and in particular to a method and system for image recognition of material type and capacity. Background Art
[0002] The fully automatic healthy drink machine obtains beverages by extracting materials from the storage bin; however, the materials in the storage bin need to be checked regularly by people, which requires a lot of manpower; therefore, in order to reduce manpower consumption, images are collected by cameras for image recognition monitoring, that is, the image recognition of the type and capacity of materials in the storage bin of the fully automatic healthy drink machine is carried out by training the model through a deep learning algorithm, and the image recognition of the type and capacity of materials is performed through the model; however, in actual scenarios, the fully automatic healthy drink machine is generally installed in shopping malls or supermarkets. When collecting images for recognition, due to the influence of light, there are light bursts and weak light in the collected images; therefore, in order to avoid the influence of light bursts and weak light on the image, the image needs to be enhanced for different areas; and the types of materials stored in the storage bin of the fully automatic healthy drink machine are different in different seasons. Therefore, when training the model, it will be carried out separately for different seasons to improve the reliability of the model. Summary of the Invention
[0003] The present invention provides a method and system for image recognition of material type and capacity, which are used to solve the problem that the image recognition accuracy of existing fully automatic healthy drink machines decreases under different lighting environments and seasonal changes.
[0004] The purpose of the present invention can be achieved through the following technical solutions:
[0005] The first aspect of the present invention is to provide an image recognition method for material type and capacity, comprising:
[0006] Acquire images of materials in the storage bin of a fully automatic healthy drink machine;
[0007] The storage bin material image is segmented to obtain several superpixel blocks; the grayscale information, gradient information and saturation information of the pixel points in the storage bin material image are obtained; the similarity between any two adjacent superpixel blocks is obtained based on the grayscale information, gradient information and saturation information of the pixel points in any two adjacent superpixel blocks; region growth is performed on all superpixel blocks based on the similarity between any two adjacent superpixel blocks to obtain several regions in each storage bin material image; a coordinate system is constructed with grayscale value, gradient value and saturation as an axis respectively; all regions are mapped to the coordinate system based on the grayscale information, gradient information and saturation information of all pixels in each region to obtain several points; all points are clustered to obtain several clusters; and all regions are divided into light-exposure regions, light-weak regions and normal regions by analyzing the clusters;
[0008] Determining a gamma value of each light burst area or light weak area during gamma transformation according to a grayscale difference between each light burst area or light weak area and all normal areas; enhancing the storage bin material image according to the gamma value to obtain an enhanced storage bin material image, including:
[0009] The gamma value of each light burst area during gamma transformation is specifically expressed by the formula:
[0010]
[0011] The gamma value of each weak light area during gamma conversion is specifically expressed by the formula:
[0012]
[0013] Where, Represents the average grayscale value of all pixels in each light burst area, Represents the average gray value of all pixels in all normal areas, Represents the average grayscale value of all pixels in each weak light area, represents the linear normalization function, Indicates the gamma value of each light burst area during gamma transformation. Indicates the gamma value of each weak light area during gamma transformation. Indicates the absolute value symbol;
[0014] According to the gamma value of each light-explosion area or light-weak area during gamma transformation, all light-explosion areas and light-weak areas are enhanced by gamma transformation to obtain an enhanced image of the storage bin material;
[0015] Based on the enhanced silo material images, training is performed for each quarter to obtain a training model for each quarter; the material type and capacity are identified through the training model for each quarter.
[0016] Furthermore, the method of segmenting the material image of the storage bin to obtain a plurality of super pixel blocks and obtaining the grayscale information, gradient information and saturation information of the pixel points in the material image of the storage bin includes:
[0017] The material image of the storage bin is divided into several super-pixel blocks using the super-pixel segmentation algorithm;
[0018] The storage bin material image is grayscaled to obtain the storage bin material grayscale map; then the image of the storage bin material image in the HSV color space is obtained, which is recorded as the material HSV map; the grayscale information and gradient information of each pixel point are obtained through the storage bin material grayscale map, and the saturation information of each pixel point is obtained through the material HSV map.
[0019] Furthermore, obtaining the similarity between any two adjacent superpixel blocks based on the grayscale information, gradient information, and saturation information of the pixels in any two adjacent superpixel blocks includes:
[0020]
[0021] Where, Indicates the The average gray value of all pixels in a superpixel block, Indicates the The average gray value of all pixels in a superpixel block, Indicates the The average gradient value of all pixels in a superpixel block, Indicates the The average gradient value of all pixels in a superpixel block, Indicates the The average saturation of all pixels in a superpixel block, Indicates the The average saturation of all pixels in a superpixel block, Indicates the absolute value symbol, represents the grayscale weight coefficient, represents the gradient weight coefficient, represents the saturation weight coefficient, represents an exponential function with a natural constant as the base, Indicates the superpixel blocks and The similarity between superpixel blocks.
[0022] Furthermore, the region growing is performed on all super pixel blocks according to the similarity between any two adjacent super pixel blocks to obtain several regions in each storage bin material image, including:
[0023] Random selection The super pixel blocks are used as seed points, and the similarity between any two adjacent super pixel blocks is used as the growth criterion to merge the super pixel blocks to obtain several merged regions;
[0024] in, The preset quantity.
[0025] Furthermore, the grayscale value, gradient value, and saturation are used as axes to construct a coordinate system; all regions are mapped to the coordinate system based on the grayscale information, gradient information, and saturation information of all pixels in each region to obtain a plurality of points; all points are clustered to obtain a plurality of clusters; and by analyzing the clusters, all regions are divided into light-exposure regions, light-weak regions, and normal regions, including:
[0026] Obtain the average grayscale value, average gradient value, and average saturation of all pixels in each region; map all regions to a coordinate system based on the average grayscale value, average gradient value, and average saturation of all pixels in each region to obtain several points; cluster all points in the coordinate system using the K-means clustering algorithm to obtain three clusters;
[0027] The area corresponding to the points in the cluster with the largest average grayscale value among the three clusters is recorded as the light explosion area; the area corresponding to the points in the cluster with the smallest average grayscale value among the three clusters is recorded as the light weak area; and the area corresponding to the points in the remaining cluster is recorded as the normal area.
[0028] Furthermore, the method of training each quarter based on the enhanced storage bin material image to obtain a training model for each quarter; identifying the type and capacity of materials using the training model for each quarter includes:
[0029] Based on the enhanced silo material images, a dataset for each quarter is constructed. The ResNet50 multi-task classification model is trained using each quarter's dataset to obtain a training model for each quarter. The training model for each quarter is used to identify the material type and capacity.
[0030] The second aspect of the present invention is to provide an image recognition system for material types and capacities, including an image acquisition module, a region division module, an image enhancement module, and a model training and image recognition module. When the image acquisition module, the region division module, the image enhancement module, and the model training and image recognition module are executed, an image recognition method for the material type and capacity is implemented.
[0031] The third aspect of the present invention is to provide an electronic device, including a memory, a processor, and a computer program stored in the memory and runnable on the processor, wherein the processor implements the image recognition method of the material type and capacity when executing the computer program.
[0032] A fourth aspect of the present invention is to provide a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the image recognition method for the material type and capacity is implemented.
[0033] Compared with the prior art, the beneficial effects of the present invention are as follows: segmenting the image of the material in the storage bin to obtain several super-pixel blocks; obtaining the similarity between any two adjacent super-pixel blocks based on the grayscale information, gradient information and saturation information of the pixel points in any two adjacent super-pixel blocks, thereby improving the accuracy of the similarity analysis between adjacent super-pixel blocks; performing regional growth on all super-pixel blocks based on the similarity between any two adjacent super-pixel blocks to obtain several regions in each material image of the storage bin, thereby improving the accuracy of distinguishing the regions affected by light; constructing a coordinate system with grayscale value, gradient value and saturation as an axis respectively; mapping all regions to the coordinate system based on the grayscale information, gradient information and saturation information of all pixel points in each region to obtain several points; clustering all points to obtain several clusters; Cluster analysis is performed to divide all areas into light-explosive areas, light-weak areas, and normal areas; the accuracy of determining different areas is improved by mapping the areas; the gamma value of each light-explosive area or light-weak area during gamma transformation is determined based on the grayscale difference between each light-explosive area or light-weak area and all normal areas; the image of the material in the storage bin is enhanced based on the gamma value to obtain an enhanced image of the material in the storage bin; the accuracy of parameter value quantification during image enhancement is improved; each quarter is trained based on the enhanced image of the material in the storage bin to obtain a training model for each quarter; the training model for each quarter is used to identify the type and capacity of the material, thereby solving the problem of decreased image recognition accuracy of the existing fully-automatic healthy drink machine under different lighting environments and seasonal changes, that is, improving the accuracy of material type and capacity recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0035] Figure 1The present invention provides a schematic flow chart of the steps of a method for image recognition of material type and capacity;
[0036] Figure 2 The present invention provides a module flow diagram of a material type and capacity image recognition system. DETAILED DESCRIPTION
[0037] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0038] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0039] In response to the problems existing in the background technology, a method and system for image recognition of material type and capacity is studied and designed, which has important practical significance.
[0040] like Figure 1 As shown, the first aspect of the present invention is to provide an image recognition method for material type and capacity, comprising the following steps:
[0041] Step S001: Capturing images of materials in a storage bin of a fully automatic healthy beverage machine.
[0042] It should be noted that in order to identify the type and capacity of materials in the storage bin of the fully automatic healthy drink machine, it is necessary to collect a large number of material images in the storage bin of the fully automatic healthy drink machine. By identifying and processing the material images in the storage bin of the fully automatic healthy drink machine, the type and capacity of materials in the storage bin of the medicinal drink machine can be obtained. The type and capacity of the materials can be determined through image recognition to remind the staff to add relevant materials.
[0043] Specifically, a high-definition camera is installed near the storage bin of the fully automatic healthy drink machine, and a large number of images of the materials in the storage bin are collected by the high-definition camera.
[0044] It should be further explained that, since there are 10 storage bins for storing materials on the fully automatic healthy drink machine, in order to enable the deep learning model to well identify the type of each material, when collecting and determining the data set, it is ensured that each material type in the data set is balanced; and in this embodiment, four categories are determined for the capacity of the material, so when collecting images, the number of collected material capacity categories should also be balanced.
[0045] At this point, several images of storage bin materials are obtained.
[0046] Step S002: Analyze the image of the material in the storage bin to divide the areas affected by light into different areas.
[0047] It should be noted that fully automatic health drink machines are typically installed indoors in supermarkets, with each silo storing a single type of material, such as polygonatum, Chinese yam, and astragalus root. Directly capturing images of the silo materials indoors can be susceptible to interference, resulting in overexposure or underexposure, due to uneven indoor lighting or the influence of glass. Therefore, preprocessing and enhancement of the silo material images is necessary.
[0048] It should be further explained that, since different areas of the material image in the storage bin are affected differently by light under the above environment, the overexposed area, underexposed area and normal area are first determined based on the image features, and adjustments and enhancements are made separately based on the actual conditions of the pixels in each area.
[0049] Specifically, the material image of the storage bin is segmented into a number of super-pixel blocks using a super-pixel segmentation algorithm; wherein, the super-pixel segmentation algorithm is a well-known technology and will not be described in detail here.
[0050] It should be noted that in order to further aggregate the information features of the super-pixel blocks into three category areas, the information features of all super-pixel blocks are clustered to obtain overexposed areas, underexposed areas, and normal areas.
[0051] It should be further explained that the brightness of the light explosion area is excessive, exceeding the display range, resulting in loss of details, partial areas being pure white, color distortion, and low saturation; the brightness of the weak light area is too low, failing to be correctly exposed, resulting in loss of details, partial areas being pure black, details being unrecognizable, and low saturation; while the brightness of the normal area is appropriate and within a reasonable exposure range, with clear details and moderate saturation.
[0052] Specifically, the image of the storage bin material is grayscaled to obtain a grayscale image of the storage bin material; then, an image of the storage bin material image in the HSV color space is obtained, which is recorded as the material HSV image; wherein, the process of grayscaleing the storage bin material image and obtaining the image of the storage bin material image in the HSV (Hue-Saturation-Value) color space is a well-known technology and will not be described in detail here.
[0053] The grayscale information and gradient information of each pixel point are obtained from the grayscale image of the storage bin material, and the saturation information of each pixel point is obtained from the material HSV image. The similarity between any two adjacent superpixel blocks is obtained based on the grayscale information, gradient information, and saturation information of the pixels in any two adjacent superpixel blocks. The similarity between any two adjacent superpixel blocks is specifically expressed by the formula:
[0054]
[0055] Where, Indicates the The average gray value of all pixels in a superpixel block, Indicates the The average gray value of all pixels in a superpixel block, Indicates the The average gradient value of all pixels in a superpixel block, Indicates the The average gradient value of all pixels in a superpixel block, Indicates the The average saturation of all pixels in a superpixel block, Indicates the The average saturation of all pixels in a superpixel block, Indicates the absolute value symbol, represents the grayscale weight coefficient, represents the gradient weight coefficient, represents the saturation weight coefficient, represents an exponential function with a natural constant as the base, Indicates the superpixel blocks and The similarity between super pixel blocks. In this embodiment, the grayscale weight coefficient , gradient weight coefficient , saturation weight coefficient , in this embodiment 、 as well as There is no specific limitation, and the implementer can decide according to the specific situation. superpixel blocks and superpixel blocks are adjacent superpixel blocks.
[0056] in, Indicates the superpixel blocks and The difference in average grayscale values between superpixel blocks is the smaller the difference, the greater the similarity between the two adjacent superpixel blocks; otherwise, the smaller the similarity between the two adjacent superpixel blocks. Indicates the superpixel blocks and The difference in the average gradient value between the super pixel blocks is smaller. The smaller the difference, the greater the similarity between the two adjacent super pixel blocks. Conversely, the smaller the similarity between the two adjacent super pixel blocks. Indicates the superpixel blocks and The smaller the difference is, the greater the similarity between the two adjacent super-pixel blocks is; otherwise, the smaller the similarity is.
[0057] Random selection The superpixel blocks are used as seed points, and the similarity between any two adjacent superpixel blocks is used as the growth criterion to merge the superpixel blocks to obtain several merged regions. is a preset number. In this embodiment , in this embodiment, the preset number There is no specific limitation, and the implementer may determine it according to the specific situation. The region growing algorithm is a well-known technology and will not be described in detail here.
[0058] So far, several regions in the material image of each storage bin have been obtained through the above method.
[0059] A coordinate system is constructed using grayscale value, gradient value, and saturation as axes, respectively. The average grayscale value, average gradient value, and average saturation of all pixels in each region are obtained. Based on the average grayscale value, average gradient value, and average saturation of all pixels in each region, all regions are mapped into the coordinate system to obtain a number of points. All points in the coordinate system are clustered using the K-means clustering algorithm to obtain a number of clusters. In this embodiment, there are three clusters, corresponding to light bursts, low light conditions, and normal illumination. The K-means clustering algorithm is well known and will not be described in detail here.
[0060] The area corresponding to the points in the cluster with the largest average grayscale value among the three clusters is recorded as the light explosion area; the area corresponding to the points in the cluster with the smallest average grayscale value among the three clusters is recorded as the light weak area; and the area corresponding to the points in the remaining cluster is recorded as the normal area.
[0061] So far, the light explosion area, the light weak area and the normal area are obtained through the above method.
[0062] Step S003: determining a gamma value of each light-explosion area or light-weak area during gamma transformation based on the grayscale difference between each light-explosion area or light-weak area and all normal areas; enhancing the storage bin material image based on the gamma value to obtain an enhanced storage bin material image.
[0063] It should be noted that since the light explosion area, the weak light area and the normal area are affected by light differently, the coefficients are adjusted and enhanced for different areas.
[0064] It should be further explained that when using gamma transformation for image enhancement, the gamma value is determined arbitrarily; when enhancing a low-light area, a gamma value less than 1 is used for the transformation, when enhancing a light-explosive area, a gamma value greater than 1 is used for the transformation, and when enhancing a normal area, a gamma value equal to 1 is used for the transformation; however, the enhancement amplitude when enhancing the low-light area and the light-explosive area is unknown, so it is necessary to use the difference between the low-light area and the light-explosive area and the normal area for analysis.
[0065] Specifically, the gamma value of each light burst area or light weak area during gamma transformation is determined according to the grayscale difference between each light burst area or light weak area and all normal areas. The gamma value of each light burst area or light weak area during gamma transformation is specifically expressed by the formula:
[0066]
[0067]
[0068] Where, Represents the average grayscale value of all pixels in each light burst area, Represents the average gray value of all pixels in all normal areas, Represents the average grayscale value of all pixels in each weak light area, represents the linear normalization function, Indicates the gamma value of each light burst area during gamma transformation. Indicates the gamma value of each weak light area during gamma transformation. Indicates the absolute value symbol.
[0069] in, Indicates the difference between the average grayscale value of all pixels in each light burst area and the average grayscale value of all pixels in all normal areas. The larger the difference, the greater the exposure of the light burst area, and the larger the gamma value is required for enhancement; conversely, the smaller the difference, the smaller the gamma value is required for enhancement. It represents the difference between the average grayscale value of all pixels in each low-light area and the average grayscale value of all pixels in all normal areas. The larger the difference, the darker the low-light area, and the smaller the gamma value is required for enhancement; conversely, the larger the difference, the larger the gamma value is required for enhancement.
[0070] According to the gamma value of each light-explosive area or light-weak area during gamma transformation, all light-explosive areas and light-weak areas are enhanced using gamma transformation to obtain an enhanced storage bin material image; the normal area is not enhanced.
[0071] At this point, the enhancement of the storage silo material image is completed through the above method.
[0072] Step S004: training each quarter based on the enhanced silo material image to obtain a training model for each quarter; identifying the material type and capacity using the training model for each quarter.
[0073] It should be noted that since there are 10 cylindrical storage bins on the fully automatic healthy drink machine, the materials stored in the storage bins on the fully automatic healthy drink machine may be different in different seasons. Therefore, in order to ensure high robustness when training the model, it is necessary to ensure that the data collected from the 10 storage bins is balanced when collecting data.
[0074] Furthermore, to build a highly robust and accurate deep learning model for material type and capacity identification, 10 categories of materials with varying shapes, colors, and textures are included to ensure the model can distinguish a wide range of materials. Four capacity levels (empty, less, have, and unknown) are defined, enabling the model to not only determine the presence of materials but also identify intermediate states and abnormal conditions, thereby accurately triggering restocking alerts or exception handling. Over 200 images are collected for each category, covering diverse lighting, angles, distributions, and interference scenarios. This meets the fundamental data volume and diversity requirements of deep learning models, avoids overfitting, and improves generalization. Furthermore, the classification task design (rather than regression) is more suitable for the stability requirements of industrial scenarios, while the unknown category enhances the system's fault tolerance to abnormal conditions. This approach balances data acquisition costs, model performance, and engineering feasibility, laying the data foundation for subsequent seasonal menu expansion and model iteration. The four capacity levels—empty, less, have, and unknown—stand for empty, small amount, sufficient, and unknown, respectively.
[0075] In this embodiment, a multi-task classification model based on ResNet50 (50-layer residual network) is used to identify material type and capacity images. The loss function in this multi-task classification model consists of two parts: one for material type classification and the other for capacity level classification. Both the material type classification loss function and the capacity level classification loss function are cross-entropy loss functions. The cross-entropy loss function is well known and will not be described in detail here. The ResNet50 multi-task classification model was developed using the TensorFlow 2.x deep learning framework.
[0076] It should be noted that due to different demands and preferences for different foods in different seasons, the storage bins of the fully automatic healthy drink machines in supermarkets store different materials in different seasons. Therefore, different training models are needed for recognition in different seasons.
[0077] Specifically, we used the enhanced silo material images described above to construct a dataset for each quarter. We then trained a ResNet50 multi-task classification model using each dataset to obtain a training model for each quarter. The trained model was then used to identify material type and capacity. During model training, the ratio of the training set to the test set was 8:2.
[0078] Among them, the recognition accuracy of the model trained every quarter is greater than or equal to 96% when identifying material types, and the recognition accuracy of the model trained every quarter is greater than or equal to 98% when identifying material capacity levels; among them, the entire process time from the camera capturing a frame of image to outputting the recognition result (type + capacity) is within 100 milliseconds.
[0079] At this point, this embodiment is completed.
[0080] like Figure 2 As shown, the second aspect of the present invention is to provide an image recognition system for material types and capacities, including an image acquisition module 101, a region division module 102, an image enhancement module 103, and a model training and image recognition module 104. When the image acquisition module 101, the region division module 102, the image enhancement module 103, and the model training and image recognition module 104 are executed, a method for image recognition of material types and capacities is implemented.
[0081] The third aspect of the present invention is to provide an electronic device, including a memory, a processor, and a computer program stored in the memory and runnable on the processor. When the processor executes the computer program, it implements an image recognition method for material type and capacity.
[0082] A fourth aspect of the present invention is to provide a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements an image recognition method for material type and capacity.
[0083] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, optical storage, etc.) containing computer-usable program code.
[0084] The present invention is described with reference to flowcharts and / or block diagrams of methods, systems, and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0085] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0086] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0087] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered by the scope of protection of the present invention.
Claims
1. A method for image recognition of material type and capacity, characterized in that: include: Acquire images of materials in the storage bin of a fully automatic healthy drink machine; Segment the image of the material in the storage bin to obtain several superpixel blocks; Obtain the grayscale information, gradient information, and saturation information of the pixels in the storage bin material image; obtain the similarity between any two adjacent superpixel blocks based on the grayscale information, gradient information, and saturation information of the pixels in any two adjacent superpixel blocks; perform region growth on all superpixel blocks based on the similarity between any two adjacent superpixel blocks to obtain several regions in each storage bin material image; construct a coordinate system with the grayscale value, gradient value, and saturation as an axis respectively; map all regions to the coordinate system based on the grayscale information, gradient information, and saturation information of all pixels in each region to obtain several points; cluster all points to obtain several clusters; and divide all regions into light-exposure regions, light-weak regions, and normal regions by analyzing the clusters; Determine the gamma value of each light burst area or light weak area during gamma conversion according to the grayscale difference between each light burst area or light weak area and all normal areas; The method includes enhancing the image of the material in the storage bin according to the gamma value to obtain an enhanced image of the material in the storage bin, including: The gamma value of each light burst area during gamma transformation is specifically expressed by the formula: The gamma value of each weak light area during gamma conversion is specifically expressed by the formula: Where, Represents the average grayscale value of all pixels in each light burst area, Represents the average gray value of all pixels in all normal areas, Represents the average grayscale value of all pixels in each weak light area, represents the linear normalization function, Indicates the gamma value of each light burst area during gamma transformation. Indicates the gamma value of each weak light area during gamma transformation. Indicates the absolute value symbol; According to the gamma value of each light-explosion area or light-weak area during gamma transformation, all light-explosion areas and light-weak areas are enhanced by gamma transformation to obtain an enhanced image of the storage bin material; Based on the enhanced silo material images, training is performed for each quarter to obtain a training model for each quarter; the material type and capacity are identified through the training model for each quarter.
2. The image recognition method for material type and capacity according to claim 1, characterized in that: The material image of the storage bin is segmented to obtain a plurality of super pixel blocks; Obtain the grayscale information, gradient information, and saturation information of the pixels in the storage bin material image, including: The material image of the storage bin is divided into several super-pixel blocks using the super-pixel segmentation algorithm; The storage bin material image is grayscaled to obtain the storage bin material grayscale map; then the image of the storage bin material image in the HSV color space is obtained, which is recorded as the material HSV map; the grayscale information and gradient information of each pixel point are obtained through the storage bin material grayscale map, and the saturation information of each pixel point is obtained through the material HSV map.
3. The image recognition method for material type and capacity according to claim 1, characterized in that: The obtaining of the similarity between any two adjacent superpixel blocks based on the grayscale information, gradient information, and saturation information of the pixel points in any two adjacent superpixel blocks includes: Where, Indicates the The average gray value of all pixels in a superpixel block, Indicates the The average gray value of all pixels in a superpixel block, Indicates the The average gradient value of all pixels in a superpixel block, Indicates the The average gradient value of all pixels in a superpixel block, Indicates the The average saturation of all pixels in a superpixel block, Indicates the The average saturation of all pixels in a superpixel block, Indicates the absolute value symbol, represents the grayscale weight coefficient, represents the gradient weight coefficient, represents the saturation weight coefficient, represents an exponential function with a natural constant as the base, Indicates the superpixel blocks and The similarity between superpixel blocks.
4. The image recognition method for material type and capacity according to claim 1, characterized in that: The method performs region growing on all super pixel blocks according to the similarity between any two adjacent super pixel blocks to obtain several regions in each storage bin material image, including: Random selection The super pixel blocks are used as seed points, and the similarity between any two adjacent super pixel blocks is used as the growth criterion to merge the super pixel blocks to obtain several merged regions; in, The preset quantity.
5. The image recognition method for material type and capacity according to claim 1, characterized in that: The grayscale value, gradient value, and saturation are used as axes to construct a coordinate system; according to the grayscale information, gradient information, and saturation information of all pixels in each area, all areas are mapped to the coordinate system to obtain a number of points; all points are clustered to obtain a number of clusters; By analyzing the clusters, all areas are divided into light-explosive areas, light-weak areas, and normal areas, including: Obtain the average grayscale value, average gradient value, and average saturation of all pixels in each region; map all regions to a coordinate system based on the average grayscale value, average gradient value, and average saturation of all pixels in each region to obtain several points; cluster all points in the coordinate system using the K-means clustering algorithm to obtain three clusters; The area corresponding to the points in the cluster with the largest average grayscale value among the three clusters is recorded as the light explosion area; the area corresponding to the points in the cluster with the smallest average grayscale value among the three clusters is recorded as the light weak area; and the area corresponding to the points in the remaining cluster is recorded as the normal area.
6. The image recognition method for material type and capacity according to claim 1, characterized in that: The method further comprises training each quarter based on the enhanced storage silo material image to obtain a training model for each quarter; Identify material types and volumes through quarterly training models, including: Based on the enhanced silo material images, a dataset for each quarter is constructed. The ResNet50 multi-task classification model is trained using each quarter's dataset to obtain a training model for each quarter. The training model for each quarter is used to identify the material type and capacity.
7. An image recognition system for material type and capacity, characterized in that: The method comprises an image acquisition module, a region division module, an image enhancement module, and a model training and image recognition module. When the image acquisition module, the region division module, the image enhancement module, and the model training and image recognition module are executed, the method for image recognition of material type and capacity as claimed in claim 1 is realized.
8. An electronic device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the image recognition method for material type and capacity as described in any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the image recognition method for material type and capacity as described in any one of claims 1 to 6.