Object recognition method, device, electronic device and computer-readable storage medium

By storing object recognition packages on the server and dynamically loading them on the device, using scripts to drive object recognition, the problems of untimely updates and high resource consumption in the prior art are solved, and efficient object recognition is achieved.

CN114494841BActive Publication Date: 2025-02-18ASIAINFO TECH CHINA INC
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011264754.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-12
Publication Date
2025-02-18
Estimated Expiration
2040-11-12

AI Technical Summary

Technical Problem

Existing object recognition technology has problems in updates and resource consumption, and updates are not timely and consumes a lot of resources.

Method used

By storing the object recognition package on the server, when the device needs to perform object recognition, the object recognition package is dynamically loaded from the server and driven object recognition using scripts on the device.

Benefits of technology

It solves the problem that the device occupies a large amount of resources when updating the complete object recognition package, and achieves saving resources while improving the execution speed of object recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114494841B_ABST
    Figure CN114494841B_ABST
Patent Text Reader

Abstract

The present application provides an object recognition method, device, electronic device and computer-readable storage medium, which relate to the field of Internet of Things. The method includes: receiving an object recognition instruction; when it is detected that the object recognition instruction is received for the first time, parsing to obtain first verification information, object recognition package address information, and script file, using the first verification information as the default verification information, and obtaining the object recognition package based on the object recognition package address information, when the object recognition package is loaded, performing object recognition based on the script file; when it is detected that the object recognition instruction is not received for the first time, parsing to obtain second verification information, object recognition package address information, and script file, comparing the second verification information with the default verification information, and performing object recognition based on the comparison result through the script file. The present application realizes the dynamic loading of object recognition packages in the device, and drives object recognition through scripts, which not only saves a lot of resources, but also improves the execution speed of object recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of Internet of Things, and more specifically, to an object recognition method, device, electronic device and computer-readable storage medium. Background Art

[0002] With the rapid development of the Internet of Things industry, object recognition technology is being used more and more frequently in people's lives.

[0003] Existing object recognition technology is generally implemented in two ways. One way is to pre-install the object recognition program on the device being used, and run the program directly through the device to perform object recognition. The other way is to store the object recognition program on a server, collect images through the device during use, and the object recognition steps are completed by the server.

[0004] In actual applications, if the first method is used, since the object recognition program often needs to be updated frequently, each update requires downloading the complete object recognition program to the device, which will not only take up a lot of resources, but also cause the problem of untimely updates; if the second method is used, object recognition on the server will consume a lot of server resources, and since the device and server need to interact during the recognition process, under poor network conditions, the time required for object recognition will be too long. Summary of the invention

[0005] The present application provides an object recognition method, device, electronic device and computer-readable storage medium, which are used to solve the technical problem of resource waste caused by the existing object recognition process.

[0006] In a first aspect, a method for object recognition is provided, the method comprising:

[0007] receiving an object recognition instruction;

[0008] When it is detected that the object recognition instruction is received for the first time, the object recognition instruction is parsed to obtain first verification information, object recognition package address information, and a script file, the first verification information is used as default verification information, and the object recognition package is obtained based on the object recognition package address information, and when the object recognition package is loaded, the object recognition is performed based on the script file;

[0009] When it is detected that the object recognition instruction is not received for the first time, the object recognition instruction is parsed to obtain second verification information, object recognition package address information, and a script file, the second verification information is compared with the default verification information, and object recognition is performed through the script file based on the comparison result.

[0010] Preferably, comparing the second verification information with the default verification information, and performing object recognition through a script file based on the comparison result, includes:

[0011] Comparing the second verification information with the default verification information;

[0012] When the second verification information is consistent with the default verification information, the image acquisition device is turned on, and object recognition is performed through the script file;

[0013] When the second verification information is inconsistent with the default verification information, the object recognition package is obtained based on the object recognition package address information, the default verification information is replaced with the second verification information, and when the object recognition package is loaded, the image acquisition device is turned on, and object recognition is performed through the script file.

[0014] Preferably, receiving an object recognition instruction includes:

