A method and electronic device for identifying time marks of die castings based on machine vision

Through multi-step processing and convolutional neural network recognition by machine vision technology, the problem of weak anti-interference ability in the existing technology is solved, accurate and efficient identification of die casting time marking, and improved the traceability of production process and efficiency.

CN118658153BActive Publication Date: 2024-12-31DALIAN YAMING AUTOMOTIVE PARTS
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411149590.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-21
Publication Date
2024-12-31
Estimated Expiration
2044-08-21

AI Technical Summary

Technical Problem

Existing machine vision algorithms have weak anti-interference ability in die casting time identification, making it difficult to accurately identify fonts under complex light environments and material surfaces, resulting in inefficiency.

Method used

The time identification recognition method of die casting based on machine vision is adopted, and the production year is determined by acquiring images, horizontal correction, grayscale, recursive binarization processing, rotation correction and convolutional neural network recognition, combined with pre-trained models. Month, day and shift number.

Benefits of technology

It improves the accuracy and identification efficiency of time marking of die castings, reduces labor burden, and enhances the traceability and work efficiency of the production process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118658153B_ABST
    Figure CN118658153B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and electronic device for identifying time marks of die castings based on machine vision, and belongs to the field of image recognition technology. The method comprises: obtaining a die casting image to be processed; cutting out a plurality of time mark area images from the die casting image to be processed; horizontally correcting the plurality of time mark area images to obtain a plurality of corrected images; identifying the plurality of corrected images to obtain a plurality of target objects in each corrected image and the coordinates of each target object, wherein; according to the plurality of target objects in each corrected image, determining the information type of each corrected image; according to the information type of each corrected image and the plurality of target objects in each corrected image, determining the production time and production shift corresponding to the die casting image to be processed. The present invention is used to solve the technical problem that the existing recognition algorithm has weak anti-interference ability. The present invention is used to identify the time mark of die castings.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of image recognition, and in particular relates to a method and electronic equipment for identifying time marks of die castings based on machine vision. Background Art

[0002] In the die-casting production process, in order to ensure the shift traceability of die-castings, especially for the needs of later quality management, it is crucial to accurately identify and record the time marks on die-castings. Due to the large number of die-castings, it is inefficient to manually determine the production shifts of die-castings. With the development of machine vision technology, the recognition technology for image content has become relatively mature. At present, machine vision widely uses OCR (Optical Character Recognition) algorithms in digital text recognition. Although this technology is quite mature, its anti-interference ability is relatively weak, and it has certain requirements for light environment, material surface, font, and text incompleteness. Summary of the invention

[0003] An object of the present invention is to provide a method and electronic device for identifying time marks of die castings based on machine vision, which can solve the technical problem of weak anti-interference ability of machine vision algorithms in the prior art.

[0004] According to a first aspect of the present invention, a method for identifying time marks of die castings based on machine vision is provided, comprising:

[0005] Acquire an image of a die casting to be processed;

[0006] Extracting a plurality of time mark area images from the die casting image to be processed, wherein the time mark area images contain letters and / or numbers;

[0007] Performing horizontal correction on the multiple time mark area images to obtain multiple corrected images, wherein the corrected images correspond to the time mark area images one by one, and the letters and / or numbers in the corrected images are horizontal;

[0008] Identify the multiple corrected images to obtain multiple target objects in each of the corrected images and the coordinates of each of the target objects, wherein the target object is a single letter or a single number;

[0009] Determining the information type of each corrected image according to the multiple target objects in each corrected image, wherein the information type includes a year-month type and a date-shift type;

[0010] The production time and production shift corresponding to the die casting image to be processed are determined according to the information type of each corrected image and the multiple target objects in each corrected image.

[0011] Optionally, the horizontally correcting the multiple time-stamped area images to obtain multiple corrected images includes:

[0012] Gray-scale the time stamp region image to obtain a gray-scale image;

[0013] Cropping the central area of ​​the grayscale image to obtain a central area image;

[0014] Recursively binarizing the central area image to obtain a binary image;

[0015] Determining whether the longest straight line in the binary image satisfies an interruption condition, wherein the interruption condition is that the longest straight line is not at an edge of the binary image and the length of the longest straight line is greater than a length threshold;

[0016] If not, increase the binarization threshold and re-execute the step of binarizing the central area image;

[0017] If satisfied, determine the rotation angle and rotation direction for rotating the longest straight line to the horizontal;

[0018] The time mark area image is rotated according to the rotation angle and rotation direction, and the rotated image is identified positively and negatively through a pre-trained convolutional neural network, and the rotated image with a positive identification result is determined as a corrected image.

[0019] Optionally, determining the information type of each of the corrected images according to the multiple target objects in each of the corrected images includes:

[0020] If the number of the multiple target objects in the corrected image is four and the multiple target objects in the corrected image are all numbers, determining that the information type of the corrected image is a year-month type;

[0021] If the number of the multiple target objects in the corrected image is three and the multiple target objects in the corrected image include one letter and two numbers, it is determined that the information type of the corrected image is a date shift type.

