Disclosure of Invention
In order to solve the problems of difficult product data statistics and poor data quality of fast-moving enterprises, the invention provides a product data processing method and a product data processing system applied to the fast-moving industry.
The invention provides a product data processing method applied to fast-moving industries in a first aspect, which comprises the following steps:
acquiring image data containing a target product, and performing quality detection on the image data to clean the image data with unqualified quality;
processing image data with qualified quality according to an image recognition model, and recognizing the name of a target product, the number of the target product and the coordinates of the target product in the image data;
judging whether the position of the target product meets the condition of reasonably placing the product or not according to the name of the target product and the coordinate of the target product; wherein, the condition of the reasonable placement of the products comprises: the number of layers of the target product to be placed meets the preset number of layers and whether the competitive products exist in the preset range of the placing position of the target product;
and storing the name of the target product, the number of the target products, the coordinates of the target products and the judgment result in a database, and generating a report.
Further, the step of judging whether the position of the target product meets the condition of reasonable placement of the product according to the name of the target product, the number of the target products and the coordinate of the target product comprises the following steps:
calculating the distance between the competitive products and the target products according to the competitive product coordinates and the target product coordinates;
judging whether the distance is smaller than a value twice the width of the target product;
if yes, reserving the competitive products in the range;
if not, the competitive products do not exist in the preset range.
Further, the step of judging whether the position of the target product meets the condition of reasonable placement of the product according to the name of the target product, the number of the target products and the coordinate of the target product comprises the following steps:
traversing all target products, and judging whether the number of layers of the target products is a second layer or a third layer;
if so, the number of layers of the target product meets the preset number of layers;
if not, the number of layers of the target product does not meet the preset number of layers.
Further, before processing the image data with qualified quality according to the image recognition model, the method further includes: establishing an image recognition model; specifically, the method comprises the following steps:
acquiring a plurality of image data containing target products, and manually labeling the names, the quantity and the coordinates of the target products in the image data;
carrying out inference model training on a plurality of image data obtained by artificial labeling through a fully-connected neural network, and calculating a loss function value;
and adjusting parameters of model training to enable the loss function value to be smaller than a preset number, and finishing the training of the image recognition model.
Further, the loss function value is calculated by the following formula:
wherein Loss is a Loss function value, n is a total number of image data, i is ith image data, and yiTo label the image name and coordinates, xiTo label the pixel values of the image, w and b are both model training learning parameters.
Further, the quality detection of the image data to clean the image data with unqualified quality includes:
calculating the peak signal-to-noise ratio of the image data, and taking the peak signal-to-noise ratio as the quality standard of the image data;
and taking the image data with the peak signal-to-noise ratio lower than 100 as image data with unqualified quality.
Further, the peak signal-to-noise ratio is calculated by the following formula:
PSNR is the peak signal-to-noise ratio of the image data, MAX is a fixed value, 255 is taken, and MSE is the mean square error of pixels of the image data;
wherein the MSE is calculated by the following equation:
where MSE is the mean square error of the pixels of the image data, M is the width of the image, N is the length of the image, f (x, y) is the pixel value, f-1(x, y) is the mean of the pixel points, x is the abscissa of the pixel point, and y is the ordinate of the pixel point.
The second aspect of the present invention provides a product data processing system applied to the fast-moving industry, comprising:
the image data screening module is used for acquiring image data containing a target product and carrying out quality detection on the image data so as to clean the image data with unqualified quality;
the image data identification module is used for processing image data with qualified quality according to the image identification model and identifying the name of a target product, the quantity of the target product and the coordinates of the target product in the image data;
the product judgment module is used for judging whether the position of the target product meets the condition of reasonable placement of the product or not according to the name of the target product and the coordinate of the target product; wherein, the condition of the reasonable placement of the products comprises: the number of layers of the target product to be placed meets the preset number of layers and whether the competitive products exist in the preset range of the placing position of the target product;
and the data storage module is used for storing the name of the target product, the number of the target products, the coordinate of the target product and the judgment result in a database and generating a report.
A third aspect of the present invention provides an electronic device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor, when executing the computer program, implements the product data processing method applied to the fast-moving industry as described in any one of the first aspects.
A fourth aspect of the present invention provides a computer-readable storage medium, where the computer-readable storage medium includes a stored computer program, where when the computer program runs, the apparatus where the computer-readable storage medium is located is controlled to execute the product data processing method applied to the fast-moving industry as described in any one of the first aspects.
Compared with the prior art, the embodiment of the invention has the beneficial effects that:
the invention provides a product data processing method and a system applied to the fast-moving industry, wherein the method comprises the following steps: acquiring image data containing a target product, and performing quality detection on the image data to clean the image data with unqualified quality; processing image data with qualified quality according to an image recognition model, and recognizing the name of a target product, the number of the target product and the coordinates of the target product in the image data; judging whether the position of the target product meets the condition of reasonably placing the product or not according to the name of the target product and the coordinate of the target product; wherein, the condition of the reasonable placement of the products comprises: the number of layers of the target product to be placed meets the preset number of layers and whether the competitive products exist in the preset range of the placing position of the target product; and storing the name of the target product, the number of the target products, the coordinates of the target products and the judgment result in a database, and generating a report. Compared with the existing product data processing method, the invention provides the method for analyzing the picture data by using the image recognition technology and achieving the purpose of dynamically counting the data by dynamically executing the calculation rule, million-level product picture data can be counted in one day, and the efficiency is improved by 90%.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be understood that the step numbers used herein are for convenience of description only and are not intended as limitations on the order in which the steps are performed.
It is to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the specification of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
The terms "comprises" and "comprising" indicate the presence of the described features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
The term "and/or" refers to and includes any and all possible combinations of one or more of the associated listed items.
A first aspect.
Referring to fig. 1-3, an embodiment of the present invention provides a product data processing method applied in fast-moving industry, including:
and S10, acquiring image data containing the target product, and performing quality detection on the image data to clean the image data with unqualified quality.
And S20, processing the image data with qualified quality according to the image recognition model, and recognizing the name, the number and the coordinates of the target product in the image data.
S30, judging whether the position of the target product meets the condition of reasonable placement of the product or not according to the name of the target product and the coordinate of the target product; wherein, the condition of the reasonable placement of the products comprises: the number of layers of the target product can meet the preset number of layers and whether the competitive products exist in the preset range of the target product placing position.
And S40, storing the name of the target product, the quantity of the target product, the coordinate of the target product and the judgment result in a database, and generating a report.
Further, the step S30 includes:
and S311, calculating the distance between the competitive products and the target products according to the coordinates of the competitive products and the coordinates of the target products.
And S312, judging whether the distance is smaller than a double value of the width of the target product.
And S313, if yes, reserving the competitive products in the range.
And S314, if not, determining the competitive products which do not exist in the preset range.
Further, the step S30 further includes:
s321, traversing all the target products, and judging whether the layer number of the target product is the second layer or the third layer.
And S322, if so, the number of layers of the target product meets the preset number of layers.
S323, if not, the number of layers of the target product does not meet the preset number of layers.
Further, step S20 is preceded by:
acquiring a plurality of image data containing target products, and manually labeling the names of the target products, the quantity of the target products and the coordinates of the target products in the image data;
carrying out inference model training on a plurality of image data obtained by artificial labeling through a full-connection neural network, and calculating a loss function value;
and adjusting parameters of model training to enable the loss function value to be smaller than a preset number, and finishing the training of the image recognition model.
Preferably, the loss function value is calculated by the following formula:
wherein Loss is a Loss function value, n is a total number of image data, i is ith image data, and yiTo label the image name and coordinates, xiTo label the pixel values of the image, w and b are both model training learning parameters.
Further, the step S10 includes:
calculating the peak signal-to-noise ratio of the image data, and taking the peak signal-to-noise ratio as the quality standard of the image data;
and taking the image data with the peak signal-to-noise ratio lower than 100 as image data with unqualified quality.
Preferably, the peak signal-to-noise ratio is calculated by the following formula:
PSNR is the peak signal-to-noise ratio of the image data, MAX is a fixed value, 255 is taken, and MSE is the mean square error of pixels of the image data;
wherein the MSE is calculated by the following equation:
where MSE is the mean square error of the pixels of the image data, M is the width of the image, N is the length of the image, f (x, y) is the pixel value, f-1(x, y) is the mean value of the pixel points, x is the abscissa of the pixel points, and y is the ordinate of the pixel points.
Compared with the existing product data processing method, the invention provides the method for analyzing the picture data by using the image recognition technology and achieving the purpose of dynamically counting the data by dynamically executing the calculation rule, million-level product picture data can be counted in one day, and the efficiency is improved by 90%.
Referring to fig. 4-7, another embodiment of the present invention provides a product data processing method applied in fast-moving industries, including:
(1) and acquiring product picture resources.
(2) And judging whether the picture is real and effective or not through the picture quality detection capability.
(3) And obtaining the product data of the picture through the image recognition capability.
(4) And acquiring a product calculation rule.
(5) And (4) compiling and executing the product data obtained in the step (3) according to the calculation rule obtained in the step (4) to obtain calculated product goods laying data.
Specifically, the method comprises the following steps:
(1) the background service queries the product picture data (picture valid access address url) from the database.
(2) And (2) calling a picture quality detection service (having picture quality detection capability and being capable of judging whether the picture quality is qualified) for the data obtained in the step (1). And discarding the picture with unqualified quality, and keeping the picture with qualified quality. In the embodiment, the picture quality detection service determines based on the blur degree, the blur image loss detail gradient is gentle, the PSNR (peak signal-to-noise ratio) can be calculated to determine the quality, the higher the PSNR value is, the less the picture distortion is represented, the higher the picture quality is, otherwise, the picture with low quality is obtained. PSNR (peak signal-to-noise ratio) calculation formula of picture is as follows:
where MAX is 255, MSE is the mean square error of the pixel, and the mean square error calculation formula of the pixel is as follows
Where M is the width of the picture, N is the length of the picture, f (x, y) is the pixel value, f1(x, y) is the mean of the pixels.
In this embodiment, the threshold of the peak snr is 100, and if the peak snr is less than 100, the picture quality is considered to be unqualified, otherwise the picture quality is considered to be qualified.
(3) And (3) calling an image recognition service (having the capability of recognizing products, predicting the names, the number, the coordinates and the number of layers of the products in the pictures) according to the qualified picture data processed in the step (2) to obtain the names, the number and the coordinates of the products. In the embodiment, the image recognition service predicts the name, the coordinate and the number of layers of the commodity in the picture through the commodity prediction model, and then counts the quantity through traversal and summation. The commodity modeling mode is that firstly, a picture set containing products is collected, and the pictures are labeled manually to obtain the product names, the quantity and the coordinate information in the pictures. The inference model is then trained using fully-connected neural network (DNN) techniques, with the goal of "matching" the output of the inference model to the output of the true house number. And (3) feeding back the model inference effect through the Loss function Loss, wherein the model inference effect is the best when the Loss value is the minimum. The Loss function Loss is formulated as follows.
Wherein n is the total number of pictures, yiTo mark picture names and coordinates, xiTo label the picture pixel values, w and b are model training learning parameters. And (5) adjusting the model training learning parameters to minimize the Loss value, and finishing the model training at the moment.
(4) The product calculation rules (JavaScript code) are queried from the database. The calculation rules in this embodiment include three calculation rules, i.e., product quantity statistics, whether the products are adjacent to each other and whether the products are placed at proper positions.
The product quantity statistics is to count the total number of each product according to the product name, and the formula for calculating the total number of the products is as follows:
f=∑num;
where num represents the number of corresponding products.
And judging whether the distance between the product and the competitive product is less than 2 times of the product width according to the coordinate distance calculation company, if so, determining that the adjacent competitive product exists, and otherwise, determining that the adjacent competitive product does not exist. Coordinate distance calculation company is as follows:
f=|l1-l2|;
wherein l1As the x-axis coordinate position of the product, l2Is the coordinate position of the x axis of the competitive products.
The calculation rule for judging whether the proper position is placed is to traverse all the products to judge whether the layer number of the product is the second layer or the third layer, if the layer number of the product is the second layer or the third layer, the product can be considered to be placed at the proper position, otherwise, the product is considered not to be placed at the proper position.
(5) And (3) loading the product calculation rule (JavaScript code) obtained in the step (4) in the service, transmitting the product name, number, coordinates and the number information of the located layers obtained in the step (3), executing the JavaScript code, and storing the executed result data (the number of the products, whether the products are placed at proper positions, whether competitive products exist or not and the number of the competitive products) into a database for displaying in a page report form.
Compared with the prior art, the invention has the following advantages and beneficial effects:
1. the calculation rule is dynamically loaded, compiled and executed, and is more flexible;
2. the product picture data is submitted in real time by a salesman, the data is counted on the same day, and the report is output on the same day, so that the method is more efficient compared with manual counting entrusted to a third party;
3. the pictures are checked through the image quality detection capability, so that the product data are more real;
4. compared with the existing product data processing method, the image data is analyzed by using the image recognition technology, the aim of dynamically counting the data is fulfilled by dynamically executing the calculation rule, millions of product image data can be counted one day, and the efficiency is improved by 90%.
A second aspect.
Referring to fig. 8, an embodiment of the invention provides a product data processing system applied in fast moving consumer goods industry, including:
the image data screening module 100 is configured to obtain image data including a target product, and perform quality inspection on the image data to clean image data with unqualified quality.
And the image data identification module 200 is configured to process image data with qualified quality according to an image identification model, and identify a name of a target product, a quantity of the target product, and coordinates of the target product in the image data.
The product judgment module 300 is used for judging whether the position of the target product meets the condition of reasonable placement of the product according to the name of the target product and the coordinate of the target product; wherein, the condition of the reasonable placement of the products comprises: the number of layers of the target products meets the preset number of layers and whether the competitive products exist in the preset range of the target product placing positions.
And the data storage module 400 is used for storing the name of the target product, the number of the target products, the coordinates of the target products and the judgment result in a database and generating a report.
Further, the product determination module 300 is further configured to:
and calculating the distance between the competitive products and the target products according to the competitive product coordinates and the target product coordinates.
And judging whether the distance is less than a value twice the width of the target product.
If yes, the competitive products existing in the range are preset.
If not, the competitive products do not exist in the preset range.
Further, the product determination module 300 is further configured to:
and traversing all the target products, and judging whether the layer number of the target product is the second layer or the third layer.
If so, the number of layers of the target product meets the preset number of layers.
If not, the number of layers of the target product does not meet the preset number of layers.
Further, the system further comprises: an image recognition model building module to:
acquiring a plurality of image data containing target products, and manually labeling the names of the target products, the quantity of the target products and the coordinates of the target products in the image data;
carrying out inference model training on a plurality of image data obtained by artificial labeling through a full-connection neural network, and calculating a loss function value;
and adjusting parameters of model training to enable the loss function value to be smaller than a preset number, and finishing the training of the image recognition model.
Preferably, the loss function value is calculated by the following formula:
wherein Loss is a Loss function value, n is a total number of image data, i is ith image data, and yiTo label the image name and coordinates, xiTo label the pixel values of the image, w and b are both model training learning parameters.
Further, the image data filtering module 100 is further configured to:
calculating the peak signal-to-noise ratio of the image data, and taking the peak signal-to-noise ratio as the quality standard of the image data;
and taking the image data with the peak signal-to-noise ratio lower than 100 as image data with unqualified quality.
Preferably, the peak signal-to-noise ratio is calculated by the following formula:
PSNR is the peak signal-to-noise ratio of the image data, MAX is a fixed value, 255 is taken, and MSE is the mean square error of pixels of the image data;
wherein the MSE is calculated by the following equation:
where MSE is the mean square error of the pixels of the image data, M is the width of the image, N is the length of the image, f (x, y) is the pixel value, f-1(x, y) is the mean of the pixel points, x is the abscissa of the pixel point, and y is the ordinate of the pixel point.
The product data processing system applied to the fast-moving industry provided by the invention analyzes the picture data by using the image recognition technology, achieves the purpose of dynamically counting the data by dynamically executing the calculation rule, and can count the million-level product picture data in one day, so that the efficiency is improved by 90%.
In a third aspect.
The present invention provides an electronic device, including:
a processor, a memory, and a bus;
the bus is used for connecting the processor and the memory;
the memory is used for storing operation instructions;
the processor is configured to invoke the operation instruction, and the executable instruction enables the processor to execute an operation corresponding to the product data processing method applied to the fast moving product industry, as shown in the first aspect of the present application.
In an alternative embodiment, an electronic device is provided, as shown in fig. 9, the electronic device 5000 shown in fig. 9 includes: a processor 5001 and a memory 5003. The processor 5001 and the memory 5003 are coupled, such as via a bus 5002. Optionally, the electronic device 5000 may also include a transceiver 5004. It should be noted that the transceiver 5004 is not limited to one in practical application, and the structure of the electronic device 5000 is not limited to the embodiment of the present application.
The processor 5001 may be a CPU, general purpose processor, DSP, ASIC, FPGA or other programmable logic device, transistor logic device, hardware component, or any combination thereof. Which may implement or execute the various illustrative logical blocks, modules, and circuits described in connection with the disclosure herein. The processor 5001 may also be a combination of processors implementing computing functionality, e.g., a combination comprising one or more microprocessors, a combination of DSPs and microprocessors, or the like.
Bus 5002 may include a path that conveys information between the aforementioned components. Bus 5002 may be a PCI bus or EISA bus or the like. The bus 5002 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in FIG. 9, but this does not indicate only one bus or one type of bus.
The memory 5003 may be, but is not limited to, a ROM or other type of static storage device that can store static information and instructions, a RAM or other type of dynamic storage device that can store information and instructions, an EEPROM, a CD-ROM or other optical disk storage, optical disk storage (including compact disk, laser disk, optical disk, digital versatile disk, blu-ray disk, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer.
The memory 5003 is used for storing application program codes for executing the present solution, and the execution is controlled by the processor 5001. The processor 5001 is configured to execute application program code stored in the memory 5003 to implement the teachings of any of the foregoing method embodiments.
Among them, electronic devices include but are not limited to: mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and the like, and fixed terminals such as digital TVs, desktop computers, and the like.
A fourth aspect.
The present invention provides a computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements a product data processing method applied to the fast-moving industry as shown in the first aspect of the present application.
Yet another embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, which, when run on a computer, enables the computer to perform the corresponding content in the aforementioned method embodiments.