[0015] Receive object recognition instructions based on the message queue telemetry transmission MQTT protocol.

[0016] In a possible implementation, obtaining the object identification package based on the address information of the object identification package includes:

[0017] The object recognition package is obtained through the hypertext transfer http protocol based on the address information of the object recognition package.

[0018] Preferably, the object recognition result is sent to a preset server, and the preset server is used to send the object recognition instruction.

[0019] Preferably, sending the object recognition result to a preset server includes:

[0020] The object recognition results are sent to the preset server based on the MQTT protocol.

[0021] Preferably, the script file is a lua script file.

[0022] In a second aspect, an object recognition device is provided, the device comprising:

[0023] A receiving module, used for receiving an object recognition instruction;

[0024] A first recognition module is used for, when it is detected that the object recognition instruction is received for the first time, parsing the object recognition instruction to obtain first verification information, object recognition package address information, and a script file, using the first verification information as default verification information, and obtaining an object recognition package based on the object recognition package address information, and performing object recognition based on the script file when the object recognition package is loaded;

[0025] The second identification module is used to parse the object identification instruction to obtain second verification information, object identification package address information, and a script file when it is detected that the object identification instruction is not received for the first time, compare the second verification information with the default verification information, and perform object identification through the script file based on the comparison result.

[0026] Preferably, the second identification module includes:

[0027] A comparison submodule, used to compare the second verification information with the default verification information;

[0028] A first processing submodule, configured to start the image acquisition device and perform object recognition through a script file when the second verification information is consistent with the default verification information;

[0029] The second processing submodule is used to obtain the object recognition package based on the address information of the object recognition package when the second verification information is inconsistent with the default verification information, replace the default verification information with the second verification information, and when the object recognition package is loaded, turn on the image acquisition device and perform object recognition through the script file.

[0030] Preferably, the receiving module is specifically used for:

[0031] Receive object recognition instructions based on the message queue telemetry transmission MQTT protocol.

[0032] Preferably, obtaining the object identification package based on the address information of the object identification package includes:

[0033] The object identification package is obtained through the hypertext transfer protocol based on the address information of the object identification package.

[0034] Preferably, it also includes:

[0035] The sending module is used to send the object recognition result to a preset server, and the preset server is used to send the object recognition instruction.

[0036] Preferably, the sending module is specifically used for:

[0037] The object recognition results are sent to the preset server based on the MQTT protocol.

[0038] Preferably, the script file is a lua script file.

[0039] In a third aspect, an electronic device is provided, the electronic device comprising:

[0040] one or more processors;

[0041] Memory;

[0042] One or more applications, wherein the one or more applications are stored in a memory and configured to be executed by one or more processors, and the one or more programs are configured to: execute the object recognition method shown in the first aspect of the present application.

[0043] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the object recognition method shown in the first aspect of the present application is implemented.

[0044] An object recognition method provided by an embodiment of the present application is applied to receive an object recognition instruction; when it is detected that the object recognition instruction is received for the first time, first verification information, object recognition package address information, and a script file are parsed to obtain the first verification information, and the object recognition package is obtained based on the object recognition package address information. When the object recognition package is loaded, object recognition is performed based on the script file; when it is detected that the object recognition instruction is not received for the first time, second verification information, object recognition package address information, and a script file are parsed to obtain the second verification information, the object recognition package address information, and the script file, the second verification information is compared with the default verification information, and object recognition is performed through the script file based on the comparison result.

[0045] By storing the object recognition package on the server, when the device needs to perform object recognition, the object recognition package is dynamically loaded from the server, and finally the method of using scripts to drive object recognition on the device overcomes the technical problem that the device occupies a large amount of resources when updating the complete object recognition package, thereby achieving the technical effect of saving a lot of resources while improving the execution speed of object recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in describing the embodiments of the present application are briefly introduced below.

[0047] Figure 1 A flowchart of an object recognition method provided in an embodiment of the present application;

[0048] Figure 2 A flowchart of an object recognition method provided by another embodiment of the present application;