[0022] Optionally, determining the production time and production shift corresponding to the die casting image to be processed according to the information type of each corrected image and the multiple target objects in each corrected image includes:

[0023] Determine the production year and production month corresponding to the die casting image to be processed according to multiple target objects in the year-month type corrected image;

[0024] Determine the production date and production shift corresponding to the die casting image to be processed according to multiple target objects in the corrected image of date and shift type;

[0025] The production time is determined according to the production year, production month and production day corresponding to the image of the die casting to be processed.

[0026] Optionally, the determining the production year and production month corresponding to the die casting image to be processed according to the multiple target objects in the corrected image of year and month type includes:

[0027] According to the coordinates of each number in the corrected image of the year and month type, four numbers in the corrected image of the year and month type are divided into two groups of numbers, wherein each group of numbers includes two numbers, and the difference between the Y-axis coordinates of the two numbers in each group of numbers is less than a first threshold value and the difference between the X-axis coordinates of the two numbers is less than a second threshold value, and the second threshold value is greater than the first threshold value;

[0028] Combine the two numbers in each group of numbers respectively to obtain two combination results corresponding to each group of numbers;

[0029] Get the current year and current month;

[0030] Determine a first target combination result according to the current year, wherein the first target combination result is the combination result closest to the current year among all combination results corresponding to the two groups of numbers;

[0031] Determine the first target combination result as the production year corresponding to the die casting image to be processed;

[0032] Determine a second target combination result according to the current month, wherein the second target combination result is a combination result that is closest to the current month among the two combination results corresponding to the target group numbers, and the target group numbers are a number group that is different from the number group corresponding to the first target combination result among the two groups of numbers;

[0033] The second target combination result is determined as the production month corresponding to the die casting image to be processed.

[0034] Optionally, the determining the production date and shift corresponding to the die casting image to be processed according to the multiple target objects in the corrected image of the date shift type includes:

[0035] Determine the letters in the plurality of target objects in the corrected image of the date shift type as the shift corresponding to the die casting image to be processed;

[0036] Combining two numbers in a plurality of target objects in the corrected image of the date and shift type to obtain two combination results corresponding to the corrected image of the date and shift type;

[0037] If one of the two combination results corresponding to the corrected image of the date shift type exceeds the preset date range, the other combination result of the two combination results corresponding to the corrected image of the date shift type is determined as the production date corresponding to the die casting image to be processed;

[0038] If the two combination results corresponding to the corrected image of the date shift type do not exceed the preset date range, the production date corresponding to the die casting image to be processed is determined according to the coordinates of multiple target objects in the corrected image of the date shift type.

[0039] Optionally, determining the production date corresponding to the die casting image to be processed according to the coordinates of a plurality of target objects in the corrected image of the date shift type includes:

[0040] If the Y-axis coordinate of the letter in the corrected image of the date shift type is greater than the Y-axis coordinate of the number in the corrected image of the date shift type, arrange the two numbers in the corrected image of the date shift type in ascending order of the X-axis coordinates, and determine the arrangement result as the production date corresponding to the die casting image to be processed;

[0041] If the Y-axis coordinate of the letter in the corrected image of the date shift type is smaller than the Y-axis coordinate of the number in the corrected image of the date shift type, arrange the two numbers in the corrected image of the date shift type in descending order of the X-axis coordinate, and determine the arrangement result as the production date corresponding to the die-casting image to be processed.

[0042] Optionally, after determining the production time and shift corresponding to the die casting image to be processed, the method further includes:

[0043] Get the current time;

[0044] If the production time corresponding to the die-casting image to be processed is after the current time, it is determined that the production time corresponding to the die-casting image to be processed is invalid.

[0045] Optionally, after acquiring the die casting image to be processed, the method further comprises:

[0046] Performing validity detection on the die-casting image to be processed to obtain a detection result, wherein the validity detection includes focus clarity detection, average brightness detection, and occlusion detection;

[0047] If the detection result is invalid, the die casting image to be processed is reacquired.

[0048] According to a second aspect of the present invention, an electronic device is provided, comprising a processor and a memory, wherein the memory stores a program executable by the processor, and when the program is executed by the processor, the method described in the first aspect of the present invention is implemented.

[0049] The beneficial effects of the present invention are: (1) saving the workload of manually determining the batch number. By introducing an automated die-casting time mark recognition system, the present invention effectively reduces the burden of manually determining the batch number and improves the efficiency of the production process; (2) improving the traceability of the entire process. The present invention adopts advanced image processing and character recognition technology to accurately and quickly extract the shift number information in the die-casting time mark. This helps to improve the traceability of the entire process and ensure the full control of product production; (3) improving work efficiency. The automated die-casting time mark recognition system not only reduces the manual burden, but also improves work efficiency throughout the entire process. By adopting optimized models and algorithms, the present invention achieves fast and accurate character recognition, thereby improving overall work efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 The present invention is a flowchart of a method for identifying time marks of die castings based on machine vision in one embodiment of the present invention.

