Material quantity change category identification method and device

By comparing the material detection results of video images and using twin network processing, the material quantity change categories are identified, which solves the problem that traditional methods cannot identify the quantity changes of different material categories and improves the identification accuracy.

CN112464698BActive Publication Date: 2024-08-23SHENGJING INTELLIGENT TECH (JIAXING) CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202010735393.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-07-27
Publication Date
2024-08-23
Estimated Expiration
2040-07-27

AI Technical Summary

Technical Problem

Existing material quantity change identification methods cannot effectively identify quantity change types of different material categories, especially in factory environments with a wide variety of materials. Traditional classification methods cannot solve the problem of being unable to identify quantity change types due to different material categories.

Method used

By comparing the material detection results of two adjacent frames of video images, the grayscale image and the difference image are calculated and merged into a fused image. The twin network is used to extract and train the features of the fused image to build a material quantity change category recognition model, and then identify the material quantity. Change category.

Benefits of technology

It effectively improves the problem of being unable to identify quantity change categories due to different material categories, improves the accuracy of identifying material quantity changes, and solves the identification problem in an environment with a wide variety of materials.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112464698B
    Figure CN112464698B
Patent Text Reader

Abstract

The present invention provides a method and device for identifying the category of material quantity changes, and relates to the field of quantity change category identification. The method includes: comparing the material detection results of two adjacent frames of video images to determine whether a change has occurred; calculating the grayscale image and the differential image of two adjacent frames of video images in which the material state has changed, and merging them into a fused image; using a twin network to extract features from any two fused images in the fused image to obtain corresponding features; using a twin network to train the corresponding features to obtain a material quantity change category identification model; inputting the fused image of any two adjacent frames of video images into the model to obtain a material quantity change category identification result. The method and device for identifying the category of material quantity changes of the embodiment of the present invention obtains a material quantity change category identification model by training the corresponding features of any two fused images using a twin network, so as to improve the problem that the quantity change category cannot be identified due to different material categories.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of quantity change category recognition, and in particular to a method and device for identifying the quantity change category of a material. Background Art

[0002] The existing method is to classify and predict the images before and after the material changes based on the classification network, including two categories: material increase and material decrease. However, there are many types of materials in the actual factory, and the quantity change characteristics of each material are very different. The traditional classification method alone cannot solve the problem of being unable to identify the type of quantity change due to different material categories. Summary of the invention

[0003] In view of this, an object of the present invention is to provide a method and device for identifying the category of material quantity changes, so as to improve the technical problem that the quantity change type cannot be identified due to different material categories.

[0004] In a first aspect, an embodiment of the present invention provides a method for identifying a material quantity change category, the method comprising the following steps:

[0005] Comparing the material detection results of two adjacent frames of video images to determine whether the material status of the two adjacent frames of video images has changed;

[0006] Calculating the grayscale image and the differential image of the two adjacent frames of video images in which the material state has changed, and merging the grayscale image and the differential image into a fused image;

[0007] Using the twin network to extract features from any two fused images in the fused image, and respectively obtain corresponding features of the any two fused images;

[0008] Using the twin network to train the corresponding features of any two fused images to obtain a material quantity change category recognition model;

[0009] The fused image of the grayscale image and the differential image of any two adjacent frames of video images is input into the material quantity change category recognition model to obtain the material quantity change category recognition result.

[0010] In combination with the first aspect, an embodiment of the present invention provides a first possible implementation of the first aspect, wherein, before the step of comparing the material detection results of two adjacent frames of video images to determine whether the material state of the two adjacent frames of video images has changed, the method further includes:

[0011] Collect multiple frames of video images of the material at preset time intervals, and extract the material detection results of two adjacent frames of video images.

[0012] In combination with the first aspect, an embodiment of the present invention provides a second possible implementation manner of the first aspect, wherein the video image is a three-channel color image, the three channels include an R channel, a G channel, and a B channel, and the step of calculating the grayscale image and the differential image of the two adjacent frames of video images in which the material state changes, and merging the grayscale image and the differential image into a fused image includes:

