A data expansion method and device for a wheel-type instrument
By acquiring and processing the font-mode pictures and sliding boxes of the instrument, high-quality image data that conforms to the rotation logic of the instrument is generated, which solves the gap and quality problems of instrument image data in the prior art, and provides a high-quality data set for deep learning models.
Patent Information
- Application Number
- CN202411075348.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-07
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2044-08-07
AI Technical Summary
There is a big gap between the instrument image data generated by the prior art and the real instrument image data and does not conform to the instrument rotation logic, and the image quality is degraded.
By obtaining multiple pictures of the same type of font-wheel instrument, seizing the dial reading to form the font-mode picture, and splicing and processing it in preset order, using the sliding box to simulate sliding according to the preset sliding logic, generate image data, and perform image processing To improve quality.
Generate a large amount of high-quality image data similar to the real instrument image and satisfies the instrument rotation logic, and provide it to deep learning models for effective training.
Smart Images

Figure CN118587534B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image data generation, and in particular to a data expansion method and device for a character wheel type instrument. Background Art
[0002] Image-based AMR (Automatic Meter Reading) technology can automatically read meter data from captured images using computer vision technology by modifying traditional meters without replacing the meters, significantly reducing the labor and error rate of manual meter reading. However, training AMR models based on deep learning requires learning a large amount of meter image data, but the meter image data generated by existing technologies is significantly different from the real meter image data and does not conform to the meter rotation logic. It only increases in quantity while the overall image quality decreases. Summary of the invention
[0003] The present invention provides a data expansion method and device for a character wheel type instrument, so as to solve the problem that the instrument image data generated by the prior art has a large gap with the real instrument image data and does not conform to the instrument rotation logic, and can improve the image quality while generating a large amount of image data.
[0004] To achieve the above purpose, an embodiment of the present invention provides a data expansion method for a digital wheel type instrument, comprising:
[0005] Acquire multiple pictures of the same type of wheel-type instruments, and extract each complete value from the dial readings of the pictures to obtain a font picture, wherein the size of the font picture is unified as preset horizontal pixels×preset vertical pixels;
[0006] Splicing the word template images in a first preset order, and performing image processing on each splicing position to obtain a word strip image;
[0007] Copy a plurality of the note images, use the sliding frame on the note image to simulate sliding according to the preset sliding logic, output each sliding frame image and splice them to generate image data.
[0008] As an improvement of the above solution, the numerical value is located in the middle of the font image without tilt.
[0009] As an improvement of the above solution, the image processing includes smoothing the splicing traces at the splicing point of the two font images.
[0010] As an improvement of the above solution, the copying of multiple note pictures, using the sliding frame on the note picture to simulate sliding according to the preset sliding logic, outputting each sliding frame picture and splicing them to generate image data, includes:
[0011] Copying the word strip images to obtain the same number of word strip images as the number of word wheels in the word wheel type instrument;
[0012] Each of the word strip images has a sliding frame, and the size of the sliding frame is the same as the size of the word template image;
[0013] When the sliding frame completes a slide according to the preset sliding logic, the sliding frame diagram corresponding to each note image is output and sequentially spliced according to the second preset order to generate image data.
[0014] As an improvement of the above solution, the sliding logic includes:
[0015] The initial position of each sliding frame is at the top of the note picture;
[0016] Sliding starts from the current sliding frame, and the current sliding frame slides down by a preset pixel value at a preset frequency, completing one sliding;
[0017] Whenever a slide is completed, a slide frame diagram corresponding to each note image is output;
[0018] When the current sliding frame slides to the preset progressive position, it drives the previous sliding frame to start sliding downward synchronously by the preset pixel value according to the preset frequency until the current sliding frame slides to the preset zero position, thus completing a cycle of zeroing;
[0019] Whenever a cycle is completed and the result is zeroed, the previous sliding frame stops sliding, and the current sliding frame returns to the initial position and continues sliding;
[0020] When the previous sliding frame slides to the preset progressive position, the previous sliding frame of the previous sliding frame is driven to start synchronously sliding downward by the preset pixel value according to the preset frequency;
[0021] The above process is repeated until each of the sliding frames slides to the preset progressive position and all the sliding frames stop sliding.
[0022] As an improvement of the above solution, the outputting of the sliding frame diagram corresponding to each note picture includes:
[0023] When the sliding frame is located from the initial position to the preset progressive position, directly outputting the picture in the sliding frame;
[0024] When the sliding frame is located between the preset progressive position and the preset zero position, the sliding frame is divided into a sliding upper frame and a sliding lower frame, wherein the sliding upper frame is within the range from the preset progressive position to the preset zero position, and the sliding lower frame is within the range from the initial position to the preset progressive position, and the picture in the sliding upper frame and the picture in the sliding lower frame are spliced from top to bottom in sequence to obtain a complete picture of the sliding frame and output it.
[0025] As an improvement of the above solution, the note image is composed of N pieces of the font images, then the progressive position is N-1 times the position of the preset vertical pixels, and the preset zero position is N times the position of the preset vertical pixels.
[0026] As an improvement of the above solution, the number of word wheels is M, then the current sliding frame is the sliding frame on the Mth note picture, and the previous sliding frame is the sliding frame on the M-1th note picture.
[0027] As an improvement of the above solution, after generating the image data, the method further includes:
[0028] Automatically create a YOLO format annotation file for the image data according to the information when each image data is generated;
[0029] The image data is subjected to blur processing, exposure processing, low light processing, noise processing and light spot processing, respectively, or subjected to superposition processing to obtain processed image data.
[0030] To achieve the above purpose, the embodiment of the present invention further provides a data expansion device for a digital wheel type instrument, comprising:
[0031] A font image acquisition module is used to acquire multiple images of the same type of font wheel type instrument, and to intercept each complete value from the dial reading of the image to obtain a font image, wherein the size of the font image is unified as a preset horizontal pixel × a preset vertical pixel;
[0032] A note image acquisition module is used to splice the word template images in a first preset order and perform image processing on each splicing position to obtain a note image;
[0033] The simulation sliding and data generation module is used to copy multiple pieces of the note pictures, use the sliding frame on the note picture to simulate sliding according to the preset sliding logic, output each sliding frame picture and splice them to generate image data.
[0034] To achieve the above-mentioned purpose, an embodiment of the present invention further provides a data expansion device for a digital wheel instrument, comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the above-mentioned data expansion method for a digital wheel instrument when executing the computer program.
[0035] To achieve the above-mentioned purpose, an embodiment of the present invention further provides a computer-readable storage medium, which includes a stored computer program; wherein, when the computer program is running, it controls the device where the computer-readable storage medium is located to execute the above-mentioned digital wheel instrument data expansion method.
[0036] To achieve the above object, an embodiment of the present invention further provides a computer program product, which includes a computer program; wherein, when the computer program is running, it controls the device where the program product is located to execute the above-mentioned digital wheel meter data expansion method.
[0037] Implementing the embodiments of the present invention has the following beneficial effects:
[0038] The data expansion method and device for a character wheel instrument provided in an embodiment of the present invention obtain multiple pictures of the same type of character wheel instruments, and extract each complete value from the dial readings of the pictures to obtain a character template picture, wherein the size of the character template picture is uniformly preset horizontal pixels × preset vertical pixels; the character template pictures are spliced in a first preset order, and image processing is performed on each splicing point to obtain a note picture; multiple note pictures are copied, and the sliding boxes on the note pictures are used to simulate sliding according to a preset sliding logic, and each sliding box diagram is output and spliced to generate image data. A large amount of high-quality image data similar to real instrument images and satisfying the instrument rotation logic can be generated, providing a high-quality, sufficient and diverse image data set for the deep learning model, which is conducive to the effective training of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 is a flow chart of a data expansion method for a digital wheel type instrument provided by an embodiment of the present invention;
[0040] Figure 2 is a schematic diagram of a character model acquisition process provided by an embodiment of the present invention;
[0041] Figure 3 is a schematic diagram of a note acquisition process provided by an embodiment of the present invention;
[0042] Figure 4 is a schematic diagram of a simulation generation process of image data provided by an embodiment of the present invention;
[0043] Figure 5is a schematic diagram of a sliding frame sliding process provided by an embodiment of the present invention;
[0044] Figure 6 is a schematic diagram of a sliding upper frame and a sliding lower frame and their splicing provided by an embodiment of the present invention;
[0045] Figure 7 is a schematic diagram of annotation generation corresponding to image data provided by an embodiment of the present invention;
[0046] Figure 8 It is an effect diagram after performing different processing on image data provided by an embodiment of the present invention;
[0047] Fig. 9 It is a structural block diagram of a data expansion device for a digital wheel type instrument provided by an embodiment of the present invention;
[0048] Fig.10 The invention is a structural block diagram of a data expansion device for a digital wheel type meter provided in an embodiment of the invention. DETAILED DESCRIPTION
[0049] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments 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 creative work are within the scope of protection of the present invention.
[0050] In the description of the present invention, it should be noted that the step numbers in the text are only for the convenience of explanation of specific embodiments and do not serve to limit the order in which the steps are executed. The terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.
[0051] See also Figure 1 , Figure 1 : is a flow chart of a data expansion method for a digital wheel type instrument provided by an embodiment of the present invention, the data expansion method for a digital wheel type instrument comprises steps S1 to S3, which are specifically as follows:
[0052] S1, obtaining multiple pictures of the same type of wheel-type instruments, intercepting each complete value from the dial readings of the pictures, and obtaining a font picture, wherein the size of the font picture is unified as preset horizontal pixels×preset vertical pixels;
[0053] S2, splicing the word template images according to a first preset order, and performing image processing on each splicing position to obtain a word strip image;
[0054] S3, copying a plurality of the note images, using the sliding frame on the note image to simulate sliding according to a preset sliding logic, outputting and splicing each sliding frame image, and generating image data.
[0055] It is understandable that the data expansion method of the character wheel type meter can be applied to any type of character wheel type meter such as electric meter, water meter, gas meter, etc. In order to make the image data finally generated more realistic, the character model should be extracted from the meter pictures taken in real life.
[0056] In an embodiment of the present invention, complete values are captured from a wheel-type instrument image and the size is unified to form a font image, the font image is spliced into a note image in a preset order, and sliding is simulated according to a preset sliding logic through a sliding box on the note image to generate a large amount of high-quality image data that is similar to the real instrument image and satisfies the instrument rotation logic, thereby providing a high-quality, sufficient and diverse image data set for the deep learning model, which is conducive to the effective training of the model.
[0057] In an optional embodiment, the numerical value is located in the middle of the font image without tilt.
[0058] In an embodiment of the present invention, since the numerical values of the instrument in actual use are usually vertically aligned and stably positioned, the numerical values in the font image are in the middle position and are not tilted, which can ensure that the position and size of each numerical value are consistent during the subsequent note production and simulation generation process, thereby improving the similarity between the generated image data and the real instrument image data.
[0059] For example, Figure 2 As shown, taking a common water meter as an example, first obtain enough pictures of the same type of wheel-type meters, then use a screenshot tool to capture each complete value from the dial reading of the picture and adjust it to the same size of pixels for saving as a font picture. Among them, each font is adjusted to 60×70 pixels; the captured font picture should be consistent with the actual picture, and each font picture should contain any independent complete value from 0 to 9, and the value is located in the middle of the font picture without tilt, and there is a certain interval above and below.
[0060] In an optional embodiment, the image processing includes smoothing the splicing traces at the splicing point of the two font images.
[0061] It is understandable that the process of making the letter strips simulates the letter wheel in the letter wheel instrument. The obvious traces of the splicing will make the generated image data look unnatural and inconsistent with the real instrument data. It will also introduce additional noise or anomalies, affecting the deep learning model's ability to learn and infer image data.
[0062] In an embodiment of the present invention, stitching traces are eliminated by smoothing processing, and the smoothing processing usually involves image restoration technology, such as using a biharmonic function-based image restoration technology to eliminate unnatural traces at the stitching, so that the stitched image looks more natural and seamless, thereby making the generated image data closer to the actual situation and enhancing the authenticity and usability of the image data set.
[0063] For example, Figure 3 As shown in the figure, if the size of the font image is 60×70 pixels, the font images are sequentially spliced from top to bottom (i.e., the first preset order) in the order of numbers from 0 to 9 to obtain a 60×700 pixel font. Since direct splicing will leave obvious splicing marks at the splicing of each font image, resulting in a certain difference between the final generated font image and the font wheel image in the actual font wheel instrument, each splicing needs to be smoothed. Figure 2 The red box marked part shows the effect comparison before and after image processing.
[0064] In an optional embodiment, copying a plurality of the note images, using the sliding frame on the note image to simulate sliding according to a preset sliding logic, outputting and splicing each sliding frame image, and generating image data, includes:
[0065] Copying the word strip images to obtain the same number of word strip images as the number of word wheels in the word wheel type instrument;
[0066] Each of the word strip images has a sliding frame, and the size of the sliding frame is the same as the size of the word template image;
[0067] When the sliding frame completes a slide according to the preset sliding logic, the sliding frame diagram corresponding to each note image is output and sequentially spliced according to the second preset order to generate image data.
[0068] In an optional embodiment, the sliding logic includes:
[0069] The initial position of each sliding frame is at the top of the note picture;
[0070] Sliding starts from the current sliding frame, and the current sliding frame slides down by a preset pixel value at a preset frequency, completing one sliding;
[0071] Whenever a slide is completed, a slide frame diagram corresponding to each note image is output;
[0072] When the current sliding frame slides to the preset progressive position, it drives the previous sliding frame to start sliding downward synchronously by the preset pixel value according to the preset frequency until the current sliding frame slides to the preset zero position, thus completing a cycle of zeroing;
[0073] Whenever a cycle is completed and the result is zeroed, the previous sliding frame stops sliding, and the current sliding frame returns to the initial position and continues sliding;
[0074] When the previous sliding frame slides to the preset progressive position, the previous sliding frame of the previous sliding frame is driven to start synchronously sliding downward by the preset pixel value according to the preset frequency;
[0075] The above process is repeated until each of the sliding frames slides to the preset progressive position and all the sliding frames stop sliding.
[0076] It can be understood that the simulation generation process is to use the sliding box on the word strip image to simulate the sliding according to the rotation logic of the real word wheel instrument (i.e., the preset sliding logic), intercept and splice the image, so as to achieve the effect of data generation. At the same time, by setting the preset frequency and the preset pixel value, the sliding speed of the sliding box and the acquisition frequency of the sliding box image can be controlled, thereby controlling the amount of image data finally generated.
[0077] For example, Figure 4 As shown, taking a common water meter as an example, it usually contains 5 valid digits, and the number of character wheels is 5, so 5 completely identical 60×700 pixel position character strips are used, and each character strip has a 60×70 pixel sliding frame, which slides according to the rotation logic of the character wheel meter. When outputting the result, the 5 sliding frames are spliced in sequence from left to right (i.e., the second preset order) to obtain the corresponding image data.
[0078] In an optional embodiment, outputting the sliding frame diagram corresponding to each note image includes:
[0079] When the sliding frame is located from the initial position to the preset progressive position, directly outputting the picture in the sliding frame;
[0080] When the sliding frame is located between the preset progressive position and the preset zero position, the sliding frame is divided into a sliding upper frame and a sliding lower frame, wherein the sliding upper frame is within the range from the preset progressive position to the preset zero position, and the sliding lower frame is within the range from the initial position to the preset progressive position, and the picture in the sliding upper frame and the picture in the sliding lower frame are spliced from top to bottom in sequence to obtain a complete picture of the sliding frame and output it.
[0081] In an optional embodiment, the note image is composed of N pieces of the character template images, then the progressive position is N-1 times the position of the preset vertical pixels, and the preset zero position is N times the position of the preset vertical pixels.
[0082] In an optional embodiment, the number of word wheels is M, the current sliding frame is the sliding frame on the Mth note picture, and the previous sliding frame is the sliding frame on the M-1th note picture.
[0083] For example, Figure 5 As shown, there are a total of 5 note images with a size of 60×700 pixels. Each note has a sliding frame with a size of 60×70 pixels, and the initial position of each sliding frame is at the top of the note image. The sliding box on the 5th note starts sliding, sliding once per millisecond (i.e., the preset frequency), sliding down 1 pixel (i.e., the preset pixel value) each time, and outputs image data once. When it slides down to the 630 pixel position (i.e., the progressive position), it drives the sliding box on the 4th note to start sliding, and also slides down 1 pixel each time. When the sliding box on the 5th note slides to the 700 pixel position (i.e., the zeroing position), a cycle of zeroing is completed. At this time, the sliding box on the 4th note has slid down 70 pixels and stops sliding. Wait until the sliding box on the 5th note slides to the 630 pixel position, then drive the sliding box on the 4th note to slide down 70 pixels and stop. By analogy, when the sliding box on the 4th note slides down to the 630 pixel position, it starts to drive the sliding box on the 3rd note to slide, and the whole process repeats until all the sliding boxes slide to the 630 pixel position at the same time.
[0084] like Figure 6 As shown, when the sliding box slides to the 630 pixel position (i.e., the progressive position) and then slides downward, the sliding box may slide out of the note. At this time, the sliding box will automatically be divided into two parts, the part that has not slid out is the sliding upper frame and the part that has slid out is the sliding lower frame. The sliding lower frame will appear directly at the top of the note (i.e., the initial position), and the sliding upper frame is still at the end of the note. When outputting the result, the picture in the sliding upper frame and the picture in the sliding lower frame will be spliced from top to bottom in sequence to obtain the complete picture of the sliding frame before outputting it.
[0085] In an optional embodiment, after generating the image data, the method further includes:
[0086] Automatically create a YOLO format annotation file for the image data according to the information when each image data is generated;
[0087] The image data is subjected to blur processing, exposure processing, low light processing, noise processing and light spot processing, respectively, or subjected to superposition processing to obtain processed image data.
[0088] It is understandable that deep learning models require a large amount of image data for training, but manual annotation of the large amount of generated image data requires a lot of time and labor costs. Therefore, while generating image data, the corresponding YOLO format annotation file is generated based on the information when each image is generated, and manual annotation is not required, which greatly saves time and labor costs and improves efficiency.
[0089] For example, Figure 7 As shown, the left side is the generated image data, and the right side is the corresponding automatically generated annotation file, wherein the 1st to 5th lines of the annotation file correspond to the 5 values from left to right in the image data, the first data of each line is the category corresponding to the value, 0-9 belong to the 0th to 9th categories respectively, the second and third data represent the relative coordinates of the center point of the sliding box that wraps the category in the image data, and the fourth and fifth data represent the width and height of the sliding box around the center point relative to the entire image data.
[0090] In order to make the generated image data more consistent with the pictures taken in real scenes, blur processing, exposure processing, low light processing, noise processing and light spot processing are performed on the generated image data. Figure 8 The following are the original image data without any processing, the effect after blur processing, the effect after exposure processing, the effect after low light processing, the effect after adding salt and pepper noise (simulating dust), and the result after adding light spots. At the same time, the image data can not only be processed individually, but also superimposed.
[0091] The data expansion method of a character wheel instrument provided in an embodiment of the present invention obtains multiple pictures of the same type of character wheel instruments, and extracts each complete value from the dial readings of the pictures to obtain a character template picture, wherein the size of the character template picture is unified as a preset horizontal pixel × a preset vertical pixel; the character template pictures are spliced in a first preset order, and image processing is performed on each splicing point to obtain a note picture; multiple note pictures are copied, and the sliding boxes on the note pictures are used to simulate sliding according to a preset sliding logic, and each sliding box diagram is output and spliced to generate image data. A large amount of high-quality image data similar to the real instrument image and satisfying the instrument rotation logic can be generated, providing a high-quality, sufficient and diverse image data set for the deep learning model, which is conducive to the effective training of the model.
[0092] It is understandable that an image dataset with balanced data categories is very important for the training of deep learning models. It can prevent the model from being biased towards the majority category, thereby improving the classification performance of each category, reducing the risk of overfitting, and ensuring that the model has better generalization ability and representativeness in practical applications. However, in reality, it is almost impossible to obtain an instrument dataset with balanced numerical categories of dial readings through photographed pictures. The data expansion method of the character wheel instrument provided in an embodiment of the present invention can generate a completely balanced dataset of various numerical categories of dial readings by adjusting the probability of each sliding box sliding to a specific area, thereby meeting the needs of deep learning models.
[0093] In addition, by setting output parameters, the specified data can be output during the simulation. For example, for the sliding box on the second note, when it slides within the range of (0, 35] and (665, 700] pixels, it represents the number 0; when it slides within the range of (35, 105], (105, 175], (175, 245], (245, 315], (315, 385], (385, 455], (455, 525], (525, 595] and (595, 665] pixels, it represents the numbers 1, 2, 3, 4, 5, 6, 7, 8 and 9 respectively. For other notes, although this range is still applicable, except for In the special stage of carry, there will be no half-character situation, so usually pixels 0, 70, 140, 210, 280, 350, 420, 490, 560 and 630 represent the numbers 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9 respectively. Therefore, when the parameter is set to {0:70, 1:350, 2:560, 3:280, 4:195}, it means saving the image data with display readings of (1, 5, 8, 4, 3), and when the parameter is set to {3:280}, it means saving all the image data with the 4th reading of the number 4, thereby realizing the output of the specified data.
[0094] See also Fig. 9 , Fig. 9 1 is a structural block diagram of a data expansion device 10 for a digital wheel type instrument provided in an embodiment of the present invention. The data expansion device 10 for a digital wheel type instrument comprises:
[0095] The font image acquisition module 11 is used to acquire multiple images of the same type of font wheel type instrument, and intercept each complete value from the dial reading of the image to obtain the font image, wherein the size of the font image is unified as preset horizontal pixels×preset vertical pixels;
[0096] The note image acquisition module 12 is used to splice the word template images according to a first preset order and perform image processing on each splicing position to obtain a note image;
[0097] The simulation sliding and data generation module 13 is used to copy multiple pieces of the note pictures, use the sliding frame on the note picture to simulate sliding according to the preset sliding logic, output each sliding frame picture and splice them to generate image data.
[0098] Optionally, the numerical value is located in the middle of the font image without tilt.
[0099] Optionally, the image processing includes smoothing the splicing marks at the splicing point of the two font images.
[0100] Optionally, the simulated sliding and data generating module 13 is further used for:
[0101] Copying the word strip images to obtain the same number of word strip images as the number of word wheels in the word wheel type instrument;
[0102] Each of the word strip images has a sliding frame, and the size of the sliding frame is the same as the size of the word template image;
[0103] When the sliding frame completes a slide according to the preset sliding logic, the sliding frame diagram corresponding to each note image is output and sequentially spliced according to the second preset order to generate image data.
[0104] Optionally, the sliding logic includes:
[0105] The initial position of each sliding frame is at the top of the note picture;
[0106] Sliding starts from the current sliding frame, and the current sliding frame slides down by a preset pixel value at a preset frequency, completing one sliding;
[0107] Whenever a slide is completed, a slide frame diagram corresponding to each note image is output;
[0108] When the current sliding frame slides to the preset progressive position, it drives the previous sliding frame to start sliding downward synchronously by the preset pixel value according to the preset frequency until the current sliding frame slides to the preset zero position, thus completing a cycle of zeroing;
[0109] Whenever a cycle is completed and the result is zeroed, the previous sliding frame stops sliding, and the current sliding frame returns to the initial position and continues sliding;
[0110] When the previous sliding frame slides to the preset progressive position, the previous sliding frame of the previous sliding frame is driven to start synchronously sliding downward by the preset pixel value according to the preset frequency;
[0111] The above process is repeated until each of the sliding frames slides to the preset progressive position and all the sliding frames stop sliding.
[0112] Optionally, outputting a sliding frame diagram corresponding to each note image includes:
[0113] When the sliding frame is located from the initial position to the preset progressive position, directly outputting the picture in the sliding frame;
[0114] When the sliding frame is located between the preset progressive position and the preset zero position, the sliding frame is divided into a sliding upper frame and a sliding lower frame, wherein the sliding upper frame is within the range from the preset progressive position to the preset zero position, and the sliding lower frame is within the range from the initial position to the preset progressive position, and the picture in the sliding upper frame and the picture in the sliding lower frame are spliced from top to bottom in sequence to obtain a complete picture of the sliding frame and output it.
[0115] Optionally, the note image is composed of N pieces of the character template images, then the progressive position is N-1 times the position of the preset vertical pixels, and the preset zero position is N times the position of the preset vertical pixels.
[0116] Optionally, the number of word wheels is M, then the current sliding frame is the sliding frame on the Mth note picture, and the previous sliding frame is the sliding frame on the M-1th note picture.
[0117] Optionally, after generating the image data, the method further includes:
[0118] Automatically create a YOLO format annotation file for the image data according to the information when each image data is generated;
[0119] The image data is subjected to blur processing, exposure processing, low light processing, noise processing and light spot processing, respectively, or subjected to superposition processing to obtain processed image data.
[0120] It is worth noting that the working process of each module in the data expansion device 10 of the digital wheel type instrument described in the embodiment of the present invention can refer to the working process of the data expansion method of the digital wheel type instrument described in the above embodiment, and will not be repeated here.
[0121] The data expansion device for a character wheel type instrument provided in an embodiment of the present invention obtains multiple pictures of the same type of character wheel type instruments, and extracts each complete value from the dial readings of the pictures to obtain a character template picture, wherein the size of the character template picture is uniformly preset horizontal pixels × preset vertical pixels; the character template pictures are spliced in a first preset order, and image processing is performed on each splicing point to obtain a note picture; multiple note pictures are copied, and the sliding boxes on the note pictures are used to simulate sliding according to a preset sliding logic, and each sliding box diagram is output and spliced to generate image data. A large amount of high-quality image data similar to real instrument images and satisfying the instrument rotation logic can be generated, providing a high-quality, sufficient and diverse image data set for a deep learning model, which is conducive to the effective training of the model.
[0122] In addition, an embodiment of the present invention further provides a computer-readable storage medium, which includes a stored computer program; wherein, when the computer program is running, it controls the device where the computer-readable storage medium is located to execute the above-mentioned digital wheel meter data expansion method.
[0123] An embodiment of the present invention further provides a computer program product, which includes a computer program; wherein, when the computer program is running, the device where the computer program product is located is controlled to execute the above-mentioned data expansion method for the digital wheel meter.
[0124] See also Fig.10 , Fig.10 1 is a structural block diagram of a data expansion device 20 for a digital wheel type instrument provided in an embodiment of the present invention, and the data expansion device 20 for a digital wheel type instrument comprises: a processor 21, a memory 22, and a computer program stored in the memory 22 and executable on the processor 21. When the processor 21 executes the computer program, the steps in the above-mentioned digital wheel type instrument data expansion method embodiment are implemented. Alternatively, when the processor 21 executes the computer program, the functions of each module / unit in the above-mentioned device embodiments are implemented.
[0125] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory 22 and executed by the processor 21 to implement the present invention. The one or more modules / units may be a series of computer program instruction segments capable of implementing specific functions, which are used to describe the execution process of the computer program in the digital wheel meter data expansion device 20.
[0126] The digital wheel type meter data expansion device 20 may include, but is not limited to, a processor 21 and a memory 22. Those skilled in the art will appreciate that the schematic diagram is merely an example of the digital wheel type meter data expansion device 20 and does not constitute a limitation on the digital wheel type meter data expansion device 20. The digital wheel type meter data expansion device 20 may include more or fewer components than shown in the figure, or may combine certain components, or different components. For example, the digital wheel type meter data expansion device 20 may also include input and output devices, network access devices, buses, etc.
[0127] The processor 21 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor 21 is the control center of the digital wheel meter data expansion device 20, and uses various interfaces and lines to connect various parts of the entire digital wheel meter data expansion device 20.
[0128] The memory 22 can be used to store the computer program and / or module. The processor 21 realizes various functions of the digital wheel meter data expansion device 20 by running or executing the computer program and / or module stored in the memory 22 and calling the data stored in the memory 22. The memory 22 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 22 can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0129] Wherein, if the module / unit integrated in the digital wheel meter data expansion device 20 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor 21, the steps of the above-mentioned method embodiments can be implemented. Wherein, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file or some intermediate form. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium, etc.
[0130] The above is a preferred embodiment of the present invention. It should be pointed out that a person skilled in the art can make several improvements and modifications without departing from the principle of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A data expansion method for a digital wheel instrument, characterized in that: include: Acquire multiple pictures of the same type of wheel-type instruments, and extract each complete value from the dial readings of the pictures to obtain a font picture, wherein the size of the font picture is unified as preset horizontal pixels×preset vertical pixels; Splicing the word template images in a first preset order, and performing image processing on each splicing position to obtain a word strip image; Copy a plurality of the note pictures, use the sliding frame on the note picture to simulate sliding according to the preset sliding logic, output each sliding frame picture and splice them to generate image data; The copying of the plurality of note pictures, using the sliding frame on the note picture to simulate sliding according to the preset sliding logic, outputting and splicing the sliding frame pictures to generate image data, includes: Copying the word strip images to obtain the same number of word strip images as the number of word wheels in the word wheel type instrument; Each of the word strip images has a sliding frame, and the size of the sliding frame is the same as the size of the word template image; When the sliding frame completes one sliding according to the preset sliding logic, the sliding frame images corresponding to each note image are output and sequentially spliced in a second preset order to generate image data; The sliding logic includes: The initial position of each sliding frame is at the top of the note picture; Sliding starts from the current sliding frame, and the current sliding frame slides down by a preset pixel value at a preset frequency, completing one sliding; Whenever a slide is completed, a slide frame diagram corresponding to each note image is output; When the current sliding frame slides to the preset progressive position, it drives the previous sliding frame to start sliding downward synchronously by the preset pixel value according to the preset frequency until the current sliding frame slides to the preset zero position, thus completing a cycle of zeroing; Whenever a cycle is completed and the result is zeroed, the previous sliding frame stops sliding, and the current sliding frame returns to the initial position and continues sliding; When the previous sliding frame slides to the preset progressive position, the previous sliding frame of the previous sliding frame is driven to start synchronously sliding downward by the preset pixel value according to the preset frequency; The above sliding logic process is repeated repeatedly until each of the sliding frames slides to the preset progressive position and all the sliding frames stop sliding.
2. The data expansion method of a digital wheel type instrument as claimed in claim 1, characterized in that: The numerical value is located in the middle of the font image without tilt.
3. The data expansion method of a digital wheel type instrument as claimed in claim 1, characterized in that: The image processing includes smoothing the splicing traces at the splicing point of the two font images.
4. The data expansion method of a digital wheel type instrument as claimed in claim 1, characterized in that: The outputting of the sliding frame diagram corresponding to each note image includes: When the sliding frame is located from the initial position to the preset progressive position, directly outputting the picture in the sliding frame; When the sliding frame is located between the preset progressive position and the preset zero position, the sliding frame is divided into a sliding upper frame and a sliding lower frame, wherein the sliding upper frame is within the range from the preset progressive position to the preset zero position, and the sliding lower frame is within the range from the initial position to the preset progressive position, and the picture in the sliding upper frame and the picture in the sliding lower frame are spliced from top to bottom in sequence to obtain a complete picture of the sliding frame and output it.
5. The data expansion method of a digital wheel type instrument as claimed in claim 4, characterized in that: The note image is composed of N pieces of the character template images, then the progressive position is N-1 times the position of the preset vertical pixels, and the preset zero position is N times the position of the preset vertical pixels.
6. The data expansion method of a digital wheel type instrument as claimed in claim 5, characterized in that: The number of word wheels is M, then the current sliding frame is the sliding frame on the Mth note picture, and the previous sliding frame is the sliding frame on the M-1th note picture.
7. The data expansion method of a digital wheel type instrument as claimed in claim 1, characterized in that: After generating the image data, the method further includes: Automatically create a YOLO format annotation file for the image data according to the information when each image data is generated; The image data is subjected to blur processing, exposure processing, low light processing, noise processing and light spot processing, respectively, or subjected to superposition processing to obtain processed image data.
8. A data expansion device for a digital wheel instrument, characterized in that: include: A font image acquisition module is used to acquire multiple images of the same type of font wheel type instrument, and to intercept each complete value from the dial reading of the image to obtain a font image, wherein the size of the font image is unified as a preset horizontal pixel × a preset vertical pixel; A note image acquisition module is used to splice the word template images in a first preset order and perform image processing on each splicing position to obtain a note image; A simulation sliding and data generation module, used to copy a plurality of the note pictures, use the sliding frame on the note picture to simulate sliding according to the preset sliding logic, output each sliding frame picture and splice them to generate image data; Wherein, the simulated sliding and data generation module is also used for: Copying the word strip images to obtain the same number of word strip images as the number of word wheels in the word wheel type instrument; Each of the word strip images has a sliding frame, and the size of the sliding frame is the same as the size of the word template image; When the sliding frame completes one sliding according to the preset sliding logic, the sliding frame images corresponding to each note image are output and sequentially spliced in a second preset order to generate image data; The sliding logic includes: The initial position of each sliding frame is at the top of the note picture; Sliding starts from the current sliding frame, and the current sliding frame slides down by a preset pixel value at a preset frequency, completing one sliding; Whenever a slide is completed, a slide frame diagram corresponding to each note image is output; When the current sliding frame slides to the preset progressive position, it drives the previous sliding frame to start sliding downward synchronously by the preset pixel value according to the preset frequency until the current sliding frame slides to the preset zero position, thus completing a cycle of zeroing; Whenever a cycle is completed and the result is zeroed, the previous sliding frame stops sliding, and the current sliding frame returns to the initial position and continues sliding; When the previous sliding frame slides to the preset progressive position, the previous sliding frame of the previous sliding frame is driven to start synchronously sliding downward by the preset pixel value according to the preset frequency; The above sliding logic process is repeated repeatedly until each of the sliding frames slides to the preset progressive position and all the sliding frames stop sliding.
Citation Information
Patent Citations
Image identification method and device for mechanical instrument window display figure
CN101055619A
Image identification method and system for electric power instrument
CN108537222A
Digital instrument reading identification method
CN110033037A
Measuring instrument information acquisition system
CN115115664A
Automatic image labeling method and device based on YOLO algorithm
CN117058463A