[0051] Figure 2 It is a time stamp area image including the production year and production month in one embodiment of the present invention.

[0052] Figure 3 It is a time stamp area image including the production date and batch number in one embodiment of the present invention.

[0053] Figure 4 Schematic diagram of the horizontal correction process in one embodiment of the present invention.

[0054] Figure 5 It is a flow chart of a method for identifying time marks of die castings based on machine vision in another embodiment of the present invention. DETAILED DESCRIPTION

[0055] Various exemplary embodiments of the present invention will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangement of components and steps, numerical expressions and numerical values ​​set forth in these embodiments do not limit the scope of the present invention unless otherwise specifically stated.

[0056] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the invention, its application, or uses.

[0057] The techniques, methods and devices known to those of ordinary skill in the relevant art may not be discussed in detail, but where appropriate, the techniques, methods and devices should be considered as part of the specification. In all examples shown and discussed herein, any specific values ​​should be interpreted as merely exemplary and not as limiting. Therefore, other examples of the exemplary embodiments may have different values.

[0058] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.

[0059] In the specification and claims of the present invention, if the term "first" or "second" is involved, it may explicitly or implicitly include one or more of the features. In the description of the present invention, unless otherwise specified, "plurality" means two or more. In addition, "and / or" in the specification and claims means at least one of the connected objects, and the character " / " generally means that the related objects are in an "or" relationship.

[0060] In the die-casting production process, in order to ensure the shift traceability of die-castings, especially for the needs of later quality management, it is crucial to accurately identify and record the time marks on die-castings. Due to the large number of die-castings, it is inefficient to manually determine the production shifts of die-castings. With the development of machine vision technology, the recognition technology for image content has become relatively mature. At present, machine vision widely uses OCR algorithms in digital text recognition. Although this technology is quite mature, its anti-interference ability is relatively weak, and it has certain requirements for light environment, material surface, font, and text incompleteness.

[0061] like Figure 1 As shown, the present invention proposes a method for identifying time marks of die castings based on machine vision, including steps 1100-1600.

[0062] Step 1100: Acquire an image of a die-casting part to be processed.

[0063] The die casting can be photographed by a camera to obtain an image of the die casting to be processed, which includes the production date and production shift of the die casting.

[0064] Step 1200: extracting a plurality of time mark area images from the die casting image to be processed, wherein the time mark area images contain letters and / or numbers.

[0065] During the production process of die-casting parts, the production time and shift number will be die-cast on the die-casting parts through the die-casting process. The production time includes the production year, production month and production day. The production time is usually expressed in numbers, such as 20, 01, 25, where 20 represents the production year, 01 represents the production month, and 25 represents the production day, which means that the production time of the die-casting part is January 25, 2020. The shift number is usually expressed in letters, such as letter A and letter B. Usually the production year and production month are in the same area, while the production day and shift number are in another area. The time stamp area image includes an image containing the production year and production month, and an image containing the production day and shift number. For example, the yolov8l target detection model can be used to intercept the time stamp area image.

[0066] Each die-casting area corresponds to a time stamp area image, for example, a die-casting area containing the production year and production month corresponds to a time stamp area image, and a die-casting area containing the production day and shift number corresponds to another time stamp area image. The time stamp area image contains two sets of data, which can be numbers or letters.

[0067] like Figure 2 As shown, for the time stamp area image containing the production year and production month, it contains a group of numbers corresponding to the production year and a group of numbers corresponding to the production month. Figure 3 As shown, for the time stamp area image including the production date and the production shift, a group of numbers corresponding to the production date and letters corresponding to the production shift are included. For easy identification, a straight line for dividing the two groups of data is also die-cast in the time stamp area image.

[0068] Step 1300: Perform horizontal correction on the multiple time mark area images to obtain multiple corrected images, wherein the corrected images correspond to the time mark area images one by one, and the letters and / or numbers in the corrected images are horizontal.

[0069] Due to the problem of shooting angle, the letters and numbers in the time stamp area image may be in a tilted state, which is not conducive to recognition. In order to facilitate recognition, the time stamp area image is horizontally corrected so that the letters and numbers in the corrected image are in a horizontal state. For example, the time stamp area image can be rotated so that the letters and numbers are in a horizontal state.

[0070] Step 1400: Identify the multiple corrected images to obtain multiple target objects in each of the corrected images and the coordinates of each of the target objects, wherein the target object is a single letter or a single number.

[0071] Each rectified image is recognized separately, the letters and numbers in the rectified image are identified, and the coordinates of each letter and number are obtained. Specifically, the improved yolov8l model can be used for recognition, which introduces the VanillaNet architecture based on the original yolov8l model. The model contains only 6 convolutional layers, making it very easy to use on any modern hardware. In each stage, the size of the input features is downsampled and the number of channels is doubled. This design enables the model to better capture the features and contextual information in the image while maintaining high efficiency. This simple and powerful structure helps to improve the computational efficiency of the model.

