A commodity image recognition method and system based on distributed deep learning

By utilizing a distributed deep learning-based product image recognition method and the collaborative work of master and slave nodes, the system addresses the issues of complex operation and underutilized computing resources in existing systems. This approach maximizes the utilization of computing resources and enables a fully automated image classification process, thereby reducing enterprise costs and lowering the barrier to entry for users.

CN115908916BActive Publication Date: 2026-01-23HUNAN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211443275.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-17
Publication Date
2026-01-23
Estimated Expiration
2042-11-17

AI Technical Summary

Technical Problem

Existing product management systems fail to effectively integrate distributed deep learning, resulting in complex operations, high requirements for computing equipment, underutilization of computing resources, and high demands on personnel's computer expertise, thus increasing enterprise costs and wasting human and material resources.

Method used

A product image recognition method based on distributed deep learning is adopted. Through the collaborative work of the master node and multiple slave nodes, the product images are automatically classified and archived. The computing resources in the cluster are utilized, and a user-friendly graphical interface is provided to reduce the complexity of operation and the threshold of computing equipment.

Benefits of technology

It maximizes the utilization of computing resources, reduces the cost of purchasing or renting equipment for enterprises, improves operational efficiency and user experience, reduces the requirements for computer expertise, and realizes a fully automated image classification process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115908916B_ABST
    Figure CN115908916B_ABST
Patent Text Reader

Abstract

The application discloses a kind of commodity image recognition methods based on distributed deep learning, comprising the following steps: master node obtains multiple commodity pictures {p0, p1,..., p n‑1} And all commodity pictures are evenly distributed to all slave nodes, the i th slave node is according to the picture serial number set Assignment i Corresponding to all commodity pictures required to be identified, the long and wide size of each commodity picture corresponding to picture serial number set is reset, and after standardization processing, the tensor T corresponding to the commodity picture is obtained, the tensor set {T i} Corresponding to all commodity pictures, all tensors in the tensor set {T i} Corresponding to all commodity pictures obtained by the i th slave node in step (2) are sequentially input into the trained deep neural network model to obtain the identification result set {res i}, and the identification result set {res i} Is sent to master node, and each element in the identification result set {res i} It is binary tuple (index, class), and the application can solve the technical problem that the requirement threshold of equipment is high for picture classification using deep learning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of machine learning technology, and more specifically, relates to a product image recognition method and system based on distributed deep learning. Background Technology

[0002] In recent years, the development speed of big data and artificial intelligence technologies has been astonishing, forming an important part of China's "new infrastructure." Deep learning, a key field of artificial intelligence, has achieved remarkable results in data mining, search, natural language processing, speech and image processing. Many enterprises need to classify and manage their product images. However, many enterprises currently rely on manual classification, which cannot effectively utilize computers to complete large-scale product image classification and storage tasks; or the computing power of a single device cannot keep up with the growth rate of data, making computer-based classification impractical. Therefore, distributed deep learning is needed to solve these problems.

[0003] Most existing product management systems do not effectively integrate with deep learning. This means that deep learning must first be used to classify product images before the classification results are entered into the product management system. Furthermore, existing deep learning-based image classification systems primarily use devices with graphics processing units (GPUs) to accelerate the automatic image recognition and classification task.

[0004] However, existing image classification management systems have some significant drawbacks: First, most existing image classification management systems have failed to effectively integrate with distributed deep learning. Using existing recognition systems for image recognition requires manual task allocation, which is cumbersome, complex, and inefficient. Furthermore, the entire process may require multiple people working together, wasting human and material resources. Second, using deep learning for image classification places high demands on computing equipment, often requiring specific graphics processors. This may prevent companies from maximizing the use of existing computing resources and increases their costs. Third, existing distributed deep learning technologies have failed to effectively interact with existing image classification management systems, often resulting in computational results that are "incomprehensible" when using deep learning to complete related tasks, requiring a high level of technical expertise. Summary of the Invention

[0005] To address the aforementioned shortcomings or improvement needs of existing technologies, this invention provides a product image recognition system based on distributed deep learning. Its objectives are threefold: first, to solve the problem of high equipment requirements for image classification using deep learning, thereby improving the utilization rate of existing enterprise computing equipment by clustering multiple computers for recognition, reducing the cost of purchasing or leasing equipment; second, to solve the problem of complex operation processes in existing product management and classification systems, reducing operational complexity and achieving full automation of image and classification processes; and third, to address the problem of high computer expertise requirements for personnel by providing a user-friendly graphical interface, lowering the barrier to entry for users.