[0013] The grayscale images of the two adjacent frames of video images in which the material state has changed are calculated using the three-channel color images according to the grayscale image calculation formula, wherein the grayscale image calculation formula is: grayscale image = color image R channel * 0.299 + color image G channel * 0.587 + color image B channel * 0.114;

[0014] The differential image of the two adjacent frames of video images in which the material state has changed is calculated using the grayscale images of the two adjacent frames of video images according to the differential image calculation formula, wherein the differential image calculation formula is: differential image = (first grayscale image - second grayscale image + 255) / 2;

[0015] The grayscale images and the differential images of the two adjacent frames of video images are combined into a fused image.

[0016] In combination with the first aspect, an embodiment of the present invention provides a third possible implementation of the first aspect, wherein the step of using the twin network to train the corresponding features of any two fused images to obtain a material quantity change category recognition model includes:

[0017] Using the twin network, the corresponding features of any two fused images are multiplied by the classifier matrix to obtain two prediction vectors of the material quantity change categories in any two fused images;

[0018] constructing a loss function according to the two prediction vectors, the first true labels of the material quantity change categories of the two prediction vectors, and the second true labels of whether the material quantity change categories of the two prediction vectors are consistent;

[0019] Update the parameters in the twin network and the classifier according to the value of the loss function, and perform the next iteration after all the parameters in the twin network and the classifier are updated;

[0020] When the value of the loss function is less than a predetermined threshold, the iteration is terminated, and the final parameters in the twin network and the classifier are combined to obtain a material quantity change category recognition model.

[0021] In combination with the third possible implementation of the first aspect, the embodiment of the present invention provides a fourth possible implementation of the first aspect, wherein the step of updating the parameters in the twin network and the classifier according to the value of the loss function includes:

[0022] Calculating the gradient of the loss function to the parameters in the twin network and the classifier based on the stochastic gradient descent method according to the value of the loss function;

[0023] The gradient is multiplied by the learning rate to obtain the change value of the parameter, and combined with the parameter before the update to obtain the updated parameter.

[0024] In a second aspect, an embodiment of the present invention further provides a device for identifying a material quantity change category, the device comprising:

[0025] A judgment module, used to compare the material detection results of two adjacent frames of video images, and judge whether the material state of the two adjacent frames of video images has changed;

[0026] A calculation module, used for calculating the grayscale image and the differential image of the two adjacent frames of video images in which the material state has changed, and merging the grayscale image and the differential image into a fused image;

[0027] A feature extraction module, used to extract features from any two fused images in the fused image using a twin network, and obtain corresponding features of the any two fused images respectively;

[0028] A training module, used to train the corresponding features of any two fused images using the twin network to obtain a material quantity change category recognition model;

[0029] The input module is used to input a fused image of a grayscale image and a differential image of any two adjacent frames of video images into the material quantity change category recognition model to obtain a material quantity change category recognition result.

[0030] In combination with the second aspect, an embodiment of the present invention provides a first possible implementation manner of the second aspect, wherein the video image is a three-channel color image, the three channels include an R channel, a G channel, and a B channel, and the calculation module is used to:

[0031] The grayscale images of the two adjacent frames of video images in which the material state has changed are calculated using the three-channel color images according to the grayscale image calculation formula, wherein the grayscale image calculation formula is: grayscale image = color image R channel * 0.299 + color image G channel * 0.587 + color image B channel * 0.114;

[0032] The differential image of the two adjacent frames of video images in which the material state has changed is calculated using the grayscale images of the two adjacent frames of video images according to the differential image calculation formula, wherein the differential image calculation formula is: differential image = (first grayscale image - second grayscale image + 255) / 2;

[0033] The grayscale images and the differential images of the two adjacent frames of video images are combined into a fused image.

[0034] In combination with the second aspect, the embodiment of the present invention provides a second possible implementation of the second aspect, wherein the training module is used to:

[0035] Using the twin network, the corresponding features of any two fused images are multiplied by the classifier matrix to obtain two prediction vectors of the material quantity change categories in any two fused images;