[0072] Input the corrected image into the model, and the model will return the information of each class that can be recognized in the image, including the coordinates and the name of the class. The coordinates include the coordinates of the upper left corner and the lower right corner of the bounding box, and the target object to be recognized is within the bounding box. The name of the class is the different classifications for the recognition object set before the model is trained. In this embodiment, since it is necessary to recognize the time represented by numbers and the shift number represented by letters, 12 different class names are used in this embodiment, including 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, A, and B.

[0073] Step 1500: Determine the information type of each corrected image according to the multiple target objects in each corrected image, wherein the information type includes a year-month type and a date-shift type.

[0074] The information type of the corrected image can be determined according to the type of the target object. The multiple target objects in the corrected image of the year-month type are used to represent the production year and production month of the die casting, so the multiple target objects in the corrected image of the year-month type are all numbers. The multiple target objects in the corrected image of the date-shift type are used to represent the production date and production shift of the die casting, so the multiple target objects in the corrected image of the date-shift type contain both numbers and letters.

[0075] Specifically, if the number of the multiple target objects in the corrected image is four and the multiple target objects in the corrected image are all numbers, it is determined that the information type of the corrected image is a year-month type.

[0076] In the die casting process, two digits are usually used to indicate the production year of the die casting, such as the number "22" indicates the production year is 2022. Two digits are also used to indicate the production month of the die casting, such as the number "12" indicates the production month is December. For the rectified image containing the production year and production month, four digits are included.

[0077] If the number of the multiple target objects in the corrected image is three and the multiple target objects in the corrected image include one letter and two numbers, it is determined that the information type of the corrected image is a date shift type.

[0078] In the die casting process, two numbers are usually used to indicate the production date of the die casting. For example, the number "14" means that the production date of the die casting is the 14th of a certain month. The production shift is usually indicated by a letter. For the corrected image containing the production date and production shift, two numbers and a letter are included.

[0079] Step 1600: Determine the production time and production shift corresponding to the die casting image to be processed according to the information type of each corrected image and the multiple target objects in each corrected image.

[0080] The corrected image with information type of year and month is used to determine the production year and month of the die casting, and the corrected image with information type of date and shift is used to determine the production day and shift of the die casting. After obtaining the production year, production month and production day, they are combined to obtain the production time of the die casting.

[0081] In this embodiment, step 1300 includes steps 1310-1370.

[0082] Step 1310: grayscale the time stamp region image to obtain a grayscale image.

[0083] The die casting image to be processed taken by the camera is a color image, and the time mark area image intercepted from the die casting image to be processed is also a color image. The color time mark area image is grayed to obtain a grayed image. The graying process helps to simplify subsequent processing steps and improve calculation efficiency.

[0084] Step 1320: crop the central area of ​​the grayscale image to obtain a central area image.

[0085] The center of the grayscale image can be cropped according to a preset ratio to obtain the center area image. Figure 4 As shown, the central area image contains partial areas of two sets of data and partial areas of the straight line used for segmentation.

[0086] Step 1330: binarize the central area image to obtain a binary image.

[0087] like Figure 4 As shown, the center area image is converted into a black and white image through binarization processing. In the binarization process, the grayscale of pixels greater than the threshold is set to 255, and the grayscale of pixels less than the threshold is set to 0.

[0088] Step 1340: Determine whether the longest straight line in the binary image satisfies an interruption condition, wherein the interruption condition is that the longest straight line is not at the edge of the binary image and the length of the longest straight line is greater than a length threshold.

[0089] Step 1350: If not satisfied, increase the binarization threshold and re-execute the step of binarizing the central area image.

[0090] If the interruption condition is not met, then increase the threshold in the binarization process and re-binarize the center area image. During the iteration process, as the binarization threshold continues to increase, the white area in the binary image will gradually decrease and the black area will gradually increase. When the white area is reduced to a certain extent, the straight line will meet the interruption condition.

[0091] Step 1360: If satisfied, determine the rotation angle and direction for rotating the longest straight line to the horizontal direction.

[0092] You can rotate a line clockwise to horizontal or counterclockwise to horizontal. The sum of the clockwise and counterclockwise rotation angles is 180 degrees. For example, if you rotate a line 60 degrees clockwise to horizontal, you can rotate it 120 degrees counterclockwise to horizontal.

[0093] Step 1370: Rotate the time stamp area image according to the rotation angle and rotation direction, perform positive and negative recognition on the rotated image through a pre-trained convolutional neural network, and determine the rotated image with a positive recognition result as a corrected image.

[0094] like Figure 4 As shown, the numbers or letters in the rotated image may be in a positive state or in a reverse state. If the recognition result is positive, it means that the numbers or letters in the rotated image are in a positive state, and if the recognition result is negative, it means that the numbers or letters in the rotated image are in a reverse state.

[0095] The pre-trained convolutional neural network is used to perform positive and negative recognition, and the rotated images with positive recognition results are retained as the corrected images.