[0006] To achieve the above objectives, according to one aspect of the present invention, a product image recognition method based on distributed deep learning is provided, which is applied in a distributed system including a master node and multiple slave nodes. The method includes the following steps:

[0007] (1) The main node retrieves multiple product images {p0, p1, ..., p...} n-1} and distribute all product images equally among all slave nodes, where the set of image indices corresponding to all product images to be identified by the i-th slave node is Assignment. i for:

[0008]

[0009] Where n represents the total number of product images, and N is the number of slave nodes in the cluster. This indicates taking the integer part of x, where i∈[0,N);

[0010] (2) The i-th slave node identifies the image sequence set corresponding to all product images according to the Assignment. i For each product image corresponding to the image sequence set, its dimensions are reset and standardized to obtain the tensor T corresponding to that product image. The tensors corresponding to all product images together constitute the tensor set {T}. i};

[0011] (3) The i-th slave node will transfer the tensor set {T} corresponding to all product images obtained in step (2). i All tensors in} are sequentially input into the trained deep neural network model to obtain the recognition result set {res}. i}, and the recognition result set {res i}Send to the master node, the recognition result set {res i Each element in the} is a tuple (index, class), where the first element, index, is the product image p. indexThe product image number, the second element has a class of product image p index The image recognition result sequence number;

[0012] (4) The master node calculates the recognition result set {res0}, {res1}, ..., {res} obtained from all slave nodes in step (3). N-1} Retrieve the recognition result numbers c0, c1, ..., c of all product images n-1 .

[0013] (5) The master node searches for the corresponding set of recognition result names in the system database based on the recognition result sequence number of all product images obtained in step (4).

[0014] (6) The master node uses the name set of the recognition results obtained in step (5) to select the product image {p0, p1, ..., p} obtained in step (1). n-1 Move (archive) them to the folder of their respective category to obtain the final recognition results.

[0015] Preferably, in step (2), the dimensions of the image after resetting are 32 pixels wide and 32 pixels wide. The tensor set {T} corresponding to all product images i In the array, each element has dimensions of 32×32×3, and {T} i The number of elements in} is |Assignment i | This stores the R / G / B values ​​of the three grayscale pixels in the image, and the tensor T i Each number in the set ranges from 0 to 255. Where |Assignment i |Assignment for the image sequence set i The number of elements within the i-th slave node is the number of images that the i-th slave node needs to recognize.

[0016] Preferably, the deep neural network model in step (3) is obtained by training all nodes in parallel through the following steps:

[0017] (3-1) The master node and all slave nodes obtain the image classification dataset and divide the image classification dataset into training set and test set in a 5:1 ratio.

[0018] (3-2) The i-th slave node initializes the parameters of the deep neural network model to obtain the initialized deep neural network model corresponding to the slave node.

[0019] (3-3) The master node selects batchsize images from the training set and distributes them equally among the slave nodes as the training set for each slave node, where batchsize is an integer multiple of N.

[0020] (3-4) The i-th slave node inputs the training set assigned to it by the master node into the deep neural network initialized in step (3-2). The network predictions are then calculated using the forward propagation algorithm, and the cross-entropy loss between the predicted network value and the true label is calculated. i The range of the image sequence number obtained from the i-th node is...

[0021] (3-5) The i-th slave node updates all weight parameters of the deep neural network model using the backpropagation algorithm based on the cross-entropy loss value between the network prediction value obtained in step (3-4) and the real label, so as to obtain the updated weight parameters corresponding to the slave node.

[0022] (3-6) All slave nodes exchange the weight parameters corresponding to all slave nodes after the update in step (3-5) to achieve synchronization of all weight parameters;

[0023] (3-7) Repeat steps (3-3) to (3-6) for the i-th slave node until the loss value of step (3-4) is obtained. i The training continues until the classification accuracy on the validation set reaches a predetermined value, which is between 0.8 and 1, preferably 0.95. This results in a deep neural network trained in parallel using a distributed cluster.

[0024] Preferably, in step (3-2), the initial value of the weight parameter is a random value output by a truncated normal distribution with a standard deviation of 0.1, the initial value of the bias parameter is set to 0, the initial learning rate is lr = 0.0003, and a stepwise learning strategy is adopted, multiplying the learning rate by 0.1 every 100 rounds.

[0025] Preferably, step (3-6) includes the following sub-steps:

[0026] (3-6-1) The i-th slave node divides the weight parameters corresponding to the slave node after the update in step (3-4) into N tensor partitions, where i∈[0,N). The q-th tensor partition (q∈[0,N)) corresponding to the p-th slave node (p∈[0,N)) is denoted as a shard. p,q ;