[0036] constructing a loss function according to the two prediction vectors, the first true labels of the material quantity change categories of the two prediction vectors, and the second true labels of whether the material quantity change categories of the two prediction vectors are consistent;

[0037] Update the parameters in the twin network and the classifier according to the value of the loss function, and perform the next iteration after all the parameters in the twin network and the classifier are updated;

[0038] When the value of the loss function is less than a predetermined threshold, the iteration is terminated, and the final parameters in the twin network and the classifier are combined to obtain a material quantity change category recognition model.

[0039] In a third aspect, an embodiment of the present invention further provides a server, comprising: a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the method described above.

[0040] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the method described above.

[0041] The embodiments of the present invention bring the following beneficial effects: the embodiments of the present invention provide a method and device for identifying the category of material quantity changes, which compares the material detection results of two adjacent frames of video images to determine whether a change has occurred; calculates the grayscale image and the differential image of two adjacent frames of video images in which the material state has changed, and merges them into a fused image; uses a twin network to extract features from any two fused images in the fused image to obtain corresponding features; uses a twin network to train the corresponding features to obtain a model for identifying the category of material quantity changes; inputs the fused image of any two adjacent frames of video images into the model to obtain a result of identifying the category of material quantity changes. The method and device for identifying the category of material quantity changes of the embodiments of the present invention obtain a model for identifying the category of material quantity changes by training the corresponding features of any two fused images using a twin network, so as to improve the problem of being unable to identify the category of quantity changes due to different material categories.

[0042] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or be understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained in the structures particularly pointed out in the description, claims and drawings.

[0043] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.

[0045] Figure 1 A flow chart of a method for identifying a material quantity change category provided by an embodiment of the present invention;

[0046] Figure 2 A flowchart of another material quantity change category identification method provided by an embodiment of the present invention;

[0047] Figure 3 A structural block diagram of a device for identifying material quantity change categories provided by an embodiment of the present invention;

[0048] Figure 4 A schematic diagram of the structure of a server provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0049] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are 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 those skilled in the art without creative work are within the scope of protection of the present invention.

[0050] The existing method is to classify and predict the images before and after the material changes based on the classification network, including two categories: material increase and material reduction. However, there are many types of materials in actual factories, and the quantity change characteristics of each material are very different. The traditional classification method alone cannot solve the problem of being unable to identify the quantity change type due to different material categories. Based on this, the embodiment of the present invention provides a material quantity change category identification method and device to alleviate the above problem.

[0051] In order to facilitate the understanding of this embodiment, a material quantity change category identification method disclosed in an embodiment of the present invention is first introduced in detail.

[0052] In a possible implementation, the present invention provides a method for identifying the category of material quantity changes. Figure 1 The figure is a flow chart of a method for identifying a material quantity change category provided by an embodiment of the present invention, the method comprising the following steps:

[0053] Step S102: comparing the material detection results of two adjacent video frames to determine whether the material status of the two adjacent video frames has changed.

[0054] Step S104: Calculate the grayscale image and the differential image of the two adjacent frames of video images in which the material state has changed, and merge the grayscale image and the differential image into a fused image.

[0055] Step S106: Use the twin network to extract features from any two fused images in the fused image, and obtain corresponding features of the any two fused images respectively.

[0056] Among them, the twin networks are two networks with exactly the same hierarchical structure and parameters, which input paired images and output paired feature vectors for comparing the distance between paired feature vectors.

[0057] Step S108: Use the twin network to train the corresponding features of any two fused images to obtain a material quantity change category recognition model.

[0058] Step S110: inputting a fused image of a grayscale image and a differential image of any two adjacent frames of video images into the material quantity change category recognition model to obtain a material quantity change category recognition result.