[0096] This embodiment performs horizontal correction on the time stamp area image so that the numbers or letters in the corrected image are in a correct position, which facilitates the subsequent recognition of the numbers and letters in the corrected image and improves efficiency.

[0097] In this embodiment, step 1600 includes steps 1610-1630.

[0098] Step 1610: Determine the production year and production month corresponding to the die casting image to be processed according to the multiple target objects in the corrected image of year and month type.

[0099] The step 1610 includes steps 1611-1617.

[0100] Step 1611: According to the coordinates of each number in the corrected image of the year and month type, the four numbers in the corrected image of the year and month type are divided into two groups of numbers, wherein each group of numbers includes two numbers, and the difference between the Y-axis coordinates of the two numbers in each group of numbers is less than a first threshold and the difference between the X-axis coordinates of the two numbers is less than a second threshold, and the second threshold is greater than the first threshold.

[0101] The coordinates of each number include the upper left corner coordinates and the lower right corner coordinates of the bounding box corresponding to the number. The upper left corner coordinates or the lower right corner coordinates can be uniformly selected for calculation.

[0102] The year-month type corrected image contains four numbers, which are divided into two parts by a straight line. There are two numbers above the straight line and two numbers below the straight line. The Y-axis coordinates of the two numbers above the straight line are relatively close, and the Y-axis coordinates of the two numbers below the straight line are relatively close. The Y-axis coordinate of the number above the straight line is quite different from the Y-axis coordinate of the number below the straight line.

[0103] For example, the coordinates of four numbers are (100, 100), (100, 400), (400, 100), and (400, 400). Then the number with coordinates (100, 100) and the number with coordinates (400, 100) are identified as one group, and the number with coordinates (100, 400) and the number with coordinates (400, 400) are identified as another group.

[0104] Step 1612: Combine two numbers in each group of numbers respectively to obtain two combination results corresponding to each group of numbers.

[0105] For example, a group of numbers consisting of the numbers "2" and "4" can be combined into two combinations, namely "24" and "42".

[0106] Step 1613: Get the current year and the current month.

[0107] Step 1614: Determine a first target combination result based on the current year, wherein the first target combination result is the combination result closest to the current year among all combination results corresponding to the two groups of numbers.

[0108] The production time of die casting on the surface of die casting is close to the current time. By comparing all the combination results with the current year, the closest combination result is determined.

[0109] For example, the current year is 2024. One set of numbers is "2" and "4", and the corresponding two combination results are "24" and "42". Another set of numbers is "1" and "2", and the corresponding two combination results are "12" and "21". Among all the combination results, the combination result "24" is closest to the current year 2024, so the combination result "24" is determined as the first target combination result.

[0110] Usually, the production year on the surface of the die-casting is the current year. However, in the scenario where the year changes at the beginning of January, the production year on the surface of the die-casting may be inconsistent with the current year. For example, if the workpiece is die-cast on December 31, 2023, then the production year of the die-casting surface is 2023, represented by the number "23". The time for identifying the production time on the surface of the die-casting is January 4, 2024, and the current year is 2024, which is inconsistent with the production year on the surface of the die-casting. By determining the combination result that is closest to the current year, the problem of the production year on the surface of the die-casting being inconsistent with the current year is avoided.

[0111] Step 1615: Determine the first target combination result as the production year corresponding to the die casting image to be processed.

[0112] Step 1616: Determine a second target combination result based on the current month, wherein the second target combination result is the combination result that is closest to the current month among the two combination results corresponding to the target group numbers, and the target group numbers are a number group that is different from the number group corresponding to the first target combination result among the two groups of numbers.

[0113] After the first target combination result is determined, since one set of numbers corresponding to the first target combination result corresponds to the production year, the other set of numbers corresponds to the production month. The two combination results of the other set of numbers are compared with the current month to determine the combination result closest to the current month.

[0114] For example, if the current month is December, and the two combination results of another set of numbers are "12" and "21", the combination result "12" is closest to the current month December, so the combination result "12" is determined as the second target combination result.

[0115] Step 1617: Determine the second target combination result as the production month corresponding to the die casting image to be processed.

[0116] Similar to the problem that the production year on the surface of the die casting is inconsistent with the current year, the production month on the surface of the die casting may also be inconsistent with the current month. The combination result closest to the current month is determined in the above manner as the production month of the die casting.

[0117] Step 1620: Determine the production date and shift corresponding to the die casting image to be processed according to the multiple target objects in the corrected image of the date and shift type.

[0118] In this embodiment, step 1620 includes steps 1621-1624.

[0119] Step 1621: Determine the letters in the multiple target objects in the corrected image of the date shift type as the shift corresponding to the die casting image to be processed.

[0120] The corrected image of the Date Shift type contains a letter and two numbers, where the letter represents the production shift of the die casting.

[0121] Step 1622: Combine two numbers in multiple target objects in the corrected image of the date and shift type to obtain two combination results corresponding to the corrected image of the date and shift type.