[0049] Figure 3 A flowchart of an object recognition method provided in yet another embodiment of the present application;

[0050] Figure 4 A schematic diagram of the structure of an object recognition device provided in an embodiment of the present application;

[0051] Figure 5 A schematic diagram of the structure of an electronic device for object recognition provided in an embodiment of the present application. DETAILED DESCRIPTION

[0052] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be interpreted as limiting the present invention.

[0053] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present application refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.

[0054] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0055] First, several terms involved in this application are introduced and explained:

[0056] The first verification information, the second verification information, and the default verification information may include the message digest algorithm (Message-Digest Algorithm) md5 value of the corresponding object identification package. The message digest algorithm md5 is a widely used hash function that generates a 128-bit hash value, which can be used to check and verify data integrity and is widely used in software to provide a guarantee that the transmitted file has arrived intact.

[0057] The object identification packet address information may include the object identification packet uniform resource locator (URL). The uniform resource locator, also known as the web address, is the address of a standard resource on the Internet. Each file on the Internet has a unique URL, which contains information indicating the location of the file and how the browser should handle it.

[0058] Image acquisition devices may include cameras and scanners.

[0059] The object recognition device may include a Raspberry Pi, which is a microcomputer the size of a credit card that has all the basic functions of a computer and is based on Linux.

[0060] The message queue telemetry transmission MQTT protocol is a client-server based message publish / subscribe transmission protocol that supports all platforms and can connect almost all networked objects to the outside world. As a low-overhead, low-bandwidth instant messaging protocol, the MQTT protocol is widely used in the Internet of Things, small devices, mobile applications, etc.

[0061] The Hypertext Transfer Protocol (http) is a transmission protocol used by World Wide Web servers to transmit hypertext to local browsers. The http protocol is transaction-oriented, and the application layer protocol specifies the format and rules of requests and responses between browsers and servers. It is an important basis for reliable file exchange on the World Wide Web.

[0062] Lua is a concise, lightweight and extensible scripting language designed to be embedded in applications to provide flexible expansion and customization capabilities for applications.

[0063] In an existing application scenario, the object recognition process is completed in the device from beginning to end. The device is pre-installed with a complete object recognition program. When the user needs to perform object recognition, he can directly use the device to complete the corresponding operation. However, since the existing object recognition program needs to be updated from time to time, in this scenario, the user needs to frequently download the complete object recognition program from the server for update. This method occupies a large amount of network bandwidth and causes the problem of untimely updates, which reduces the user experience.

[0064] In another existing application scenario, object recognition is achieved through the interaction between the device and the server. The device captures the image through the camera and sends the image to the server, which performs object recognition and returns the recognition result to the device. In this scenario, since the object recognition process is performed on the server, a large amount of server resources will be consumed, and since the device and the server need to interact during the recognition process, the recognition time is easily affected by network status.

[0065] The object recognition method, device, electronic device and computer-readable storage medium provided in this application are intended to solve the above technical problems in the prior art.

[0066] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0067] The present application provides a method for object recognition, such as Figure 1 As shown, the method includes:

[0068] Step S101, receiving an object recognition instruction.

[0069] Receive object recognition instructions. Specifically, the object recognition device receives the object recognition instructions sent by the preset server. For example, when a user wants to perform object recognition, an object recognition request can be sent to the preset server through a terminal device including a mobile phone and a computer. In one application scenario, the user clicks a button to turn on object recognition to trigger the terminal device to send a request. When the preset server receives the object recognition request, it sends a corresponding object recognition instruction to the object recognition device, wherein the object recognition instruction includes verification information, object recognition package address information, and a lua script file. The verification information can be the md5 value of the object recognition package in the preset server, the object recognition package address information can include the object recognition package URL, and the object recognition device can be a Raspberry Pi used for object recognition.

[0070] Step S102, when it is detected that the object recognition instruction is received for the first time, the object recognition instruction is parsed to obtain first verification information, object recognition package address information, and a script file, the first verification information is used as the default verification information, and an object recognition package is obtained based on the object recognition package address information. When the object recognition package is loaded, object recognition is performed based on the script file.