[0059] The embodiments of the present invention bring the following beneficial effects: the embodiments of the present invention use a material quantity change category recognition method to compare the material detection results of two adjacent frames of video images to determine whether a change has occurred; by calculating the grayscale image and the differential image of two adjacent frames of video images in which the material state has changed, and merging them into a fused image; using the twin network to extract features from any two fused images in the fused image to obtain corresponding features; using the twin network to train the corresponding features to obtain a material quantity change category recognition model; inputting the fused image of any two adjacent frames of video images into the model to obtain a material quantity change category recognition result. The material quantity change category recognition method and device of the embodiment of the present invention obtains a material quantity change category recognition model by training the corresponding features of any two fused images using the twin network, so as to improve the problem that the quantity change category cannot be recognized due to different material categories.

[0060] In actual use, in order to Figure 1 The process of the method in is described in more detail. The embodiment of the present invention is Figure 2 A flowchart of another material quantity change category identification method provided by an embodiment of the present invention is shown in FIG. 1 , and the method comprises the following steps:

[0061] Step S202: collecting multiple frames of video images of the material at preset time intervals, and extracting material detection results of two adjacent frames of video images.

[0062] Step S204: comparing the material detection results of two adjacent video frames to determine whether the material status of the two adjacent video frames has changed.

[0063] Step S206: Calculate the grayscale images of the two adjacent frames of video images in which the material state has changed using the three-channel color image according to the grayscale image calculation formula.

[0064] The grayscale image calculation formula is: grayscale image = color image R channel*0.299+color image G channel*0.587+color image B channel*0.114.

[0065] Step S208: Calculate the differential image of the two adjacent frames of video images in which the material state has changed by using the grayscale images of the two adjacent frames of video images according to the differential image calculation formula.

[0066] The differential image calculation formula is: differential image=(first grayscale image-second grayscale image+255) / 2.

[0067] Step S210: merging the grayscale images and the differential images of the two adjacent frames of video images into a fused image.

[0068] Step S212: Use the twin network to extract features from any two fused images in the fused image, and obtain corresponding features of the any two fused images respectively.

[0069] Step S214: using the twin network to multiply the corresponding features of any two fused images with the classifier matrix, and respectively obtain two prediction vectors of the material quantity change category in any two fused images.

[0070] Among them, according to the multiplication of the corresponding features of any two fused images with the classifier matrix, two prediction vectors Pc(A) and Pc(B) representing the categories of material quantity change are obtained, wherein the two prediction vectors are k-dimensional vectors, representing the prediction probability values ​​of k categories, wherein k=3 in the present invention, and the categories are three categories of material increase, decrease and no change.

[0071] Step S216: construct a loss function according to the two prediction vectors, the first true label of the material quantity change category of the two prediction vectors, and the second true label of whether the material quantity change category of the two prediction vectors is consistent.

[0072] Among them, the first real label of the material quantity change category of the two predicted vectors and the second real label of whether the material quantity change category of the two predicted vectors is consistent are input, and the Softmax-loss function Lc and the Contrastive-loss function Ls are established, where Lc supervises the predicted vector and the real label of a single image, and Ls supervises whether the material quantity changes of the paired images are consistent, thereby calculating L c (P c (B), G c (B)) and L s (d(P c (A), P c (B)), G s (A, B)), that is

[0073]

[0074]

[0075] in Indicates P c (A) The probability of the tth class in the vector, Indicates P c (A) The probability that the category in the vector is the true label, and Same reason.

[0076]

[0077] Where I(x) is the indicative function, G s (A, B) = 1 means that the material quantity change categories of the two images are the same, G s (A, B) = 0 means that the material quantity change categories of the two images are different. If the material quantity change categories of the two images are the same, the feature distance a (P c (A), P c (B)) is smaller, the loss function value L s (d(P c (A), P c (B)), G s (A, B)) is smaller; if the material quantity change categories of the two images are different, the feature distance d(P c (A), P c (B)) is larger, the loss function value L s (d(P c (A), P c (B)), G s (A, B)) is smaller.

[0078] Construct the joint loss function L as the final loss function, that is,

[0079] L(θ,)=L c (P c (A), G c (A))-L c (P c (B), G c (B))-L s (d(P c (A), P c (B)), G s (A, B));