[0027] (3-6-2) Set the counter cnt1 = 0;

[0028] (3-6-3) Determine if cnt1 is less than N-1. If it is, proceed to step (3-6-4); otherwise, proceed to step (3-6-9).

[0029] (3-6-4) Set the counter cnt2 = 0;

[0030] (3-6-5) Determine if cnt2 is less than N. If it is, proceed to step (3-6-6); otherwise, proceed to step (3-6-8).

[0031] (3-6-6) Sharding (cnt1+cnt2)%N,cnt2 with shard (cnt1+cnt2+1)%N,cnt2 Perform the tensor merging operation and then update the shard with the merged result. (cnt1+cnt2+1)%N,cnt2 Tensor sharding is about to begin. (cnt1+cnt2)%N,cnt2 with shard (cnt1+cnt2+1)%N,cnt2 Perform tensor merging operations and save the computation results to a shard. (cnt1+cnt2+1)%N,cnt2 , where X%Y represents the modulo operation of X divided by Y;

[0032] (3-6-7) Set cnt2 = cnt2 + 1, and return to step (3-6-5);

[0033] (3-6-8) Set cnt1 = cnt1 + 1, and return to step (3-6-3);

[0034] (3-6-9) Set the counter cnt3 = 0;

[0035] (3-6-10) Determine if cnt3 is less than N-1. If it is, proceed to step (3-6-11). Otherwise, the process ends, which means that all slave nodes have completed the synchronization process of the model weight parameters for the current epoch.

[0036] (3-6-11) Set the counter cnt4 = 0;

[0037] (3-6-12) Determine if cnt4 is less than N. If it is, proceed to step (3-6-13); otherwise, proceed to step (3-6-15).

[0038] (3-6-13) Shard (cnt3+cnt4)%N,cnt4 The value is updated to shard (cnt3+cnt4+N-1)%N,cnt4 Then proceed to step (3-6-14);

[0039] (3-6-14) Set cnt4 = cnt4 + 1, and return to step (3-6-5);

[0040] (3-6-15) Set cnt3 = cnt3 + 1 and return to step (3-6-3).

[0041] Preferably, step (4) involves: processing the recognition result set {res0}, {res1}, ..., {res...} N-1 Perform the union operation {res0}∪{res1}∪…∪{res}N-1}, thus obtaining the set of recognition results for all product images R = {(0, class0), (1, class1), ..., (n-1, class...} n-1 Then, sort all elements in the recognition result set R according to the first element of the tuple (image number) in ascending order, and then output the second element of all tuples in the sorted result to obtain c0, c1, ..., c n-1 .

[0042] According to another aspect of the present invention, a product image recognition system based on distributed deep learning is provided, which is applied in a distributed system including a master node and multiple slave nodes, the system comprising:

[0043] The first module, located in the main node, is used to retrieve multiple product images {p0, p1, ..., p n-1} and distribute all product images equally among all slave nodes, where the set of image indices corresponding to all product images to be identified by the i-th slave node is Assignment. i for:

[0044]

[0045] Where n represents the total number of product images, and N is the number of slave nodes in the cluster. This indicates taking the integer part of x, where i∈[0,N);

[0046] The second module, located at the i-th slave node, is used to identify the image sequence set corresponding to all product images, as assigned. i For each product image corresponding to the image sequence set, its dimensions are reset and standardized to obtain the tensor T corresponding to that product image. The tensors corresponding to all product images together constitute the tensor set {T}. i};

[0047] The third module, located at the i-th slave node, is used to process the tensor set {T} corresponding to all product images obtained from the second module. i All tensors in} are sequentially input into the trained deep neural network model to obtain the recognition result set {res}. i}, and the recognition result set {res i}Send to the master node, the recognition result set {res i Each element in the} is a tuple (index, class), where the first element, index, is the product image p. index The product image number, the second element has a class of product image p index The image recognition result sequence number;

[0048] The fourth module, located on the master node, is used to calculate the recognition result set {res0}, {res1}, ..., {res} obtained from all slave nodes in the third module. N-1} Retrieve the recognition result numbers c0, c1, ..., c of all product images n-1 .

[0049] The fifth module, located on the main node, is used to search the system database for the corresponding set of recognition result names based on the recognition result sequence numbers of all product images obtained from the fourth module.

[0050] The sixth module, located on the main node, is used to combine the product images {p0, p1, ..., p...} obtained from the first module with the name set of recognition results obtained from the fifth module. n-1 Move (archive) them to the folder of their respective category to obtain the final recognition results.