[0122] For example, if the two numbers in the corrected image of the date shift type are "1" and "4" respectively, then the combined results are "14" and "41".

[0123] Step 1623: If one of the two combination results corresponding to the corrected image of the date shift type exceeds the preset date range, the other combination result of the two combination results corresponding to the corrected image of the date shift type is determined as the production date corresponding to the die casting image to be processed.

[0124] Since a month has a maximum of 31 days, the preset date range is 1-31, and the combination results outside this range are invalid. For example, the combination result "41" exceeds the preset date range, so the combination result "14" is determined as the production date of the die casting.

[0125] Step 1624: If the two combination results corresponding to the corrected image of the date shift type do not exceed the preset date range, determine the production date corresponding to the die casting image to be processed according to the coordinates of multiple target objects in the corrected image of the date shift type.

[0126] If both combined results are within the preset date range, the production date of the die casting is further determined based on the coordinates.

[0127] If the Y-axis coordinate of the letter in the corrected image of the date shift type is greater than the Y-axis coordinate of the number in the corrected image of the date shift type, arrange the two numbers in the corrected image of the date shift type in ascending order of the X-axis coordinate, and determine the arrangement result as the production date corresponding to the die-casting image to be processed.

[0128] If the Y-axis coordinate of the letter in the corrected image of the date shift type is smaller than the Y-axis coordinate of the number in the corrected image of the date shift type, arrange the two numbers in the corrected image of the date shift type in descending order of the X-axis coordinate, and determine the arrangement result as the production date corresponding to the die-casting image to be processed.

[0129] In the corrected image of the date shift type, the Y-axis coordinates of the two numbers are slightly different, while the Y-axis coordinates of the numbers and the letters are significantly different. If the Y-axis coordinate of the letter is greater than the Y-axis coordinate of the number, it means that the letter is above the number, and the number is in the positive position. Then, according to the X-axis coordinates of the two numbers, the production date of the die casting can be obtained by arranging them in order from small to large. For example, the two numbers are "1" and "3", the X-axis coordinate of the number "1" is 100, and the X-axis coordinate of the number "3" is 400. Then, according to the X-axis coordinates arranged from small to large, the production date is 13.

[0130] If the Y-axis coordinate of the letter is smaller than the Y-axis coordinate of the number, it means that the letter is below the number and the number is in reverse. Then, according to the X-axis coordinates of the two numbers, the production date of the die casting can be obtained by arranging them in order from large to small. For example, the two numbers are "1" and "3", the X-axis coordinate of the number "1" is 100, and the X-axis coordinate of the number "3" is 400. Then, according to the X-axis coordinates arranged from large to small, the production date is 31.

[0131] Step 1630: Determine the production time according to the production year, production month and production day corresponding to the die casting image to be processed.

[0132] Combine the production year, production month and production day to get the production time. For example, if the production year is "23", the production month is "04", and the production day is "23", then the production time is April 23, 2023.

[0133] In this embodiment, after determining the production time and shift corresponding to the die-casting image to be processed, the method further includes steps 2100-2200.

[0134] Step 2100: Get the current time.

[0135] Step 2200: If the production time corresponding to the die-casting image to be processed is after the current time, determine that the production time corresponding to the die-casting image to be processed is invalid.

[0136] After obtaining the production time of the die casting, the validity of the production time of the die casting is checked. It is determined whether the obtained production time of the die casting exceeds the current time. If it exceeds, it means that the obtained production time of the die casting is invalid and the production time of the die casting needs to be obtained again. If it does not exceed, it means that the obtained production time of the die casting is valid.

[0137] In this embodiment, after step 1100, the method further includes: performing a validity test on the die-casting image to be processed to obtain a test result, wherein the validity test includes a focus clarity test, an average brightness test, and an occlusion test; if the test result is invalid, reacquiring the die-casting image to be processed.

[0138] like Figure 5 As shown, after obtaining the image of the die casting to be processed, the focus clarity of the image is detected. First, the color image of the die casting to be processed is converted into a grayscale image. This helps to simplify the image processing process and improve computational efficiency. Then the OpenCV library is used to calculate the gradient of the grayscale image to obtain a gradient map. Here, the first-order differential of the image in the X and Y directions is calculated. This is equivalent to the partial derivative of the image function f(x, y) with respect to x and y.

[0139] .

[0140] .

[0141] in, represents the derivative of the image function f(x, y) in the X direction, Represents the derivative of the image function f(x, y) in the Y direction.

[0142] In order to further enhance the edge information in the image, the Prewitt operator is used to filter the calculated gradient map. The Prewitt operator is a commonly used convolution kernel that can effectively capture the edges in the image. The Prewitt operator is shown below.

[0143] .

[0144] .

[0145] Finally, the average value of the image array after gradient calculation and filtering is calculated, and the average value is used to represent the image focus clarity.

[0146] In order to calculate the average brightness of the die casting image to be processed, the color die casting image to be processed is converted into a grayscale image to simplify the processing process. The pixel values ​​of the grayscale image are averaged to obtain the average brightness. This metric can be used to evaluate the brightness level of the image.