[0080] Calculate the joint loss function value L, and update the parameters in the twin network N and classifier C according to the stochastic gradient descent method.

[0081] Step S218: Update the parameters in the twin network and the classifier according to the value of the loss function, and perform the next iteration after all parameters in the twin network and the classifier are updated.

[0082] The step of updating the parameters in the twin network and the classifier according to the value of the loss function is implemented by the following steps:

[0083] (1) Calculate the gradient of the loss function with respect to the parameters in the twin network and the classifier based on the stochastic gradient descent method according to the value of the loss function.

[0084] (2) Multiplying the gradient by the learning rate to obtain the change value of the parameter, and combining it with the parameter before updating to obtain the updated parameter.

[0085] Step S220: When the value of the loss function is less than a predetermined threshold, the iteration is terminated, and the final parameters in the twin network and the classifier are combined to obtain a material quantity change category recognition model.

[0086] Step S222: inputting a fused image of a grayscale image and a differential image of any two adjacent frames of video images into the material quantity change category recognition model to obtain a material quantity change category recognition result.

[0087] In summary, the material quantity change category recognition method and device of the present invention determines whether a change has occurred by comparing the material detection results of two adjacent frames of video images; by calculating the grayscale image and the differential image of two adjacent frames of video images in which the material state has changed, and merging them into a fused image; using the twin network to extract features from any two fused images in the fused image to obtain corresponding features; using the twin network to train the corresponding features to obtain a material quantity change category recognition model; inputting the fused image of any two adjacent frames of video images into the model to obtain a material quantity change category recognition result. The material quantity change category recognition method and device of the embodiment of the present invention obtains a material quantity change category recognition model by training the corresponding features of any two fused images using the twin network, so as to improve the problem that the quantity change category cannot be recognized due to different material categories.

[0088] In another possible implementation manner, corresponding to the material quantity change category identification method provided in the above implementation manner, an embodiment of the present invention further provides a material quantity change category identification device, Figure 3 A structural block diagram of a device for identifying material quantity change categories provided by an embodiment of the present invention. Figure 3 As shown, the device comprises:

[0089] The judgment module 301 is used to compare the material detection results of two adjacent frames of video images to determine whether the material state of the two adjacent frames of video images has changed;

[0090] A calculation module 302 is used to calculate the grayscale image and the difference image of the two adjacent frames of video images in which the material state has changed, and merge the grayscale image and the difference image into a fused image;

[0091] A feature extraction module 303 is used to extract features from any two fused images in the fused image using a twin network to obtain corresponding features of the any two fused images;

[0092] A training module 304 is used to train the corresponding features of any two fused images using the twin network to obtain a material quantity change category recognition model;

[0093] The input module 305 is used to input a fused image of a grayscale image and a differential image of any two adjacent frames of video images into the material quantity change category recognition model to obtain a material quantity change category recognition result.

[0094] In actual use, the video image is a three-channel color image, the three channels include an R channel, a G channel and a B channel, and the calculation module is used for:

[0095] The grayscale images of the two adjacent frames of video images in which the material state has changed are calculated using the three-channel color images according to the grayscale image calculation formula, wherein the grayscale image calculation formula 302 is: grayscale image = color image R channel * 0.299 + color image G channel * 0.587 + color image B channel * 0.114;

[0096] The differential image of the two adjacent frames of video images in which the material state has changed is calculated using the grayscale images of the two adjacent frames of video images according to the differential image calculation formula, wherein the differential image calculation formula is: differential image = (first grayscale image - second grayscale image + 255) / 2;

[0097] Merge the grayscale images and differential images of the two adjacent frames of video images into a fused image

[0098] In actual use, the training module is used to:

[0099] Using the twin network, the corresponding features of any two fused images are multiplied by the classifier matrix to obtain two prediction vectors of the material quantity change categories in any two fused images;

[0100] constructing a loss function according to the two prediction vectors, the first true labels of the material quantity change categories of the two prediction vectors, and the second true labels of whether the material quantity change categories of the two prediction vectors are consistent;