[0071] When the object recognition device that receives the object recognition instruction detects that it receives the object recognition instruction for the first time, it parses the instruction to obtain the first verification information, the object recognition package address information, and the lua script file. Specifically, after the object recognition device parses and obtains the lua script file, it decompresses it into a preset directory for driving object recognition. After the object recognition device parses and obtains the first verification information, it uses the first verification information as the default verification information and stores it in the preset directory for version verification of the object recognition package. After the object recognition device parses and obtains the object recognition package address information, it accesses the object recognition package address in the preset server, obtains the object recognition package corresponding to it from the preset server, and decompresses it into the preset directory of the object recognition device. Then, the object recognition device turns on the image acquisition device and drives the decompressed object recognition package to perform object recognition by running the lua script file. Among them, the object recognition device can be a Raspberry Pi for object recognition.

[0072] Step S103, when it is detected that the object recognition instruction is not received for the first time, the object recognition instruction is parsed to obtain second verification information, object recognition package address information, and a script file, the second verification information is compared with the default verification information, and object recognition is performed through the script file based on the comparison result.

[0073] When the object recognition device that receives the object recognition instruction detects that it is not the first time to receive the object recognition instruction, it parses the instruction to obtain the second verification information, the object recognition package address information, and the script file. Among them, the second verification information can be the md5 value of the object recognition package, and the object recognition package address information can be the object recognition package URL. Specifically, after the object recognition device parses and obtains the lua script file, it decompresses it into a preset directory. After the object recognition device parses and obtains the second verification information, it compares the second verification information with the default verification information previously stored in the device, and then starts the image acquisition device according to the comparison result, and drives the decompressed object recognition package to perform object recognition by running the lua script file.

[0074] An object recognition method provided by an embodiment of the present application is applied to receive an object recognition instruction; when it is detected that the object recognition instruction is received for the first time, first verification information, object recognition package address information, and a script file are parsed to obtain the first verification information, and the object recognition package is obtained based on the object recognition package address information. When the object recognition package is loaded, object recognition is performed based on the script file; when it is detected that the object recognition instruction is not received for the first time, second verification information, object recognition package address information, and a script file are parsed to obtain the second verification information, the object recognition package address information, and the script file, the second verification information is compared with the default verification information, and object recognition is performed through the script file based on the comparison result.

[0075] By storing the object recognition package on the server, when the device needs to perform object recognition, the object recognition package is dynamically loaded from the server, and finally the method of using scripts to drive object recognition on the device overcomes the technical problem that the device occupies a large amount of resources when updating the complete object recognition package, thereby achieving the technical effect of saving a lot of resources while improving the execution speed of object recognition.

[0076] In the embodiment of the present application, a possible implementation method is provided for comparing the second verification information with the default verification information, and performing object recognition through the script file based on the comparison result, such as Figure 2 As shown, including:

[0077] Step S201: compare the second verification information with the default verification information.

[0078] The second verification information is obtained by the object recognition device through parsing the received object recognition instruction, and the default verification information is the verification information previously stored in the object recognition device. Specifically, the second verification information and the default verification information can be the md5 value of the object recognition package. Therefore, the second verification information can be compared with the default verification information by comparing the md5 value of the object recognition package corresponding to the received object recognition instruction with the md5 value of the object recognition package in the object recognition device. By judging whether the two are consistent, it is determined whether the version of the object recognition package corresponding to the newly received object recognition instruction is consistent with the version of the object recognition package already stored in the device. Then, it can be judged whether the object recognition device needs to update the object recognition package in the device before performing object recognition.

[0079] Step S202: When the second verification information is consistent with the default verification information, the image acquisition device is turned on, and object recognition is performed through the script file.

[0080] When the object recognition device that receives the object recognition instruction detects that it is not the first time to receive the object recognition instruction, it parses the instruction to obtain the second verification information, the object recognition package address information, and the lua script file. After the object recognition device parses and obtains the second verification information, it compares the second verification information with the default verification information stored in the device. When the second verification information is consistent with the default verification information, the image acquisition device is directly turned on to prepare to start the object recognition program.