[0051] In summary, compared with the prior art, the above-described technical solutions conceived by this invention can achieve the following beneficial effects:

[0052] (1) As the present invention adopts step (1), it provides a user-friendly graphical page for human-computer interaction for users to use. Users can upload the images to be recognized to the system according to the system prompts. The system can automatically allocate image recognition tasks to all nodes in the cluster, which greatly reduces the threshold of inputting the input content into the computer.

[0053] (2) Since the present invention adopts steps (2)-(4), the system can automatically call the prediction command to use all machines in the cluster to perform the prediction process of distributed deep learning, utilize the computing resources of all machines in the cluster to complete the task, maximize the utilization of resources, and ultimately save the user's waiting time.

[0054] (3) As the present invention adopts steps (5)-(6), the output results that the user cannot clearly identify are transformed into results that the user can clearly identify after querying the database in the system; the training prediction results are combined with the actual production needs, and the archives are classified according to the user's actual needs, and the computer is used to replace the manual to perform complex classification operations, thereby improving the user's experience. Attached Figure Description

[0055] Figure 1 This is a schematic diagram of the overall framework of the product image recognition method based on distributed deep learning of this invention;

[0056] Figure 2This invention compares the operating speed of the system cluster used with the operating speed and the running time required to process the same task using a single node.

[0057] Figure 3 This is a flowchart of the product image recognition method based on distributed deep learning according to the present invention. Detailed Implementation

[0058] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. Furthermore, the technical features involved in the various embodiments of this invention described below can be combined with each other as long as they do not conflict with each other.

[0059] This invention is based on distributed deep learning. It visualizes the input and output of deep neural network models that are difficult for ordinary users to understand and provides a graphical interface for users to use. At the same time, users can choose to form a cluster of multiple personal computers on the same local area network to complete the calculation together. This simplifies the operation, improves the system's processing power, and saves users' valuable time.

[0060] like Figure 1 and Figure 3 As shown, this invention provides a product image recognition method based on distributed deep learning, which is applied in a distributed system including a master node and multiple slave nodes. The method includes the following steps:

[0061] (1) The main node retrieves multiple product images {p0, p1, ..., p...} n-1} and distribute all product images equally among all slave nodes, with the i-th slave node needing to identify all product images as the set of image indices corresponding to the images in the set Assignment. i for:

[0062]

[0063] Where n represents the total number of product images, and N is the number of slave nodes in the cluster. This indicates taking the integer part of x, where i∈[0,N);

[0064] (2) The i-th slave node identifies the image sequence set corresponding to all product images according to the Assignment. i For each product image corresponding to the image sequence set, its dimensions are reset and standardized to obtain the tensor T corresponding to that product image. The tensors corresponding to all product images together constitute the tensor set {T}. i};

[0065] Specifically, the resized images are 32 pixels wide and 32 pixels high. The tensor set {T} corresponds to all product images. i In the array, each element has dimensions of 32×32×3, and {T} i The number of elements in} is |Assignment i | It stores the R / G / B values ​​(i.e., Red, Green, and Blue) of three grayscale images in the image pixels, and the tensor T i Each number in the set ranges from 0 to 255. Where |Assignment i |Assignment for the image sequence set i The number of elements within the i-th slave node is the number of images that the i-th slave node needs to recognize.

[0066] (3) The i-th slave node will transfer the tensor set {T} corresponding to all product images obtained in step (2). i All tensors in} are sequentially input into the trained deep neural network model to obtain the recognition result set {res}. i}, and the recognition result set {res i}Send to the master node, the recognition result set {res i Each element in the} is a tuple (index, class), where the first element, index, is the product image p. index The product image number, the second element has a class of product image p index The image recognition result sequence number;

[0067] The deep neural network model in this step is obtained by training all nodes in parallel through the following steps:

[0068] (3-1) The master node and all slave nodes obtain the image classification dataset and divide the image classification dataset into training set and test set in a 5:1 ratio.

[0069] Specifically, the image classification dataset used in this step is the entire image data from the CIFAR-10 dataset. This invention adopts the partitioning method from the official dataset, extracting all images of multiple categories from this dataset for training to reduce random errors.

[0070] (3-2) The i-th slave node initializes the parameters of the deep neural network model to obtain the initialized deep neural network model corresponding to the slave node.

[0071] Specifically, in this step, the initial value of the weight parameter is a random value output by a truncated normal distribution with a standard deviation of 0.1, the initial value of the bias parameter is set to 0, the initial learning rate is lr = 0.0003, and a stepwise learning strategy is adopted, multiplying the learning rate by 0.1 every 100 epochs.