[0101] Update the parameters in the twin network and the classifier according to the value of the loss function, and perform the next iteration after all the parameters in the twin network and the classifier are updated;

[0102] When the value of the loss function is less than a predetermined threshold, the iteration is terminated, and the final parameters in the twin network and the classifier are combined to obtain a material quantity change category recognition model.

[0103] In another possible implementation manner, the embodiment of the present invention further provides a server, Figure 4 A schematic diagram of the structure of a server provided by an embodiment of the present invention is shown. Figure 4 The server includes: a processor 400, a memory 401, a bus 402 and a communication interface 403, wherein the processor 400, the memory 401, the communication interface 403 are connected via the bus 402; the processor 400 is used to execute an executable module stored in the memory 401, such as a computer program.

[0104] The memory 401 stores computer executable instructions that can be executed by the processor 400 , and the processor 400 executes the computer executable instructions to implement the method described above.

[0105] Furthermore, the memory 401 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 403 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used.

[0106] The bus 402 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0107] Among them, the memory 401 is used to store programs, and the processor 400 executes the program after receiving the program execution instruction. The material quantity change category identification method disclosed in any of the above-mentioned embodiments of the present invention can be applied to the processor 400, or implemented by the processor 400.

[0108] In addition, the processor 400 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 400. The above processor 400 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present invention can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 401, and the processor 400 reads the information in the memory 401 and completes the steps of the above method in combination with its hardware.

[0109] In another possible implementation, an embodiment of the present invention further provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the method described above.

[0110] The material quantity change category identification device provided in the embodiment of the present invention has the same technical features as the material quantity change category identification method provided in the above embodiment, so it can also solve the same technical problems and achieve the same technical effects.

[0111] The computer program product of the material quantity change category identification method and device provided in the embodiments of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the method described in the previous method embodiments. The specific implementation can be found in the method embodiments, which will not be repeated here.

[0112] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0113] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, and it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0114] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RanDom Access Memory), disk or optical disk, and other media that can store program codes.

[0115] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0116] Finally, it should be noted that the above embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above embodiments, those skilled in the art should understand that any person skilled in the art can still modify the technical solutions recorded in the above embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A method for identifying material quantity change categories, characterized in that: The method comprises the following steps: Comparing the material detection results of two adjacent frames of video images to determine whether the material status of the two adjacent frames of video images has changed; Calculating the grayscale image and the differential image of the two adjacent frames of video images in which the material state has changed, and merging the grayscale image and the differential image into a fused image; Using the twin network to extract features from any two fused images in the fused image, and respectively obtain corresponding features of the any two fused images; The corresponding features of any two fused images are trained using the twin network to obtain a material quantity change category recognition model; including: Using the twin network, the corresponding features of any two fused images are multiplied by the classifier matrix to obtain two prediction vectors of the material quantity change categories in any two fused images; Constructing a loss function according to the two prediction vectors, the first true labels of the material quantity change categories of the two prediction vectors, and the second true labels of whether the material quantity change categories of any two prediction vectors are consistent; Update the parameters in the twin network and the classifier according to the value of the loss function, and perform the next iteration after all the parameters in the twin network and the classifier are updated; When the value of the loss function is less than a predetermined threshold, the iteration is terminated, and the final parameters in the twin network and the classifier are combined to obtain a material quantity change category recognition model; The fused image of the grayscale image and the differential image of any two adjacent frames of video images is input into the material quantity change category recognition model to obtain the material quantity change category recognition result.

2. The method according to claim 1, characterized in that Before comparing the material detection results of two adjacent frames of video images to determine whether the material state of the two adjacent frames of video images has changed, the method further includes: Collect multiple frames of video images of the material at preset time intervals, and extract the material detection results of two adjacent frames of video images.