[0081] Step S203, when the second verification information is inconsistent with the default verification information, obtain the object recognition package based on the address information of the object recognition package, replace the default verification information with the second verification information, and when the object recognition package is loaded, turn on the image acquisition device and perform object recognition through the script file.

[0082] When the object recognition device that receives the object recognition instruction detects that it is not the first time to receive the object recognition instruction, it parses the instruction to obtain the second verification information, the object recognition package address information, and the lua script file. After the object recognition device parses and obtains the second verification information, it compares the second verification information with the default verification information stored in the device. When the second verification information is inconsistent with the default verification information, it accesses the object recognition package address in the preset server through the object recognition package address information obtained by parsing, obtains the corresponding object recognition package, and decompresses it into the preset directory of the object recognition device. The default verification information stored in the object recognition device is replaced with the second verification information, and then the image acquisition device is turned on to prepare to start the object recognition program.

[0083] When the object recognition program is started, the object recognition device drives the object recognition program to perform object recognition by running the decompressed lua script file.

[0084] A method for object recognition provided by an embodiment of the present application is applied to receive an object recognition instruction; when it is detected that the object recognition instruction is received for the first time, first verification information, object recognition package address information, and a script file are parsed to obtain first verification information, object recognition package address information, and a script file, the first verification information is used as default verification information, and an object recognition package is obtained based on the object recognition package address information; when the object recognition package is loaded, object recognition is performed based on the script file; when it is detected that the object recognition instruction is not received for the first time, second verification information, object recognition package address information, and a script file are parsed to obtain second verification information, the second verification information is compared with the default verification information, when the comparison result is that the second verification information is consistent with the default verification information, the object recognition device directly turns on the image acquisition device, and performs object recognition based on the script file; when the comparison result is that the second verification information is inconsistent with the default verification information, the object recognition device obtains the object recognition package from the corresponding address in the preset server based on the parsed object recognition package address information, downloads and decompresses the object recognition package to a preset directory of the device, updates and replaces the pre-stored default verification information with the second verification information, turns on the image acquisition device, and performs object recognition based on the script file.

[0085] By storing the object recognition package on the server, when the device needs to perform object recognition, it is determined based on different conditions whether the object recognition package needs to be dynamically loaded from the server. Finally, the method of using scripts to drive object recognition on the device overcomes the technical problem that the device occupies a large amount of resources when updating the complete object recognition package, thereby achieving the technical effect of saving a large amount of resources while improving the execution speed of object recognition.

[0086] Another embodiment of the present application provides an object recognition method, such as Figure 3 As shown, the method includes:

[0087] Step S301, receiving an object recognition instruction.

[0088] Receive object recognition instructions. Specifically, the object recognition device receives the object recognition instructions sent by the preset server. For example, when a user wants to perform object recognition, an object recognition request can be sent to the preset server through a terminal device including a mobile phone and a computer. In one application scenario, the user clicks a button to turn on object recognition to trigger the terminal device to send a request. When the preset server receives the object recognition request, it sends a corresponding object recognition instruction to the object recognition device, wherein the object recognition instruction includes verification information, object recognition package address information, and a lua script file. The verification information can be the md5 value of the object recognition package in the preset server, the object recognition package address information can include the object recognition package URL, and the object recognition device can be a Raspberry Pi used for object recognition.

[0089] Step S302, when it is detected that the object recognition instruction is received for the first time, the object recognition instruction is parsed to obtain first verification information, object recognition package address information, and a script file, the first verification information is used as the default verification information, and an object recognition package is obtained based on the object recognition package address information. When the object recognition package is loaded, object recognition is performed based on the script file.