[0072] (3-3) The master node selects batchsize images from the training set and distributes them equally among the slave nodes as the training set for each slave node, where batchsize is an integer multiple of N.

[0073] (3-4) The i-th slave node inputs the training set assigned to it by the master node into the deep neural network initialized in step (3-2). The network predictions are then calculated using the forward propagation algorithm, and the cross-entropy loss between the predicted network value and the true label is calculated. i The range of the image sequence number obtained from the i-th node is...

[0074] (3-5) The i-th slave node updates all weight parameters of the deep neural network model using the backpropagation algorithm based on the cross-entropy loss value between the network prediction value obtained in step (3-4) and the real label, so as to obtain the updated weight parameters corresponding to the slave node.

[0075] (3-6) All slave nodes exchange the weight parameters corresponding to all slave nodes after the update in step (3-5) to achieve synchronization of all weight parameters;

[0076] In the training process of distributed deep learning, weight synchronization of the deep neural network model is one of the most important steps. Synchronization is to integrate the training results of all nodes in a timely manner, so as to accelerate training and model convergence through multi-node parallelism.

[0077] Specifically, this invention uses a ring logic network structure to achieve parameter synchronization, and steps (3-6) include the following sub-steps:

[0078] (3-6-1) The i-th slave node divides the weight parameters corresponding to the slave node after the update in step (3-4) into N tensor partitions, where i∈[0,N). The q-th tensor partition (q∈[0,N)) corresponding to the p-th slave node (p∈[0,N)) is denoted as a shard. p,q ;

[0079] (3-6-2) Set the counter cnt1 = 0;

[0080] (3-6-3) Determine if cnt1 is less than N-1. If it is, proceed to step (3-6-4); otherwise, proceed to step (3-6-9).

[0081] (3-6-4) Set the counter cnt2 = 0;

[0082] (3-6-5) Determine if cnt2 is less than N. If it is, proceed to step (3-6-6); otherwise, proceed to step (3-6-8).

[0083] (3-6-6) Sharding (cnt1+cnt2)%N,cnt2 with shard (cnt1+cnt2+1)%N,cnt2 Perform the tensor merging operation and then update the shard with the merged result. (cnt1+cnt2+1)%N,cnt2 Tensor sharding is about to begin. (cnt1+cnt2)%N,cnt2 with shard (cnt1+cnt2+1)%N,cnt2 Perform tensor merging operations and save the computation results to a shard. (cnt1+cnt2+1)%N,cnt2 , where X%Y represents the modulo operation of X divided by Y;

[0084] (3-6-7) Set cnt2 = cnt2 + 1, and return to step (3-6-5);

[0085] (3-6-8) Set cnt1 = cnt1 + 1, and return to step (3-6-3);

[0086] Steps (3-6-2) through (3-6-8) represent the process of exchanging the current weight parameters among the nodes. After completing steps (3-6-2) through (3-6-8), it means that all the current weight parameters of the model have been exchanged. However, the exchanged weight parameter tensor fragments are currently stored on different nodes. All nodes need to continue the iterative synchronization process of the exchanged weight parameter tensor fragments according to the following steps to ensure that all nodes eventually synchronize the model weight parameters.

[0087] (3-6-9) Set the counter cnt3 = 0;

[0088] (3-6-10) Determine if cnt3 is less than N-1. If it is, proceed to step (3-6-11). Otherwise, the process ends, which means that all slave nodes have completed the synchronization process of the model weight parameters for the current epoch.

[0089] (3-6-11) Set the counter cnt4 = 0;

[0090] (3-6-12) Determine if cnt4 is less than N. If it is, proceed to step (3-6-13); otherwise, proceed to step (3-6-15).

[0091] (3-6-13) Shard (cnt3+cnt4)%N,cnt4 The value is updated to shard (cnt3+cnt4+N-1)%N,cnt4Then proceed to step (3-6-14);

[0092] (3-6-14) Set cnt4 = cnt4 + 1, and return to step (3-6-5);

[0093] (3-6-15) Set cnt3 = cnt3 + 1, and return to step (3-6-3);

[0094] The advantage of steps (3-6-1) to (3-6-15) lies in that, by forming all slave nodes into a ring-shaped communication structure and appropriately dividing the deep neural network model weights, the goal is achieved that during the model weight parameter synchronization process, each slave node communicates only with its adjacent successor node in the ring-shaped logical network structure, thereby ensuring that bandwidth resources among all nodes in the cluster can be fully utilized. Compared with the currently widely used method of centrally storing model weights, this invention can complete the model weight synchronization process much faster.