[0147] In order to detect occlusion on the die casting images to be processed, a visual CNN (Convolutional Neural Networks) convolutional model is used here to detect situations that may affect the subsequent recognition process. The image features of the die casting images to be processed are extracted through the pre-trained visual CNN convolutional model, and the structures and patterns in the images are captured through the acquired image features.

[0148] The following introduces the hardware environment in which the method for identifying time marks of die castings based on machine vision of the present invention operates.

[0149] In hardware design, the present invention chooses to adopt edge computing architecture and places the control process of character recognition on edge computing devices. The main advantage of edge computing is to reduce the delay of communication with the cloud, increase real-time performance, and is suitable for application scenarios that are sensitive to delays.

[0150] In order to improve the reasoning efficiency of the model, the present invention introduces OpenVINO technology, which focuses on visual reasoning tasks. Through OpenVINO technology, the system can make full use of hardware accelerators, such as graphics processing units, visual processing units, etc., to accelerate the reasoning process of character recognition at the hardware level and achieve high-performance image processing.

[0151] In the electrical design, the present invention adopts a highly integrated approach, integrating all relevant components in the electrical cabinet. This includes image sensors, control units, communication modules, etc. High integration helps to reduce the system size, improve the overall system reliability, and simplify the connection and management of hardware.

[0152] In order to ensure high reliability, low latency and low deployment cost of the system, the present invention emphasizes that all calculations are performed locally. By performing character recognition tasks locally, the system reduces its dependence on cloud resources, ensures normal operation even without cloud connection, and improves the stability of the system.

[0153] The beneficial effects of the present invention include: (1) saving the workload of manually determining batch numbers. By introducing an automated die-casting time mark recognition system, the present invention effectively reduces the burden of manually determining batch numbers and improves the efficiency of the production process; (2) improving the traceability of the entire process. The present invention adopts advanced image processing and character recognition technology to accurately and quickly extract the shift number information in the die-casting time mark. This helps to improve the traceability of the entire process and ensure the full control of product production; (3) improving work efficiency. The automated die-casting time mark recognition system not only reduces the manual burden, but also improves work efficiency throughout the entire process. By adopting optimized models and algorithms, the present invention achieves fast and accurate character recognition, thereby improving overall work efficiency.

[0154] This embodiment introduces an electronic device, including a processor and a memory, wherein the memory stores a program executable by the processor, and when the program is executed by the processor, a method for identifying time marks of die-cast parts based on machine vision as described in any embodiment of the present invention is implemented.

[0155] Although some specific embodiments of the present invention have been described in detail by way of example, it will be appreciated by those skilled in the art that the above examples are for illustration only and are not intended to limit the scope of the present invention. It will be appreciated by those skilled in the art that the above embodiments may be modified without departing from the scope and spirit of the present invention. The scope of the present invention is defined by the appended claims.

[0156] Those of ordinary skill in the art will appreciate that the modules and algorithm steps 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 performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0157] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and equipment can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0158] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.

[0159] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the embodiments of the present invention.

[0160] In addition, each functional module in the embodiment of the present invention may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.

[0161] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the energy-saving signal sending / receiving method of each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a ROM, a RAM, a magnetic disk, or an optical disk.

[0162] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the inventive concept. For example, the above features are replaced with (but not limited to) technical features with similar functions disclosed in the present application.

[0163] It should be understood that the size of the sequence number of each step in the content of the invention and the embodiments of the present invention does not absolutely mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention. For the purpose of example and description, the foregoing description of the implementation of the present disclosure has been given. The foregoing description is not exhaustive and is not intended to limit the present disclosure to the exact form disclosed. Various deformations and modifications may exist according to the above teachings, or various deformations and modifications may be obtained from the practice of the present disclosure. These embodiments are selected and described to illustrate the principles of the present disclosure and its practical application, so that those skilled in the art can use the present disclosure in various embodiments and various modifications suitable for the specific purpose conceived.

Claims

