Package image recognition method, device, electronic device and storage medium
By calculating the display ratio and size ratio of the package image, we can determine whether the package is the same, and solve the problem that the same package image is mistakenly identified as different packages in the prior art, and improve the accuracy of data statistics and security inspection efficiency.
Patent Information
- Application Number
- CN202210218670.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-02
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2042-03-02
AI Technical Summary
In the prior art, multiple images corresponding to the same package are easily misidentified as different package images, resulting in data statistics errors and reduced security inspection efficiency.
By obtaining the package image to be identified, the image display ratio and package size ratio are calculated, and the difference between the two is determined. When the difference appears outside the preset value range, it is judged that the package is different.
It effectively solves the problem that the same package image is mistakenly recognized as a different package, and improves the accuracy of data statistics and security inspection efficiency.
Smart Images

Figure CN114708524B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing, and in particular to a package image recognition method, device, electronic device and storage medium. Background Art
[0002] In modern society, in order to quickly and effectively detect items that may threaten public safety, it is necessary to conduct security checks on luggage carried by people in some places. Therefore, security inspection equipment is widely used in airports, stations, exhibition centers, scenic spots, stadiums, etc. With the development of artificial intelligence technology, intelligent identification, classification and visual presentation of luggage items can be achieved during security checks, greatly improving the detection rate of dangerous items.
[0003] In the related technology, intelligent analysis is performed by collecting the video output by the security inspection equipment. Usually, the output frame rate of the security inspection equipment is between 60 and 120 frames. When a package enters and leaves the security inspection equipment, it will be collected and analyzed multiple times. Because the security inspector operates the image to zoom in or out when the package passes through the security inspection equipment, or because of interference from factors such as water ripples, horizontal and vertical stripes in the image itself, multiple images of the same package collected multiple times before and after may be different after processing. As a result, multiple images of the same package are mistakenly judged as images corresponding to different packages, and multiple identifications and data reporting are performed, which ultimately results in the storage of a large number of images of the same package, causing data statistical errors and reducing security inspection efficiency.
[0004] Currently, no effective solution has been proposed for the problem in related technologies that multiple images corresponding to the same package are mistakenly identified as images of different packages. Summary of the invention
[0005] The embodiments of the present application provide a package image recognition method, device, electronic device and storage medium to at least solve the problem in the related art that multiple images corresponding to the same package are mistakenly recognized as different package images.
[0006] In a first aspect, an embodiment of the present application provides a package image recognition method.
[0007] In some embodiments, the method comprises:
[0008] Acquire a first package image and a second package image to be identified, and determine an image display ratio between the second package image and the first package image;
[0009] Acquire a size of a first package in the first package image and a size of a second package in the second package image, calculate a ratio of the size of the second package to the size of the first package, and obtain a package size ratio;
[0010] A first difference between the image display ratio and the package size ratio is determined, and when the first difference is outside a preset value range, it is determined that the first package is different from the second package.
[0011] In some embodiments, determining the image display ratio between the second package image and the first package image includes:
[0012] acquiring a first image display coefficient in the first package image and a second image display coefficient in the second package image;
[0013] The ratio of the second image display coefficient to the first image display coefficient is calculated to obtain the image display ratio.
[0014] In some embodiments, the method further comprises:
[0015] When the first difference is within a preset value range, identifying the quantity of first items contained in the first package in the first package image and the quantity of second items contained in the second package in the second package image;
[0016] When the quantity of the first items is not equal to the quantity of the second items, it is determined that the first package is different from the second package.
[0017] In some embodiments, the method further comprises:
[0018] When the quantity of the first items is equal to the quantity of the second items, determining the types of the first items contained in the first package to obtain a first type set, and determining the types of the second items contained in the second package to obtain a second type set;
[0019] When the first category set is different from the second category set, it is determined that the first package is different from the second package.
[0020] In some embodiments, the method further comprises:
[0021] When the first category set is the same as the second category set, determining a correspondence between the first items and the second items, calculating a ratio of a size of each of the second items to a corresponding size of the first item, and obtaining a plurality of item size ratios;
[0022] A second difference between the image display ratio and the size ratio of each of the items is determined, and when at least one of the second differences is outside a preset value range, it is determined that the first package is different from the second package.
[0023] In some embodiments, determining the correspondence between the first item and the second item includes:
[0024] Determine a first position of each of the first objects in the first package image, and determine a second position of each of the second objects in the second package image, and determine a corresponding relationship between the first objects and the second objects based on the first positions and the second positions; and / or,
[0025] A corresponding relationship between the first object and the second object is determined according to a size of the first object and a size of the second object.
[0026] In some embodiments, the preset value range is from -0.1 to 0.1.
[0027] In a second aspect, an embodiment of the present application provides a package image recognition device.
[0028] In some embodiments, the device includes an image display ratio determination module, a package size ratio calculation module and a package image recognition module:
[0029] The image display ratio determination module is used to obtain a first package image and a second package image to be identified, and determine an image display ratio between the second package image and the first package image;
[0030] The package size ratio calculation module is used to obtain the size of the first package in the first package image and the size of the second package in the second package image, calculate the ratio of the size of the second package to the size of the first package, and obtain the package size ratio;
[0031] The package image recognition module is used to determine a first difference between the image display ratio and the package size ratio, and when the first difference is outside a preset value range, determine that the first package is different from the second package.
[0032] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the package image recognition method as described in the first aspect above is implemented.
[0033] In a fourth aspect, an embodiment of the present application provides a storage medium having a computer program stored thereon, which, when executed by a processor, implements the package image recognition method as described in the first aspect above.
[0034] Compared with the related art, the package image recognition method, device, electronic device and storage medium provided in the embodiments of the present application obtain a first package image and a second package image to be recognized, determine the image display ratio between the second package image and the first package image, obtain the size of the first package in the first package image and the size of the second package in the second package image, calculate the ratio of the size of the second package to the size of the first package, obtain the package size ratio, and determine a first difference between the image display ratio and the package size ratio. When the first difference is outside a preset numerical range, it is determined that the first package is different from the second package, which solves the problem in the related art that multiple images corresponding to the same package are mistakenly recognized as different package images, improves the accuracy of data statistics, and improves security inspection efficiency.
[0035] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0037] Figure 1 is a hardware structure block diagram of a terminal according to a package image recognition method according to an embodiment of the present application;
[0038] Figure 2 is a flow chart of a package image recognition method according to an embodiment of the present application;
[0039] Figure 3 is a flow chart of another package image recognition method according to an embodiment of the present application;
[0040] Figure 4 is a flow chart of a package image recognition method according to a preferred embodiment of the present application;
[0041] Figure 5 is a schematic diagram of a package image according to a package image recognition method according to a preferred embodiment of the present application;
[0042] Figure 6 4 is a structural block diagram of a package image recognition device according to an embodiment of the present application. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application. In addition, it can also be understood that although the efforts made in this development process may be complex and lengthy, for ordinary technicians in the field related to the contents disclosed in the present application, some changes such as design, manufacturing or production based on the technical contents disclosed in the present application are only conventional technical means, and should not be understood as insufficient contents disclosed in the present application.
[0044] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.
[0045] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantitative limitation, and may represent the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to greater than or equal to two. "And / or" describes the association relationship of associated objects, indicating that there can be three relationships, for example, "A and / or B" can represent: A exists alone, A and B exist at the same time, and B exists alone. The terms "first", "second", "third" and the like involved in the present application are merely used to distinguish similar objects and do not represent a specific ordering of the objects.
[0046] The method embodiment provided in this embodiment can be executed in a terminal, a computer or a similar computing device. Taking running on a terminal as an example, Figure 1 FIG. 1 is a hardware structure diagram of a terminal of a package image recognition method according to an embodiment of the present invention. Figure 1 As shown, the terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.
[0047] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the package image recognition method in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the terminal via a network. Examples of the above network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0048] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (Radio Frequency, referred to as RF) module, which is used to communicate with the Internet wirelessly.
[0049] The present application embodiment provides a package image recognition method, Figure 2 is a flowchart of a package image recognition method according to an embodiment of the present application. Figure 2 As shown, the process includes the following steps:
[0050] Step S201: acquiring a first package image and a second package image to be identified, and determining an image display ratio between the second package image and the first package image.
[0051] In this embodiment, a server with intelligent analysis capabilities may be used to obtain the first package image and the second package image to be identified. The first package image and the second package image may be two adjacent frames of images to be identified, or two frames of images to be identified that are separated. Preferably, 8 to 16 frames of images may be spaced between the first package image and the second package image. Furthermore, the image display ratio between the second package image and the first package image may be the ratio of the size of the second package image to the size of the first package image. It should be noted that the image size described in this application is in a broad sense, and may refer to a length, or a measurement of area, pixels, etc.
[0052] Step S202: obtaining a size of a first package in the first package image and a size of a second package in the second package image, and calculating a ratio of the size of the second package to the size of the first package to obtain a package size ratio.
[0053] Each package image acquired in the embodiment of the present application includes a corresponding target package, that is, the first package image includes the first package, and the second package image includes the second package. The sizes of the first package and the second package are obtained respectively. Similarly, the package size is also in a broad sense, which can refer to length, area, pixel, etc. The package size ratio is calculated under the condition of unified measurement objects. For example, when the size of the second package is the height of the second package target frame corresponding to the second package, and the size of the first package is the height of the first package target frame corresponding to the first package, the ratio of the second package target frame height to the first package target frame height is calculated to obtain the package size ratio. It can be understood that the height of the target frame can be the length of the long side of the rectangular frame including the target.
[0054] Step S203, determining a first difference between the image display ratio and the package size ratio, and when the first difference is outside a preset value range, determining that the first package is different from the second package.
[0055] Correspondingly, following the example of step S202 in this embodiment, when the package size ratio is the ratio of the height of the second package target frame to the height of the first package target frame, the image display ratio should also be the display ratio under the length measurement. For example, the image display ratio can be the ratio of the width of the second package image to the width of the first package image. At this time, a certain numerical range is preset. When the first difference between the determined image display ratio and the package size ratio is outside the preset numerical range, it means that when the transformation between the previous and next two frames of images occurs, the ratio change between the package image and the package is inconsistent, and it is judged that the first package and the second package are not the same. It should be noted that the difference described in this application is outside the preset numerical range, which does not include the case where the difference coincides with the endpoint value of the numerical range, that is, when the difference is equal to a certain endpoint value of the preset numerical range, it is considered that the difference is within the preset numerical range.
[0056] Through the above steps, after obtaining the first package image and the second package image to be identified, the present application determines the image display ratio between the two frames of images, obtains the size of the first package and the size of the second package in the image, and calculates the package size ratio between the two packages; wherein the image display ratio can indicate the size change from the first package image to the second package image, and the package size ratio indicates the size change from the first package to the second package; a first difference between the above image display ratio and the package size ratio is determined, and by comparing the relationship between the first difference and a preset numerical range, when the first difference is outside the preset numerical range, it indicates that the package image and the package size change are inconsistent, and at this time, it is determined that the first package and the second package are different, thereby solving the problem in the related art that multiple images corresponding to the same package are mistakenly identified as different package images, improving the accuracy of data statistics, and improving security inspection efficiency.
[0057] In some embodiments, step S201 further includes:
[0058] Step S2011, obtaining a first image display coefficient in the first package image and a second image display coefficient in the second package image.
[0059] Furthermore, in the package image preview interface, the first image display coefficient in the first package image and the second image display coefficient in the second package image may be acquired respectively.
[0060] Step S2012, calculating the ratio of the second image display coefficient to the first image display coefficient to obtain the image display ratio.
[0061] The above-mentioned image display coefficient can indicate the size of the package image. Therefore, by calculating the ratio of the second image display coefficient to the first image display coefficient, the size ratio between the two frames of package images, that is, the image display ratio, can be obtained.
[0062] Based on this embodiment, by respectively acquiring the image display coefficients of two frames of images and calculating the ratio between the two image display coefficients to obtain the image display ratio, the calculation is simple and the obtained image display ratio is accurate.
[0063] The present application also provides a package image recognition method, such as Figure 3 As shown, based on the above embodiment, it also includes:
[0064] Step S301 : when the first difference is within a preset value range, identifying the quantity of first items contained in the first package in the first package image and the quantity of second items contained in the second package in the second package image.
[0065] When the first difference is within the preset value range, it indicates that the proportional change from the first package to the second package is consistent with the proportional change from the first package image to the second package image. At this time, if it is necessary to determine whether the first package and the second package are the same, it is necessary to further compare the items contained in the two packages. Therefore, this embodiment further obtains the quantity of the first item and the quantity of the second item.
[0066] Step S302: when the quantity of the first items is not equal to the quantity of the second items, it is determined that the first package is different from the second package.
[0067] It can be understood that when the quantity of the first items obtained is not equal to the quantity of the second items obtained, the first package is different from the second package.
[0068] Through the above steps, based on the comparison between the numbers of items contained in the packages, when the numbers of items in the two packages are not equal, it is determined that the first package is different from the second package, and the number of items is obtained relatively simply and accurately, thereby further improving the efficiency and accuracy of judging the similarities and differences of packages.
[0069] The present application also provides a package image recognition method, which, based on the above embodiment, also includes:
[0070] Step S401: when the quantity of the first items is equal to the quantity of the second items, determining the types of the first items contained in the first package to obtain a first type set, and determining the types of the second items contained in the second package to obtain a second type set.
[0071] Continuing from the previous embodiment, when the number of the first item and the number of the second item are equal, if you want to distinguish the differences between the first package and the second package, you need to further obtain the type of the first item and the type of the second item, thereby obtaining the above-mentioned first category set and second category set. The category set includes the type of each item contained in the corresponding package. For example, when the number of items in the first package and the second package are both two, the first package contains a water cup and a wallet, and the second package contains a water cup and a mobile phone, then the above-mentioned first category set can be {water cup, wallet}, and the second category set can be {water cup, mobile phone}.
[0072] Step S402: when the first category set is different from the second category set, determining that the first package is different from the second package.
[0073] It can be understood that when the first category set is different from the second category set, the first package is different from the second package.
[0074] Through the above steps, when the number of items in the two packages is equal, the types of each item are further identified and confirmed. When the types of items in the two packages are not exactly the same, the first package is judged to be different from the second package, thereby further improving the accuracy of judging the similarities and differences of packages.
[0075] The present application also provides a package image recognition method, which further includes:
[0076] Step S501, when the first category set is the same as the second category set, determining the correspondence between the first items and the second items, calculating the ratio of the size of each second item to the corresponding size of the first item, and obtaining a plurality of item size ratios.
[0077] In this embodiment, the first category set is the same as the second category set, for example, both are {water cup, mobile phone}, then it is necessary to determine the correspondence between the first item and the second item. Assuming that the water cup in the first package corresponds to the water cup in the second package, and the mobile phone in the first package corresponds to the mobile phone in the second package, then the size ratio of the water cup in the second package to the water cup in the first package is calculated to obtain the water cup size ratio, and the size ratio of the mobile phone in the second package to the mobile phone in the first package is calculated to obtain the mobile phone size ratio.
[0078] Step S502, determining a second difference between the image display ratio and the size ratio of each of the items, and when at least one of the second differences is outside a preset value range, determining that the first package is different from the second package.
[0079] Following step S501, a second difference between the image display ratio and the cup size ratio, and a second difference between the image display ratio and the mobile phone size ratio are determined respectively. When at least one of the second differences is outside the preset value range, it indicates that when the first package image is transformed into the second package image, a size ratio change of at least one group of objects is inconsistent with a size ratio change of the image, and it is determined that the group of objects are different objects in the two frames of images, and thus it is determined that the first package and the second package are different.
[0080] Through the above steps, when the number and types of items in the two packages are the same, the consistency of the size ratio change of the corresponding items and the size ratio change of the image is further compared. When the size ratio change of at least one item is inconsistent with the size ratio change of the image, it is determined that the first package and the second package are different, thereby further improving the accuracy of judging the similarities and differences of packages.
[0081] In some embodiments, step S501 further includes:
[0082] Step S5011, determining a first position of each of the first objects in the first package image, and determining a second position of each of the second objects in the second package image, and determining a correspondence between the first objects and the second objects according to the first positions and the second positions.
[0083] Optionally, in this embodiment, the correspondence between the first item and the second item can be determined based on the position relationship. Specifically, the first package image and the second package image can be scanned and identified to obtain the above-mentioned one or more first positions and second positions respectively, and the first positions are mapped one by one to the second package image. The distance between each mapped first position and all the second positions is selected and determined in turn, and the second position with the closest distance is corresponded to the selected first position, so as to obtain the correspondence between the first item and the second item.
[0084] and / or,
[0085] Step S5012: Determine a correspondence between the first object and the second object according to the size of the first object and the size of the second object.
[0086] Optionally, this embodiment may determine the correspondence between the first object and the second object according to the size of the first object and the size of the second object. Specifically, the first package image and the second package image may be scanned and identified to obtain one or more first objects and second objects respectively, the first objects are sorted according to size, the second objects are also sorted according to size, and the first objects and the second objects are matched one by one according to size according to the sorting situation, that is, the largest first object corresponds to the largest second object, the second largest first object corresponds to the second largest second object, and so on.
[0087] Through the above steps, the correspondence between the first article and the second article is determined according to the positions and / or sizes of the articles, thereby avoiding the situation where different types of articles are compared, so that the calculated article size ratio is accurate, thereby further improving the accuracy of judging the similarities and differences of packages.
[0088] In some embodiments, the preset value range in step S203 is -0.1 to 0.1.
[0089] Through the above steps, the present application presets a reasonable value range to avoid misjudging different packages as the same package when the preset value range is too large, and to avoid misjudging the same package as different packages when the preset value range is too small, thereby further improving the accuracy of judging the similarities and differences of packages.
[0090] The embodiments of the present application are described and illustrated below through preferred embodiments.
[0091] Figure 4 4 is a flow chart of a package image recognition method according to a preferred embodiment of the present application. Figure 5 is a schematic diagram of a package image according to a package image recognition method according to a preferred embodiment of the present application. Figure 4 and Figure 5 , the package image recognition method comprises the following steps:
[0092] Step S4401, obtaining a first package image and a second package image. The first package image is Figure 5 The first frame detection image is shown in , and the second package image is Figure 5 The nth frame detection image shown in .
[0093] Step S4402: Obtain a first image display coefficient in the first package image and a second image display coefficient in the second package image. In this embodiment, the first image display coefficient is 1.0, and the second image display coefficient is 1.8.
[0094] Step S4403, calculating the ratio of the second image display coefficient to the first image display coefficient to obtain the image display ratio. Through calculation, it can be obtained that the image display ratio is 1.8.
[0095] Step S4404, obtaining the size of the first package in the first package image and the size of the second package in the second package image, calculating the ratio of the size of the second package to the size of the first package, and obtaining a package size ratio. In this embodiment, the package width is used as a measure of the package size, the width of the first package is obtained to be 14CM, the width of the second package is obtained to be 25.5CM, and the calculated package size ratio is 1.821.
[0096] Step S4405, determining a first difference between the image display ratio and the package size ratio and a preset value range. Through calculation, the first difference is -0.021, and the preset value range is -0.1 to 0.1.
[0097] Step S4406: When the first difference is within the preset range, identify the number of first items contained in the first package in the first package image and the number of second items contained in the second package in the second package image. Figure 5 As shown, the number of first objects identified is 2, and the number of second objects identified is 2.
[0098] Step S4407: When the quantity of the first items is equal to the quantity of the second items, the types of the first items contained in the first package are determined to obtain a first type set, and the types of the second items contained in the second package are determined to obtain a second type set. Figure 5 As shown, the first category set is determined to be {knife, liquid}, and the second category set is determined to be {knife, liquid}.
[0099] Step S4408: When the first category set is the same as the second category set, determine the correspondence between the first item and the second item, calculate the ratio of the size of each second item to the size of the corresponding first item, and obtain multiple item size ratios. In this embodiment, the width of the target box corresponding to the item is selected as the measure of the item size. It can be understood that the target box width refers to the length of the short side of the rectangular box including the target. Figure 5 As shown in the figure, in the first detection image, the width of the knife target frame is 1CM, and the width of the liquid target frame is 2CM; in the nth detection image, the width of the knife target frame is 1.822CM, and the width of the liquid target frame is 3.643CM. The size ratios of the two objects are calculated to be: 1.822, 1.8215.
[0100] Step S4409, determining the second difference between the image display ratio and the size ratio of each of the items, and when the second difference is within the preset value range, the first package is judged to be the same as the second package. When at least one of the second difference is outside the preset value range, the first package is judged to be different from the second package; and when the second difference is within the preset value range, the first package is judged to be the same as the second package. Through calculation, it is determined that the two corresponding second differences in this embodiment are: -0.022, -0.0215, respectively. It can be seen that the two second differences are within the preset range, and the first package is judged to be the same as the second package.
[0101] It should be noted that the steps shown in the above process or the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0102] This embodiment also provides a package image recognition device, which is used to implement the above embodiments and preferred implementations, and will not be repeated here. As used below, the terms "module", "unit", "subunit", etc. can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0103] Figure 6 is a structural block diagram of a package image recognition device according to an embodiment of the present application. Figure 6 As shown, the device includes: an image display ratio determination module 20, a package size ratio calculation module 30 and a package image recognition module 40.
[0104] The image display ratio determination module 20 is used to obtain a first package image and a second package image to be identified, and determine an image display ratio between the second package image and the first package image;
[0105] The package size ratio calculation module 30 is used to obtain the size of the first package in the first package image and the size of the second package in the second package image, calculate the ratio of the size of the second package to the size of the first package, and obtain the package size ratio;
[0106] The package image recognition module 40 is used to determine a first difference between the image display ratio and the package size ratio, and when the first difference is outside a preset value range, determine that the first package is different from the second package.
[0107] It should be noted that the above modules can be functional modules or program modules, and can be implemented by software or hardware. For modules implemented by hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.
[0108] This embodiment further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0109] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0110] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0111] Acquire a first package image and a second package image to be identified, and determine an image display ratio between the second package image and the first package image;
[0112] Acquire a size of a first package in the first package image and a size of a second package in the second package image, calculate a ratio of the size of the second package to the size of the first package, and obtain a package size ratio;
[0113] A first difference between the image display ratio and the package size ratio is determined, and when the first difference is outside a preset value range, it is determined that the first package is different from the second package.
[0114] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0115] In addition, in combination with the package image recognition method in the above embodiment, the present application embodiment can provide a storage medium for implementation. The storage medium stores a computer program; when the computer program is executed by a processor, any package image recognition method in the above embodiment is implemented.
[0116] Those skilled in the art should understand that the technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0117] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A package image recognition method, characterized in that: The following steps are involved: Acquire a first package image and a second package image to be identified, and determine an image display ratio between the second package image and the first package image; Acquire a size of a first package in the first package image and a size of a second package in the second package image, calculate a ratio of the size of the second package to the size of the first package, and obtain a package size ratio; A first difference between the image display ratio and the package size ratio is determined, and when the first difference is outside a preset value range, it is determined that the first package is different from the second package.
2. The package image recognition method according to claim 1, characterized in that: The determining of the image display ratio between the second package image and the first package image includes: Acquire a first image display coefficient in the first package image and a second image display coefficient in the second package image; The ratio of the second image display coefficient to the first image display coefficient is calculated to obtain the image display ratio.
3. The package image recognition method according to claim 1 or 2, characterized in that: The method further comprises: When the first difference is within a preset value range, identifying the quantity of first items contained in the first package in the first package image and the quantity of second items contained in the second package in the second package image; When the quantity of the first items is not equal to the quantity of the second items, it is determined that the first package is different from the second package.
4. The package image recognition method according to claim 3, characterized in that: The method further comprises: When the quantity of the first items is equal to the quantity of the second items, determining the types of the first items contained in the first package to obtain a first type set, and determining the types of the second items contained in the second package to obtain a second type set; When the first category set is different from the second category set, it is determined that the first package is different from the second package.
5. The package image recognition method according to claim 4, characterized in that: The method further comprises: When the first category set is the same as the second category set, determining a correspondence between the first items and the second items, calculating a ratio of a size of each of the second items to a corresponding size of the first item, and obtaining a plurality of item size ratios; A second difference between the image display ratio and the size ratio of each of the items is determined, and when at least one of the second differences is outside a preset value range, it is determined that the first package is different from the second package.
6. The package image recognition method according to claim 5, characterized in that: The determining the correspondence between the first item and the second item includes: Determine a first position of each of the first objects in the first package image, and determine a second position of each of the second objects in the second package image, and determine a corresponding relationship between the first objects and the second objects based on the first positions and the second positions; and / or, A corresponding relationship between the first object and the second object is determined according to a size of the first object and a size of the second object.
7. The package image recognition method according to claim 1 or 2, characterized in that: The preset value range is from -0.1 to 0.
1.
8. A package image recognition device, characterized in that: It includes an image display ratio determination module, a package size ratio calculation module and a package image recognition module: The image display ratio determination module is used to obtain a first package image and a second package image to be identified, and determine an image display ratio between the second package image and the first package image; The package size ratio calculation module is used to obtain the size of the first package in the first package image and the size of the second package in the second package image, calculate the ratio of the size of the second package to the size of the first package, and obtain the package size ratio; The package image recognition module is used to determine a first difference between the image display ratio and the package size ratio, and when the first difference is outside a preset value range, determine that the first package is different from the second package.
9. An electronic device comprising a memory and a processor, characterized in that: The memory stores a computer program, and the processor is configured to run the computer program to execute the package image recognition method according to any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the package image recognition method according to any one of claims 1 to 7 when executed.
Citation Information
Patent Citations
Method for evaluating accuracy of security detector, terminal and device with storage function
CN108985196A
Article identification model training method and system and article identification method and device
CN110222728A