[0095] (3-7) Repeat steps (3-3) to (3-6) for the i-th slave node until the loss value of step (3-4) is obtained. i The training continues until the classification accuracy on the validation set reaches a predetermined value, which is between 0.8 and 1, preferably 0.95. This results in a deep neural network trained in parallel using a distributed cluster.

[0096] (4) The master node calculates the recognition result set {res0}, {res1}, ..., {res} obtained from all slave nodes in step (3). N-1} Retrieve the recognition result numbers c0, c1, ..., c of all product images n-1 .

[0097] Specifically, this step involves processing the recognition result set {res0}, {res1}, ..., {res...}. N-1 Perform the union operation {res0}∪{res1}∪…∪{res} N-1}, thus obtaining the set of recognition results for all product images R = {(0, class0), (1, class1), ..., (n-1, class...} n-1 Then, sort all elements in the recognition result set R according to the first element of the tuple (image number) in ascending order, and then output the second element of all tuples in the sorted result to obtain c0, c1, ..., c n-1 .

[0098] The advantage of steps (2) to (4) is that the system can automatically call the prediction command to use all machines in the cluster to perform the distributed deep learning image recognition process, utilize the computing resources of all machines in the cluster to complete the image recognition task in parallel, maximize resource utilization, and ultimately save users' waiting time.

[0099] (5) The master node searches for the corresponding set of recognition result names in the system database based on the recognition result sequence number of all product images obtained in step (4).

[0100] The advantage of this step is that it transforms output results that are not clearly identifiable by the user into results that the user can clearly identify by querying the system's database.

[0101] (6) The master node uses the name set of the recognition results obtained in step (5) to select the product image {p0, p1, ..., p} obtained in step (1). n-1 Move (archive) them to the folder of their respective category to obtain the final recognition results.

[0102] The advantage of this step is that it combines the training prediction results with actual production needs, archives and classifies according to the actual needs of users, and uses computers to replace manual labor for complex classification operations.

[0103] Experimental results

[0104] The experimental environment for this invention: The system cluster contains 4 computing nodes, including 1 master node and 3 slave nodes. The master node is mainly responsible for scheduling image recognition tasks, while the slave nodes are mainly responsible for the computation of image recognition tasks. The master node is named master, and the three slave nodes are named worker1, worker2, and worker3, respectively. All nodes in the system have an Intel(R) Xeon(R) CPU E3-1230 V2@3.30GHz and 16GB of memory. In the cluster, the master node runs Ubuntu 16.04.3, worker1 and worker2 run Ubuntu 18.04.5, and worker3 runs Ubuntu 20.04.1. The nodes in the cluster are interconnected via a 100Mbps Ethernet switch. ① The additional environment used for distributed deep learning image recognition is as follows: Each node in the cluster uses Apache Hadoop Yarn version 3.2.2 as the cluster resource manager. The master node is the Namenode node, and worker1, worker2, and worker3 are Datanode nodes. Apache Spark was used as the parallel computing framework. Spark parameters were configured as follows: number of executors: 4; number of cores per executor: 3; memory allocated per executor: 5GB; driver memory: 2GB; number of cores allocated per driver: 4. The programming environments used were Python, Java, and Scala. The deep learning framework used was TensorFlow. ② Additional experimental environments used for the image management system included: Vue.js 3.0, SpringBoot, and MySQL.

[0105] To illustrate the speedup effect of this invention in computing nodes within a cluster without a graphics accelerator, i.e., to effectively save training and prediction time, the classic image classification dataset CIFAR-10 was used in the experiment. The model training runtime is shown in Table 1 below. Taking 100 training epochs as an example, training on a single machine takes approximately 14 hours and 28 minutes (including approximately 2 minutes of pre-training data preparation time); while training using the cluster described in the system takes approximately 7 hours and 29 minutes (including approximately 6 minutes of pre-training data preparation time). In other words, training using a cluster (1 master node + 3 slave nodes) can save approximately 48% of the time compared to training on a single machine (1 node). Figure 1As shown. When performing image classification and prediction tasks using the cluster described in the system, with a total of 2,379 images occupying a total disk size of 79.1 MB, the prediction speed using a single machine is 23 images / second; while using the cluster described in the system, the prediction speed is 79 images / second. The prediction speed using the cluster is approximately 3.43 times that of a single machine. Figure 2 As shown.

[0106] Table 1

[0107] Node configuration Model training time Predicting speed 1 node 14 hours and 28 minutes 23 images / second 1 master node + 3 slave nodes 7 hours and 29 minutes 79 images / second

[0108] Those skilled in the art will readily understand that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A product image recognition method based on distributed deep learning, applied in a distributed system including a master node and multiple slave nodes, characterized in that, The method includes the following steps: (1) The main node retrieves multiple product images {p0, p1, ..., p...} n-1 } and distribute all product images equally among all slave nodes, where the set of image indices corresponding to all product images to be identified by the i-th slave node is Assignment. i for: Where n represents the total number of product images, and N is the number of slave nodes in the cluster. This indicates taking the integer part of x, where i∈[0,N); (2) The i-th slave node identifies the image sequence set corresponding to all product images according to the Assignment. i For each product image corresponding to the image sequence set, its dimensions are reset and standardized to obtain the tensor T corresponding to that product image. The tensors corresponding to all product images together constitute the tensor set {T}. i }; (3) The i-th slave node will transfer the tensor set {T} corresponding to all product images obtained in step (2). i All tensors in} are sequentially input into the trained deep neural network model to obtain the recognition result set {res}. i }, and the recognition result set {res i }Send to the master node, the recognition result set {res i Each element in the} is a tuple (index, class), where the first element, index, is the product image p. index The product image number, the second element has a class of product image p index The image recognition result sequence number; the deep neural network model in step (3) is obtained by training all nodes in parallel through the following steps: (3-1) The master node and all slave nodes obtain the image classification dataset and divide the image classification dataset into training set and test set in a 5:1 ratio; (3-2) The i-th slave node initializes the parameters of the deep neural network model to obtain the initialized deep neural network model corresponding to the slave node; (3-3) The master node selects batchsize images from the training set and distributes them equally among the slave nodes as the training set for each slave node, where batchsize is an integer multiple of N; (3-4) The i-th slave node inputs the training set assigned to it by the master node into the deep neural network initialized in step (3-2). The network predictions are then calculated using the forward propagation algorithm, and the cross-entropy loss between the predicted network value and the true label is calculated. i The range of the image sequence number obtained from the i-th node is... (3-5) The i-th slave node updates all weight parameters of the deep neural network model using the backpropagation algorithm based on the cross-entropy loss value between the network prediction value obtained in step (3-4) and the real label, so as to obtain the updated weight parameters corresponding to the slave node. (3-6) All slave nodes exchange the weight parameters corresponding to all slave nodes after the update in step (3-5) to achieve synchronization of all weight parameters; (3-7) Repeat steps (3-3) to (3-6) for the i-th slave node until the loss value of step (3-4) is obtained. i The training continues until the classification accuracy of the validation set reaches a set value during the training process; the set value is between 0.8 and 1, thus obtaining a deep neural network trained in parallel using a distributed cluster. (4) The master node calculates the recognition result set {res0}, {res1}, ..., {res} obtained from all slave nodes in step (3). N-1 } Retrieve the recognition result numbers c0, c1, ..., c of all product images n-1 Step (4) involves processing the recognition result set {res0}, {res1}, ..., {res...}. N-1 Perform the union operation {res0}∪{res1}∪…∪{res} N-1 }, thus obtaining the set of recognition results for all product images R = {(0, class0), (1, class1), ..., (n-1, class...} n-1 Then, sort all elements in the recognition result set R according to the first element of the tuple in ascending order, and then output the second element of all tuples in the sorted result in sequence to obtain c0, c1, ..., c n-1 ; (5) The master node searches for the corresponding set of recognition result names in the system database based on the recognition result sequence number of all product images obtained in step (4). (6) The master node uses the name set of the recognition results obtained in step (5) to select the product image {p0, p1, ..., p} obtained in step (1). n-1 Move it to the folder of its category to get the final recognition result.

2. The product image recognition method based on distributed deep learning according to claim 1, characterized in that, In step (2), the dimensions of the images after resetting are 32 and 32 respectively; the tensor set {T} corresponding to all product images i In the array, each element has dimensions of 32×32×3, and {T} i The number of elements in} is |Assignment i | This stores the R / G / B values ​​of the three grayscale pixels in the image, and the tensor T i Each number in the assignment ranges from 0 to 255; where, |Assignment i |Assignment for the image sequence set i The number of elements within the i-th slave node is the number of images that the i-th slave node needs to recognize.