1. A method for identifying time marks of die castings based on machine vision, characterized in that: include: Acquire an image of a die casting to be processed; Extracting a plurality of time mark area images from the die casting image to be processed, wherein the time mark area images contain letters and / or numbers; Performing horizontal correction on the multiple time mark area images to obtain multiple corrected images, wherein the corrected images correspond to the time mark area images one by one, and the letters and / or numbers in the corrected images are horizontal; Identify the multiple corrected images to obtain multiple target objects in each of the corrected images and the coordinates of each of the target objects, wherein the target object is a single letter or a single number; Determining the information type of each corrected image according to the multiple target objects in each corrected image, wherein the information type includes a year-month type and a date-shift type; Determine the production time and production shift corresponding to the die casting image to be processed according to the information type of each corrected image and the multiple target objects in each corrected image; Determining the production time and production shift corresponding to the die casting image to be processed according to the information type of each corrected image and the multiple target objects in each corrected image includes: Determine the production year and production month corresponding to the die casting image to be processed according to multiple target objects in the year-month type corrected image; Determine the production date and production shift corresponding to the die casting image to be processed according to multiple target objects in the corrected image of date and shift type; Determine the production time according to the production year, production month and production day corresponding to the image of the die casting to be processed; The step of determining the production year and production month corresponding to the die casting image to be processed according to the multiple target objects in the corrected image of year and month type includes: According to the coordinates of each number in the corrected image of the year and month type, four numbers in the corrected image of the year and month type are divided into two groups of numbers, wherein each group of numbers includes two numbers, and the difference between the Y-axis coordinates of the two numbers in each group of numbers is less than a first threshold value and the difference between the X-axis coordinates of the two numbers is less than a second threshold value, and the second threshold value is greater than the first threshold value; Combine the two numbers in each group of numbers respectively to obtain two combination results corresponding to each group of numbers; Get the current year and current month; Determine a first target combination result according to the current year, wherein the first target combination result is the combination result closest to the current year among all combination results corresponding to the two groups of numbers; Determine the first target combination result as the production year corresponding to the die casting image to be processed; Determine a second target combination result according to the current month, wherein the second target combination result is a combination result that is closest to the current month among the two combination results corresponding to the target group numbers, and the target group numbers are a number group that is different from the number group corresponding to the first target combination result among the two groups of numbers; Determine the second target combination result as the production month corresponding to the die casting image to be processed; The method of determining the production date and shift corresponding to the die casting image to be processed according to the multiple target objects in the corrected image of the date and shift type includes: Determine the letters in the plurality of target objects in the corrected image of the date shift type as the shift corresponding to the die casting image to be processed; Combining two numbers in a plurality of target objects in the corrected image of the date and shift type to obtain two combination results corresponding to the corrected image of the date and shift type; If one of the two combination results corresponding to the corrected image of the date shift type exceeds the preset date range, the other combination result of the two combination results corresponding to the corrected image of the date shift type is determined as the production date corresponding to the die casting image to be processed; If the two combination results corresponding to the corrected image of the date shift type do not exceed the preset date range, the production date corresponding to the die casting image to be processed is determined according to the coordinates of multiple target objects in the corrected image of the date shift type.

2. The method according to claim 1, characterized in that The horizontal correction of the multiple time mark area images to obtain multiple corrected images includes: Gray-scale the time stamp region image to obtain a gray-scale image; Cropping the central area of ​​the grayscale image to obtain a central area image; Binarizing the central area image to obtain a binary image; Determining whether the longest straight line in the binary image satisfies an interruption condition, wherein the interruption condition is that the longest straight line is not at an edge of the binary image and the length of the longest straight line is greater than a length threshold; If not, increase the binarization threshold and re-execute the step of binarizing the central area image; If satisfied, determine the rotation angle and rotation direction for rotating the longest straight line to the horizontal; The time mark area image is rotated according to the rotation angle and rotation direction, and the rotated image is identified positively and negatively through a pre-trained convolutional neural network, and the rotated image with a positive identification result is determined as a corrected image.

3. The method according to claim 1, characterized in that The step of determining the information type of each corrected image according to the multiple target objects in each corrected image includes: If the number of the multiple target objects in the corrected image is four and the multiple target objects in the corrected image are all numbers, determining that the information type of the corrected image is a year-month type; If the number of the multiple target objects in the corrected image is three and the multiple target objects in the corrected image include one letter and two numbers, it is determined that the information type of the corrected image is a date shift type.

4. The method according to claim 1, characterized in that: The step of determining the production date corresponding to the die casting image to be processed according to the coordinates of the plurality of target objects in the corrected image of the date shift type comprises: If the Y-axis coordinate of the letter in the corrected image of the date shift type is greater than the Y-axis coordinate of the number in the corrected image of the date shift type, arrange the two numbers in the corrected image of the date shift type in ascending order of the X-axis coordinates, and determine the arrangement result as the production date corresponding to the die casting image to be processed; If the Y-axis coordinate of the letter in the corrected image of the date shift type is smaller than the Y-axis coordinate of the number in the corrected image of the date shift type, arrange the two numbers in the corrected image of the date shift type in descending order of the X-axis coordinate, and determine the arrangement result as the production date corresponding to the die-casting image to be processed.

5. The method according to claim 1, characterized in that After determining the production time and shift corresponding to the die casting image to be processed, the method further includes: Get the current time; If the production time corresponding to the die-casting image to be processed is after the current time, it is determined that the production time corresponding to the die-casting image to be processed is invalid.

6. The method according to claim 1, characterized in that After acquiring the die casting image to be processed, the method further includes: Performing validity detection on the die casting image to be processed to obtain a detection result, wherein the validity detection includes focus clarity detection, average brightness detection, and occlusion detection; If the detection result is invalid, the die casting image to be processed is reacquired.

7. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a program executable by the processor, and when the program is executed by the processor, the method according to any one of claims 1 to 6 is implemented.