[0090] When the object recognition device that receives the object recognition instruction detects that it receives the object recognition instruction for the first time, it parses the instruction to obtain the first verification information, the object recognition package address information, and the lua script file. Specifically, after the object recognition device parses and obtains the lua script file, it decompresses it into a preset directory for driving object recognition. After the object recognition device parses and obtains the first verification information, it uses the first verification information as the default verification information and stores it in the preset directory for version verification of the object recognition package. After the object recognition device parses and obtains the object recognition package address information, it accesses the object recognition package address in the preset server, obtains the object recognition package corresponding to it from the preset server, and decompresses it into the preset directory of the object recognition device. Then, the object recognition device turns on the image acquisition device and drives the decompressed object recognition package to perform object recognition by running the lua script file. Among them, the object recognition device can be a Raspberry Pi for object recognition.

[0091] Step S303, when it is detected that the object recognition instruction is not received for the first time, the object recognition instruction is parsed to obtain second verification information, object recognition package address information, and a script file, the second verification information is compared with the default verification information, and object recognition is performed through the script file based on the comparison result.

[0092] When the object recognition device that receives the object recognition instruction detects that it is not the first time to receive the object recognition instruction, it parses the instruction to obtain the second verification information, the object recognition package address information, and the script file. Among them, the second verification information can be the md5 value of the object recognition package, and the object recognition package address information can be the object recognition package URL. Specifically, after the object recognition device parses and obtains the lua script file, it decompresses it into a preset directory. After the object recognition device parses and obtains the second verification information, it compares the second verification information with the default verification information previously stored in the device, and then starts the image acquisition device according to the comparison result, and drives the decompressed object recognition package to perform object recognition by running the lua script file.

[0093] Step S304: sending the object recognition result to a preset server.

[0094] The object recognition device sends the object recognition result to the preset server. For example, after the object recognition device drives the object recognition program through the Lua script to perform object recognition, it obtains the object recognition result and sends the result to the preset server. The server can store the object recognition result and return the result to the device where the user sends the object recognition request. Then, the user can view the object recognition result through the terminal device. The object recognition result can also be displayed by the object recognition device. For example, the display connected to the Raspberry Pi that performs object recognition can also display the object recognition result.

[0095] In a preferred embodiment of the present application, receiving an object recognition instruction includes:

[0096] Receive object recognition instructions based on the MQTT protocol.

[0097] In a preferred embodiment of the present application, sending the object recognition result to a preset server includes:

[0098] The object recognition results are sent to the preset server based on the MQTT protocol.

[0099] The MQTT protocol is used to receive object recognition instructions and report object recognition results. Due to its lightweight characteristics, object recognition devices can receive and report object recognition instructions more real-time.

[0100] In a preferred embodiment of the present application, obtaining an object recognition package includes:

[0101] The object recognition package is obtained based on the http protocol.

[0102] Specifically, the object recognition device sends a request to the server based on the address information of the object recognition package. After receiving the request, the server immediately responds based on the http protocol and returns the corresponding object recognition package to the client, that is, the object recognition device.

[0103] An object recognition method provided by an embodiment of the present application is applied to receive an object recognition instruction; when it is detected that the object recognition instruction is received for the first time, first verification information, object recognition package address information, and a script file are parsed to obtain the first verification information, and the object recognition package is obtained based on the object recognition package address information. When the object recognition package is loaded, object recognition is performed based on the script file; when it is detected that the object recognition instruction is not received for the first time, second verification information, object recognition package address information, and a script file are parsed to obtain the second verification information, the object recognition package address information, and the script file, the second verification information is compared with the default verification information, and object recognition is performed through the script file based on the comparison result; the object recognition result is sent to a preset server.

[0104] By storing the object recognition package on the server, when the device needs to perform object recognition, the object recognition package is dynamically loaded from the server, and finally the method of using scripts to drive object recognition on the device overcomes the technical problem that the device occupies a large amount of resources when updating the complete object recognition package, thereby achieving the technical effect of saving a lot of resources while improving the execution speed of object recognition.

[0105] The present application embodiment provides an object recognition device, such as Figure 4 As shown, the object recognition device includes:

[0106] The receiving module 401 is used to receive an object recognition instruction.

[0107] The first recognition module 402 is used to parse the object recognition instruction to obtain first verification information, object recognition package address information, and a script file when it is detected that the object recognition instruction is received for the first time, use the first verification information as the default verification information, and obtain the object recognition package based on the object recognition package address information. When the object recognition package is loaded, object recognition is performed based on the script file.