3. The product image recognition method based on distributed deep learning according to claim 2, characterized in that, In step (3-2), the initial value of the weight parameter is a random value output by a truncated normal distribution with a standard deviation of 0.

1. The initial value of the bias parameter is set to 0. The initial learning rate is lr = 0.0003. A stepwise learning strategy is adopted, and the learning rate is multiplied by 0.1 every 100 rounds.

4. The product image recognition method based on distributed deep learning according to claim 3, characterized in that, Steps (3-6) include the following sub-steps: (3-6-1) The i-th slave node divides the weight parameters corresponding to the slave node after the update in step (3-4) into N tensor partitions, where i∈[0,N). The q-th tensor partition corresponding to the p-th slave node is denoted as a shard. p,q Where p∈[0,N), q∈[0,N); (3-6-2) Set the counter cnt1 = 0; (3-6-3) Determine if cnt1 is less than N-1. If it is, proceed to step (3-6-4); otherwise, proceed to step (3-6-9). (3-6-4) Set the counter cnt2 = 0; (3-6-5) Determine if cnt2 is less than N. If it is, proceed to step (3-6-6); otherwise, proceed to step (3-6-8). (3-6-6) Sharding (cnt1+cnt2)%N,cnt2 with shard (cnt1+cnt2+1)%N,cnt2 Perform the tensor merging operation and then update the shard with the merged result. (cnt1+cnt2+1)%N,cnt2 Tensor sharding is about to begin. (cnt1+cnt2)%N,cnt2 with shard (cnt1+cnt2+1)%N,cnt2 Perform tensor merging operations and save the computation results to a shard. (cnt1+cnt2+1)%N,cnt2 , where X%Y represents the modulo operation of X divided by Y; (3-6-7) Set cnt2 = cnt2 + 1, and return to step (3-6-5); (3-6-8) Set cnt1 = cnt1 + 1, and return to step (3-6-3); (3-6-9) Set the counter cnt3 = 0; (3-6-10) Determine if cnt3 is less than N-1. If it is, proceed to step (3-6-11). Otherwise, the process ends, which means that all slave nodes have completed the synchronization process of the model weight parameters in the current round. (3-6-11) Set the counter cnt4 = 0; (3-6-12) Determine if cnt4 is less than N. If it is, proceed to step (3-6-13); otherwise, proceed to step (3-6-15). (3-6-13) Shard (cnt3+cnt4)%N,cnt4 The value is updated to shard (cnt3+cnt4+N-1)%N,cnt4 Then proceed to step (3-6-14); (3-6-14) Set cnt4 = cnt4 + 1, and return to step (3-6-5); (3-6-15) Set cnt3 = cnt3 + 1 and return to step (3-6-3).