3. The method according to claim 1, characterized in that The video image is a three-channel color image, the three channels include an R channel, a G channel and a B channel, and the step of calculating the grayscale image and the differential image of the two adjacent frames of the video image in which the material state changes, and merging the grayscale image and the differential image into a fused image includes: The grayscale images of the two adjacent frames of video images in which the material state has changed are calculated using the three-channel color images according to the grayscale image calculation formula, wherein the grayscale image calculation formula is: grayscale image = color image R channel * 0.299 + color image G channel * 0.587 + color image B channel * 0.114; The differential image of the two adjacent frames of video images in which the material state has changed is calculated using the grayscale images of the two adjacent frames of video images according to the differential image calculation formula, wherein the differential image calculation formula is: differential image = (first grayscale image - second grayscale image + 255) / 2; The grayscale images and the differential images of the two adjacent frames of video images are combined into a fused image.

4. The method according to claim 1, characterized in that: The step of updating the parameters in the twin network and the classifier according to the value of the loss function comprises: Calculating the gradient of the loss function to the parameters in the twin network and the classifier based on the stochastic gradient descent method according to the value of the loss function; The gradient is multiplied by the learning rate to obtain the change value of the parameter, and combined with the parameter before the update to obtain the updated parameter.

5. A material quantity change category identification device, characterized in that: The device comprises: A judgment module, used to compare the material detection results of two adjacent frames of video images, and judge whether the material state of the two adjacent frames of video images has changed; A calculation module, used for calculating the grayscale image and the differential image of the two adjacent frames of video images in which the material state has changed, and merging the grayscale image and the differential image into a fused image; A feature extraction module, used for extracting features from any two fused images in the fused image using a twin network, and obtaining corresponding features of the any two fused images respectively; A training module is used to train the corresponding features of any two fused images using the twin network to obtain a material quantity change category recognition model; the training module is used to: Using the twin network, the corresponding features of any two fused images are multiplied by the classifier matrix to obtain two prediction vectors of the material quantity change categories in any two fused images; constructing a loss function according to the two prediction vectors, the first true labels of the material quantity change categories of the two prediction vectors, and the second true labels of whether the material quantity change categories of the two prediction vectors are consistent; Update the parameters in the twin network and the classifier according to the value of the loss function, and perform the next iteration after all the parameters in the twin network and the classifier are updated; When the value of the loss function is less than a predetermined threshold, the iteration is terminated, and the final parameters in the twin network and the classifier are combined to obtain a material quantity change category recognition model; The input module is used to input a fused image of a grayscale image and a differential image of any two adjacent frames of video images into the material quantity change category recognition model to obtain a material quantity change category recognition result.

6. The device according to claim 5, characterized in that The video image is a three-channel color image, the three channels include an R channel, a G channel and a B channel, and the calculation module is used for: The grayscale images of the two adjacent frames of video images in which the material state has changed are calculated using the three-channel color images according to the grayscale image calculation formula, wherein the grayscale image calculation formula is: grayscale image = color image R channel * 0.299 + color image G channel * 0.587 + color image B channel * 0.114; The differential image of the two adjacent frames of video images in which the material state has changed is calculated using the grayscale images of the two adjacent frames of video images according to the differential image calculation formula, wherein the differential image calculation formula is: differential image = (first grayscale image - second grayscale image + 255) / 2; The grayscale images and the differential images of the two adjacent frames of video images are combined into a fused image.

7. A server, characterized in that: A processor and a memory are included, wherein the memory stores data that can be processed by the processor. The computer-executable instructions are executed by a processor, and the processor executes the computer-executable instructions to implement the method according to any one of claims 1 to 4.

8. A computer-readable storage medium, characterized in that: The computer readable storage medium stores computer readable An execution instruction, when the computer executable instruction is called and executed by a processor, the computer executable instruction prompts the processor to implement the method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • A subway carriage passenger flow density monitoring system and method based on image recognition

    CN109815882A

  • Target tracking method and device, storage medium and electronic equipment

    CN110555405A

  • Article intelligent detection method and system, computing device and storage medium

    CN110765990A

  • Livestock quantity determination method, terminal and computer storage medium

    CN111008561A

  • Tea verification method based on exclusive twin network model

    CN111275137A