[0108] The second identification module 403 is used to parse the object identification instruction to obtain second verification information, object identification package address information, and a script file when it is detected that the object identification instruction is not received for the first time, compare the second verification information with the default verification information, and perform object identification through the script file based on the comparison result.

[0109] In a preferred embodiment of the present application, the second identification module includes:

[0110] A comparison submodule, used to compare the second verification information with the default verification information;

[0111] A first processing submodule, configured to start the image acquisition device and perform object recognition through a script file when the second verification information is consistent with the default verification information;

[0112] The second processing submodule is used to obtain the object recognition package based on the address information of the object recognition package when the second verification information is inconsistent with the default verification information, replace the default verification information with the second verification information, and when the object recognition package is loaded, turn on the image acquisition device and perform object recognition through the script file.

[0113] In a preferred embodiment of the present application, the receiving module is specifically used for:

[0114] Receive object recognition instructions based on the message queue telemetry transmission MQTT protocol.

[0115] In a preferred embodiment of the present application, obtaining the object identification package based on the address information of the object identification package includes:

[0116] The object identification package is obtained through the hypertext transfer protocol based on the address information of the object identification package.

[0117] In a preferred embodiment of the present application, it also includes:

[0118] The sending module is used to send the object recognition result to a preset server, and the preset server is used to send the object recognition instruction.

[0119] In a preferred embodiment of the present application, the sending module is specifically used for:

[0120] The object recognition results are sent to the preset server based on the MQTT protocol.

[0121] In a preferred embodiment of the present application, the script file is a lua script file.

[0122] An object recognition device provided by an embodiment of the present application is used to receive an object recognition instruction; when it is detected that the object recognition instruction is received for the first time, first verification information, object recognition package address information, and a script file are parsed to obtain the first verification information, and the object recognition package is obtained based on the object recognition package address information. When the object recognition package is loaded, object recognition is performed based on the script file; when it is detected that the object recognition instruction is not received for the first time, second verification information, object recognition package address information, and a script file are parsed to obtain the second verification information, the object recognition package address information, and the script file, the second verification information is compared with the default verification information, and object recognition is performed through the script file based on the comparison result; the object recognition result is sent to a preset server.

[0123] By storing the object recognition package on the server, when the device needs to perform object recognition, the object recognition package is dynamically loaded from the server, and finally the method of using scripts to drive object recognition on the device overcomes the technical problem that the device occupies a large amount of resources when updating the complete object recognition package, thereby achieving the technical effect of saving a lot of resources while improving the execution speed of object recognition.

[0124] An embodiment of the present application provides an electronic device, which includes: a memory and a processor; at least one program, which is stored in the memory and is used to be executed by the processor. Compared with the prior art, it can achieve: by storing an object recognition package on a server, when the device needs to perform object recognition, dynamically loading the object recognition package from the server, and finally using a script to drive object recognition on the device, thereby overcoming the technical problem that the device occupies a large amount of resources when updating a complete object recognition package, thereby achieving the technical effect of saving a large amount of resources while improving the execution speed of object recognition.

[0125] In an alternative embodiment, an electronic device is provided, such as Figure 5 As shown, Figure 5 The electronic device 5000 shown includes: a processor 5001 and a memory 5003. The processor 5001 and the memory 5003 are connected, such as through a bus 5002. Optionally, the electronic device 5000 may also include a transceiver 5004, which may be used for data interaction between the electronic device and other electronic devices, such as data transmission and / or data reception. It should be noted that in actual applications, the transceiver 5004 is not limited to one, and the structure of the electronic device 5000 does not constitute a limitation on the embodiments of the present application.

[0126] Processor 5001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. Processor 5001 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.

[0127] The bus 5002 may include a path to transmit information between the above components. The bus 5002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 5002 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0128] The memory 5003 can be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to these.

[0129] The memory 5003 is used to store application code for executing the solution of the present application, and the execution is controlled by the processor 5001. The processor 5001 is used to execute the application code stored in the memory 5003 to implement the contents shown in the above method embodiment.