5. A product image recognition system based on distributed deep learning, implemented using the product image recognition method based on distributed deep learning as described in claim 1, is applied in a distributed system including a master node and multiple slave nodes, characterized in that... The system includes: The first module, located in the main node, is used to retrieve multiple product images {p0, p1, ..., p n-1 } and distribute all product images equally among all slave nodes, where the set of image indices corresponding to all product images to be identified by the i-th slave node is Assignment. i for: Where n represents the total number of product images, and N is the number of slave nodes in the cluster. This indicates taking the integer part of x, where i∈[0,N); The second module, located at the i-th slave node, is used to identify the image sequence set corresponding to all product images, as assigned. i For each product image corresponding to the image sequence set, its dimensions are reset and standardized to obtain the tensor T corresponding to that product image. The tensors corresponding to all product images together constitute the tensor set {T}. i }; The third module, located at the i-th slave node, is used to process the tensor set {T} corresponding to all product images obtained from the second module. i All tensors in} are sequentially input into the trained deep neural network model to obtain the recognition result set {res}. i }, and the recognition result set {res i }Send to the master node, the recognition result set {res i Each element in the} is a tuple (index, class), where the first element, index, is the product image p. index The product image number, the second element has a class of product image p index The image recognition result sequence number; The fourth module, located on the master node, is used to calculate the recognition result set {res0}, {res1}, ..., {res} obtained from all slave nodes in the third module. N-1 } Obtain the recognition result numbers c0, c1, ..., c of all product images n-1 ; The fifth module, located on the main node, is used to search the system database for the corresponding set of recognition result names based on the recognition result sequence numbers of all product images obtained from the fourth module. The sixth module, located on the main node, is used to combine the product images {p0, p1, ..., p...} obtained from the first module with the name set of recognition results obtained from the fifth module. n-1 Move it to the folder of its category to get the final recognition result.

Citation Information

Patent Citations

  • Financial fraud behavior identification method based on Internet data

    CN111241077A

  • Distributed expression recognition method and system for classroom teaching

    CN113903072A