[0130] The embodiment of the present application provides a computer-readable storage medium, which stores a computer program, and when the computer is run on a computer, the computer can execute the corresponding content in the aforementioned method embodiment. Compared with the prior art, by storing the object recognition package on the server, when the device needs to perform object recognition, the object recognition package is dynamically loaded from the server, and finally the method of using scripts to drive object recognition on the device overcomes the technical problem that the device occupies a large amount of resources when updating the complete object recognition package, thereby achieving the technical effect of saving a large amount of resources while improving the execution speed of object recognition.

[0131] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0132] The above descriptions are only some embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A method for object recognition, characterized in that: include: receiving an object recognition instruction; When it is detected that the object recognition instruction is received for the first time, the object recognition instruction is parsed to obtain first verification information, object recognition package address information, and a script file, the first verification information is used as default verification information, and an object recognition package is obtained based on the object recognition package address information, and when the object recognition package is loaded, the decompressed object recognition package is driven to perform object recognition based on the script file; When it is detected that the object recognition instruction is not received for the first time, the object recognition instruction is parsed to obtain second verification information, object recognition package address information, and a script file, the second verification information is compared with the default verification information, and object recognition is performed through the script file based on the comparison result; The step of comparing the second verification information with the default verification information and performing object recognition through the script file based on the comparison result includes: Comparing the second verification information with the default verification information; When the second verification information is consistent with the default verification information, starting the image acquisition device and performing object recognition through the script file; When the second verification information is inconsistent with the default verification information, an object recognition package is obtained based on the address information of the object recognition package, and the default verification information is replaced with the second verification information. When the object recognition package is loaded, the image acquisition device is turned on, and object recognition is performed through the script file.

2. The object recognition method according to claim 1, characterized in that: The receiving of the object recognition instruction comprises: The object recognition instruction is received based on the message queue telemetry transmission MQTT protocol.

3. The object recognition method according to claim 1, characterized in that: The acquiring the object identification package based on the address information of the object identification package includes: The object identification package is obtained through the hypertext transfer protocol (http) based on the address information of the object identification package.

4. The object recognition method according to claim 1, characterized in that: Also includes: The object recognition result is sent to a preset server, and the preset server is used to send the object recognition instruction.

5. The object recognition method according to claim 4, characterized in that: The sending of the object recognition result to a preset server includes: The object recognition result is sent to the preset server based on the MQTT protocol.

6. The object recognition method according to claim 1, characterized in that: The script file is a lua script file.

7. An object recognition device, characterized in that: include: A receiving module, used for receiving an object recognition instruction; a first recognition module, configured to, when detecting that the object recognition instruction is received for the first time, parse the object recognition instruction to obtain first verification information, object recognition package address information, and a script file, use the first verification information as default verification information, and obtain an object recognition package based on the object recognition package address information, and when the object recognition package is loaded, drive the decompressed object recognition package to perform object recognition based on the script file; a second identification module, configured to, when detecting that the object identification instruction is not received for the first time, parse the object identification instruction to obtain second verification information, object identification package address information, and a script file, compare the second verification information with the default verification information, and perform object identification through the script file based on the comparison result; The second recognition module compares the second verification information with the default verification information, and performs object recognition through the script file based on the comparison result, including: Comparing the second verification information with the default verification information; When the second verification information is consistent with the default verification information, starting the image acquisition device and performing object recognition through the script file; When the second verification information is inconsistent with the default verification information, an object recognition package is obtained based on the address information of the object recognition package, and the default verification information is replaced with the second verification information. When the object recognition package is loaded, the image acquisition device is turned on, and object recognition is performed through the script file.

8. An electronic device, characterized in that: The electronic device comprises: one or more processors; Memory; One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, and the one or more applications are configured to: execute the object recognition method according to any one of claims 1-6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the object recognition method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Method and server for identifying risk application

    CN107480519A

  • Loading method of LUA script, terminal and computer readable storage medium

    CN108107792A