Method and related device for acquiring device information based on image
By using image processing technology on mobile terminals, the identification information of electrical equipment is automatically identified, which solves the problems of low efficiency in obtaining equipment information and high business level requirements in the existing technology, achieves high-accuracy equipment information acquisition, and improves patrol efficiency. Inspection efficiency.
Patent Information
- Application Number
- CN202111094099.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-17
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2041-09-17
AI Technical Summary
In the existing technology, when obtaining electrical equipment information, inspection personnel have high professional requirements, are prone to errors and have low efficiency. The existing identification method relies on manual identification of equipment and input of information.
Using an image processing-based method, the original image of the device is obtained through the camera, and the target detection model and text extraction model are used to automatically identify the identification area and text information of the device to obtain detailed information about the device.
It achieves accurate acquisition of equipment information without manual identification of equipment, improves inspection efficiency and reduces business level requirements for inspection personnel.
Smart Images

Figure CN113807342B
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of image processing technology, and in particular to a method for acquiring device information based on an image and a related device. Background Art
[0002] With the development of distribution network monitoring automation, there are many electrical equipment in the distribution network, and in order to ensure the normal operation of the electrical equipment, it is necessary to inspect the electrical equipment.
[0003] When inspecting electrical equipment, inspectors need to go to the site to check the electrical equipment, identify what kind of equipment it is, and obtain various equipment information of the electrical equipment. For example, after determining that the electrical equipment is a transformer, it is necessary to obtain the geographic location information of the transformer, the attribute parameters of the transformer, and even the relationship of the transformer in the topology map. At present, in order to facilitate inspections, inspectors use mobile terminals to go to the site where the electrical equipment is located. They rely on the inspectors to identify the electrical equipment, input the basic information of the electrical equipment into the mobile terminal, and then request more detailed equipment information of the electrical equipment from the background. This identification method requires a high level of professional skills of the inspectors, is prone to errors, and has low efficiency. Summary of the invention
[0004] The embodiments of the present invention provide a method, apparatus, electronic device and storage medium for acquiring device information based on images, so as to solve the problems in the prior art that acquiring device information requires high professional level of inspection personnel, is prone to errors and has low efficiency.
[0005] In a first aspect, an embodiment of the present invention provides a method for acquiring device information based on an image, which is applied to a mobile terminal provided with a camera, comprising:
[0006] Obtaining the original image of the device to be identified;
[0007] Inputting the original image into a target detection model to obtain a marked area in the original image;
[0008] Inputting the marked area into a text extraction model to extract text information;
[0009] The device information of the device to be identified is obtained according to the text information.
[0010] Optionally, obtaining an original image of the device to be identified includes:
[0011] A plurality of frames of video images are extracted from the video data generated by monitoring the device to be identified as original images.
[0012] Optionally, inputting the original image into a target detection model to obtain a marked area in the original image includes:
[0013] Inputting multiple frames of the video image into the target detection model to obtain the identification area in each frame of the video image;
[0014] A union of the marked areas in each frame of the video image is taken as the final marked area.
[0015] Optionally, the target detection model is trained in the following manner:
[0016] Acquire multiple frames of images of the electric device as training images, wherein the training images are marked with a first identification area of the electric device;
[0017] Initialize the target detection model;
[0018] Inputting the training image into the target detection model to obtain a second identification area;
[0019] Calculating the distance between the first marked area and the second marked area to obtain a loss rate;
[0020] Determining whether the loss rate is less than a preset threshold;
[0021] If yes, stop iterative training of the target detection model;
[0022] If not, the loss rate is used to perform gradient descent on the parameters of the target detection model, and the process returns to the step of inputting the training image into the target detection model to obtain a second identification area.
[0023] Optionally, inputting the identified area into a text extraction model to extract text information includes:
[0024] Cutting out the identification area from any frame of video image to obtain an identification image;
[0025] The logo image is input into the text extraction model to obtain text information in the logo image.
[0026] Optionally, the text extraction model is trained in the following manner:
[0027] Acquire a training mark image, wherein the training mark image is annotated with first text information;
[0028] Initialize the text extraction model;
[0029] Inputting the training identification image into the text extraction model to obtain second text information;
[0030] Calculating the similarity between the first text information and the second text information to obtain a loss rate;
[0031] Determining whether the loss rate is less than a preset threshold;
[0032] If yes, stop iterative training of the text extraction model;
[0033] If not, the loss rate is used to perform gradient descent on the parameters of the text extraction model, and the process returns to the step of inputting the training identification image into the text extraction model to obtain the second text information.
[0034] Optionally, acquiring the device information of the device to be identified according to the text information includes:
[0035] Extracting basic information of the device to be identified from the text information, wherein the basic information includes a device ID of the device to be identified;
[0036] Sending an association information request to the server, wherein the association information request includes the device ID, and the server is used to obtain association information associated with the device ID;
[0037] Receive the associated information sent by the server.
[0038] In a second aspect, an embodiment of the present invention provides a device for acquiring device information based on an image, which is applied to a mobile terminal provided with a camera, and includes:
[0039] An original image acquisition module is used to acquire the original image of the device to be identified;
[0040] A marking region acquisition module, used for inputting the original image into a target detection model to obtain a marking region in the original image;
[0041] A text information extraction module, used for inputting the marked area into a text extraction model to extract text information;
[0042] The device information acquisition module is used to acquire the device information of the device to be identified according to the text information.
[0043] Optionally, the original image acquisition module includes:
[0044] The original image extraction submodule is used to extract multiple frames of video images as original images from the video data generated by monitoring the device to be identified.
[0045] Optionally, the identification area acquisition module includes:
[0046] An initial identification region acquisition submodule, used for inputting multiple frames of the video image into the target detection model to obtain the identification region in each frame of the video image;
[0047] The union acquisition submodule is used to obtain the union of the marked areas in each frame of the video image as the final marked area.
[0048] Optionally, the target detection model is trained by the following modules:
[0049] A target detection training image acquisition module, used to acquire multiple frames of images of the electric device as training images, wherein the training images are marked with a first identification area of the electric device;
[0050] The target detection model initialization module is used to initialize the target detection model;
[0051] A marker region prediction module, used for inputting the training image into the target detection model to obtain a second marker region;
[0052] A marking area loss rate calculation module, used for calculating the distance between the first marking area and the second marking area to obtain a loss rate;
[0053] A first judgment module, used to judge whether the loss rate is less than a preset threshold;
[0054] A target detection model training stop module is used to stop iterative training of the target detection model;
[0055] The target detection model parameter updating module is used to perform gradient descent on the parameters of the target detection model using the loss rate and return to the identification area prediction module.
[0056] Optionally, the text information extraction module includes:
[0057] A marker image capture submodule, used to capture the marker area from any frame of video image to obtain a marker image;
[0058] The text information extraction submodule is used to input the logo image into the text extraction model to obtain the text information in the logo image.
[0059] Optionally, the text extraction model is trained by the following modules:
[0060] A training mark image acquisition module, used to acquire a training mark image, wherein the training mark image is annotated with first text information;
[0061] The text extraction model initialization module is used to initialize the text extraction model;
[0062] A text information prediction module, used for inputting the training identification image into the text extraction model to obtain second text information;
[0063] A text information loss rate calculation module, used to calculate the similarity between the first text information and the second text information to obtain a loss rate;
[0064] A second judgment module is used to judge whether the loss rate is less than a preset threshold;
[0065] A text extraction model training stop module, used to stop iterative training of the text extraction model;
[0066] The text extraction model parameter updating module is used to perform gradient descent on the parameters of the text extraction model using the loss rate and return to the text information prediction module.
[0067] Optionally, the device information acquisition module includes:
[0068] A basic information extraction submodule, used to extract basic information of the device to be identified from the text information, wherein the basic information includes a device ID of the device to be identified;
[0069] An association information request submodule, configured to send an association information request to the server, wherein the association information request includes the device ID, and the server is configured to obtain association information associated with the device ID;
[0070] The associated information receiving submodule is used to receive the associated information sent by the server.
[0071] In a third aspect, an embodiment of the present invention provides an electronic device, the electronic device comprising:
[0072] one or more processors;
[0073] a storage device for storing one or more computer programs;
[0074] When the one or more computer programs are executed by the one or more processors, the one or more processors implement the method for acquiring device information based on an image as described in any embodiment of the present invention.
[0075] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for acquiring device information based on an image as described in any embodiment of the present invention.
[0076] The method for obtaining device information based on an image in an embodiment of the present invention can be applied to a mobile terminal provided with a camera. After obtaining the original image of the device to be identified, the original image is input into a target detection model to obtain a marking area in the original image, and the marking area is further input into a text extraction model to extract text information, and the device information of the device to be identified is obtained based on the text information. After the patrol personnel take the original image of the device to be identified through the mobile terminal, the device name, device ID and other text information marked on the device to be identified can be automatically extracted, and the device information of the device to be identified is obtained through the text information. The patrol personnel do not need to identify the device and then input the basic information of the device into the mobile terminal to obtain the device information. It is not limited by the professional level of the patrol personnel, and the acquired device information has a high accuracy rate. The patrol personnel can obtain the device information by taking a photo, thereby improving the patrol efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0077] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:
[0078] Figure 1 A flowchart of a method for acquiring device information based on an image provided in Embodiment 1 of the present invention;
[0079] Figure 2 A flowchart of a method for obtaining device information based on an image provided in Embodiment 2 of the present invention;
[0080] Figure 3 A schematic diagram of the structure of a device for acquiring device information based on an image provided in Embodiment 3 of the present invention;
[0081] Figure 4 A schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION
[0082] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0083] Embodiment 1
[0084] Figure 1The flowchart of a method for obtaining device information based on an image provided in the first embodiment of the present invention is applicable to the case where the device information of a device to be identified is obtained based on an image of the device to be identified. The method for obtaining device information based on an image provided in this embodiment can be executed by the device for obtaining device information based on an image provided in the embodiment of the present invention, which can be implemented by software and / or hardware and integrated in a mobile terminal provided with a camera. Specifically, refer to Figure 1 The method for acquiring device information based on an image in an embodiment of the present invention may include the following steps:
[0085] S101, obtaining an original image of a device to be identified.
[0086] In one example of the present invention, an inspector in a distribution network may hold a mobile terminal that can be connected to the Internet and, during inspection, may operate the mobile terminal to capture an original image of a device to be identified, wherein the device to be identified may be printed with device information such as the device model, ID, and name. In one example, the device to be identified is usually provided with a nameplate on which the device model, ID, and name, and other device information is printed.
[0087] In another example, a camera may be mounted on a drone or a robot, and the camera may be used to monitor the device to be identified to generate video data. A frame of video image may be captured from the video data as the original image, which may be sent from the drone or robot to a handheld mobile terminal of the inspector.
[0088] S102: Input the original image into a target detection model to obtain a marked area in the original image.
[0089] In an embodiment of the present invention, identification information is set on the device to be identified, and the identification information includes basic information of the device to be identified, such as the nameplate of the device to be identified or the printed device name, device ID, device model, etc. If the original image obtained by photographing the device to be identified contains the identification information, then the identification area in the original image is the area of the identification information.
[0090] In an optional embodiment, a target detection model may be pre-trained, and the target detection model may detect the identification area from the image. The original image of the device to be identified may be input into the target detection model to detect the identification area in the original image.
[0091] S103: Input the marked area into a text extraction model to extract text information.
[0092] The text extraction model can be a model that outputs text information after inputting an image containing text. The text extraction model can be pre-trained. After the identification area in the original image is detected by the target detection model, the identification area can be cut out from the original image to obtain a identification image, and the identification image can be input into the text extraction model to extract text information. The text information may include device name, device ID, device model, etc.
[0093] S104: Acquire device information of the device to be identified according to the text information.
[0094] In an optional embodiment, after the text information is extracted by the text extraction model, a device information request can be generated based on the text information. The device information request can include the device name, device ID, device model, etc. in the text information to request the server to obtain the device information of the device to be identified, such as the person responsible for the device to be identified, the last maintenance date, the next maintenance date, the scrapping time and other more detailed information.
[0095] Of course, the device information of the device to be identified may also be stored in the mobile terminal, and the device information matching at least one of the device name, device ID, and device model may be directly searched from the memory of the mobile terminal.
[0096] After obtaining the equipment information, the inspection personnel can identify the equipment based on the equipment information and perform inspection and maintenance on the equipment.
[0097] The method for obtaining device information based on an image in an embodiment of the present invention can be applied to a mobile terminal provided with a camera. After obtaining the original image of the device to be identified, the original image is input into a target detection model to obtain a marking area in the original image, and the marking area is further input into a text extraction model to extract text information, and the device information of the device to be identified is obtained based on the text information. After the patrol personnel take the original image of the device to be identified through the mobile terminal, the device name, device ID and other text information marked on the device to be identified can be automatically extracted, and the device information of the device to be identified is obtained through the text information. The patrol personnel do not need to identify the device and then input the basic information of the device into the mobile terminal to obtain the device information. It is not limited by the professional level of the patrol personnel, and the accuracy of the acquired device information is high. The patrol personnel can obtain the device information by taking a photo, thereby improving the patrol efficiency.
[0098] Embodiment 2
[0099] Figure 2 This is a flowchart of a method for obtaining device information based on an image provided in Embodiment 2 of the present invention. Embodiment 2 of the present invention is optimized on the basis of Embodiment 1. Specifically, refer to Figure 2 The method for acquiring device information based on an image in an embodiment of the present invention may include the following steps:
[0100] S201. Extracting multiple frames of video images from video data generated by monitoring the device to be identified as original images.
[0101] In an embodiment of the present invention, the inspection personnel can hold a mobile terminal to record video data of the device to be identified. For example, the mobile terminal can be a mobile phone. The inspection personnel can hold the mobile phone to record a video data from a perspective that can see the identification information set on the device to be identified. The video data includes multiple frames of video images, and the multiple frames of video images are original images. By recording video data, compared with the need to focus and adjust shooting parameters for shooting images, recording video data is simpler and does not require the inspection personnel to have professional image shooting knowledge.
[0102] S202: Input multiple frames of the video image into the target detection model to obtain a marked area in each frame of the video image.
[0103] In an embodiment of the present invention, a target detection model may be pre-trained, and the target detection model may detect a marking area from an image. The original image of the device to be identified may be input into the target detection model to detect the marking area in the original image.
[0104] Specifically, multiple frames of images of the device can be obtained as training images, in which a first identification area of the electrical device is marked, and the first identification area is the area in the training image where the identification information of the device is displayed. When the target detection model is initialized, the training image is input into the target detection model to obtain a second identification area, and the distance between the first identification area and the second identification area is calculated to obtain a loss rate, and it is determined whether the loss rate is less than a preset threshold; if so, stop iterative training of the target detection model, if not, use the loss rate to perform gradient descent on the parameters of the target detection model, and return to the step of inputting the training image into the target detection model to obtain the second identification area.
[0105] The distance between the first identification area and the second identification area can be calculated by calculating the similarity of the boundaries of the first identification area and the second identification area. For example, a plurality of sampling points are obtained by sampling on the boundaries of the first identification area and the second identification area, and for each calculated sampling point, the distance between the sampling point and the pixel coordinates of the image where the first identification area and the second identification area are located is calculated, and the sum of the distances of the sampling points is calculated as the similarity to measure the loss rate. In addition, the parameters of the target detection model can be subjected to random gradient descent according to the loss rate. Of course, other gradient descent methods can also be used, and the embodiments of the present invention are not limited to this.
[0106] After inputting multiple frames of video images into the target detection model, the identification area in each frame of the video image can be detected.
[0107] S203: Taking a union of the marked areas in each frame of the video image as a final marked area.
[0108] The camera may cause the position of the identification area in each frame of video image to be slightly different due to the working condition of the device to be identified, such as the shaking of the device to be identified, or the shaking of the camera, such as the movement of the inspector's hands, and the shaking of the camera mounted on the drone. In this case, the positions of the identification areas in multiple frames of video images can be unioned to obtain a final identification area. The final identification area is the minimum rectangular area that can contain the identification areas of all video images, which avoids the problem of incomplete identification area captured from any frame of video image and can capture the complete identification area.
[0109] S204: intercepting the identification area from any frame of video image to obtain an identification image.
[0110] Since the final identification area is the minimum matrix area of the identification area containing multiple frames of video images, an image area of the same size as the final identification area can be directly cut out according to the position and size of the final identification area in any frame of video image. The cut-out image area is the identification image.
[0111] S205: Input the logo image into the text extraction model to obtain text information in the logo image.
[0112] In an optional embodiment of the present invention, the text extraction model can be trained in the following manner: obtaining a training identification image, the training identification image is annotated with the first text information, initializing the text extraction model, inputting the training identification image into the text extraction model to obtain the second text information, calculating the similarity between the first text information and the second text information to obtain the loss rate, and judging whether the loss rate is less than a preset threshold value, if so, stopping the iterative training of the text extraction model, if not, using the loss rate to perform gradient descent on the parameters of the text extraction model, and returning to the step of inputting the training identification image into the text extraction model to obtain the second text information.
[0113] Among them, the similarity between the first text information and the second text information can be calculated by whether the texts at corresponding positions in the text information are the same. For example, for each position, if the text is the same, the score is 1, and if it is different or missing, the score is 0. The scores of all positions are summed up to get the total score, and then all positions are counted to get the total number of positions. The ratio of the total score to the total number of positions is calculated as the similarity to measure the loss rate.
[0114] After the identification area is cut out from any frame of video image to obtain the identification image, the identification image can be input into the trained text extraction model to extract text information, which may include device name, device ID, device model, etc.
[0115] S206: Extract basic information of the device to be identified from the text information, where the basic information includes a device ID of the device to be identified.
[0116] The extracted text information may include basic information such as the device ID, device name, device model, manufacturer, and production date of the device to be identified. The basic information contained in the text information can be extracted. Specifically, keyword matching can be used to match the basic information of the device to be identified from the text information. For example, the device ID of the device to be identified is matched. Specifically, keywords such as "device number" and "device No." are matched first. The text after the above keywords is the device ID.
[0117] S207: Send an association information request to the server, where the association information request includes the device ID, and the server is configured to obtain association information associated with the device ID.
[0118] After the mobile terminal extracts the basic information of the device, it can generate an associated information request to request the server to return the associated information of the device to be identified. For example, the associated information request can include a device ID, and the associated information request is used to request the server to return the device information associated with the device ID as associated information, such as obtaining the person responsible for the device to be identified, the person's contact information, the last maintenance date, the next maintenance date, the scrapping time, the topological relationship diagram, and other more detailed information as associated information.
[0119] S208: Receive the associated information sent by the server.
[0120] After receiving the association information request, the server can obtain the device ID from the association information request, and then search the database for association information matching the device ID and send it to the mobile terminal. After receiving the association information, the mobile terminal can display the basic information and association information of the device to be identified, so that the inspection personnel can identify the device through the basic information and association information and perform corresponding inspection work on the device.
[0121] The method for obtaining device information based on an image in an embodiment of the present invention can be applied to a mobile terminal provided with a camera. After obtaining the original image of the device to be identified, the original image is input into a target detection model to obtain a marking area in the original image, and the marking area is further input into a text extraction model to extract text information, and the device information of the device to be identified is obtained based on the text information. After the patrol personnel take the original image of the device to be identified through the mobile terminal, the device name, device ID and other text information marked on the device to be identified can be automatically extracted, and the device information of the device to be identified is obtained through the text information. The patrol personnel do not need to identify the device and then input the basic information of the device into the mobile terminal to obtain the device information. It is not limited by the professional level of the patrol personnel, and the accuracy of the acquired device information is high. The patrol personnel can obtain the device information by taking a photo, thereby improving the patrol efficiency.
[0122] Embodiment 3
[0123] Figure 3 A schematic diagram of a structure of a device for obtaining device information based on an image provided by Embodiment 3 of the present invention, specifically, Figure 3 As shown, the apparatus for obtaining device information based on an image in an embodiment of the present invention is used for a mobile terminal provided with a camera, and may specifically include:
[0124] The original image acquisition module 301 is used to acquire the original image of the device to be identified;
[0125] The identification region acquisition module 302 is used to input the original image into the target detection model to obtain the identification region in the original image;
[0126] A text information extraction module 303, used for inputting the marked area into a text extraction model to extract text information;
[0127] The device information acquisition module 304 is used to acquire the device information of the device to be identified according to the text information.
[0128] Optionally, the original image acquisition module 301 includes:
[0129] The original image extraction submodule is used to extract multiple frames of video images as original images from the video data generated by monitoring the device to be identified.
[0130] Optionally, the identification area acquisition module 302 includes:
[0131] An initial identification region acquisition submodule, used for inputting multiple frames of the video image into the target detection model to obtain the identification region in each frame of the video image;
[0132] The union acquisition submodule is used to obtain the union of the marked areas in each frame of the video image as the final marked area.
[0133] Optionally, the target detection model is trained by the following modules:
[0134] A target detection training image acquisition module, used to acquire multiple frames of images of the electric device as training images, wherein the training images are marked with a first identification area of the electric device;
[0135] The target detection model initialization module is used to initialize the target detection model;
[0136] A marker region prediction module, used for inputting the training image into the target detection model to obtain a second marker region;
[0137] A marking area loss rate calculation module, used for calculating the distance between the first marking area and the second marking area to obtain a loss rate;
[0138] A first judgment module, used to judge whether the loss rate is less than a preset threshold;
[0139] A target detection model training stop module is used to stop iterative training of the target detection model;
[0140] The target detection model parameter updating module is used to perform gradient descent on the parameters of the target detection model using the loss rate and return to the identification area prediction module.
[0141] Optionally, the text information extraction module 303 includes:
[0142] A marker image capture submodule, used to capture the marker area from any frame of video image to obtain a marker image;
[0143] The text information extraction submodule is used to input the logo image into the text extraction model to obtain the text information in the logo image.
[0144] Optionally, the text extraction model is trained by the following modules:
[0145] A training mark image acquisition module, used to acquire a training mark image, wherein the training mark image is annotated with first text information;
[0146] The text extraction model initialization module is used to initialize the text extraction model;
[0147] A text information prediction module, used for inputting the training identification image into the text extraction model to obtain second text information;
[0148] A text information loss rate calculation module, used to calculate the similarity between the first text information and the second text information to obtain a loss rate;
[0149] A second judgment module is used to judge whether the loss rate is less than a preset threshold;
[0150] A text extraction model training stop module, used to stop iterative training of the text extraction model;
[0151] The text extraction model parameter updating module is used to perform gradient descent on the parameters of the text extraction model using the loss rate and return to the text information prediction module.
[0152] Optionally, the device information acquisition module 304 includes:
[0153] A basic information extraction submodule, used to extract basic information of the device to be identified from the text information, wherein the basic information includes a device ID of the device to be identified;
[0154] An association information request submodule, configured to send an association information request to the server, wherein the association information request includes the device ID, and the server is configured to obtain association information associated with the device ID;
[0155] The associated information receiving submodule is used to receive the associated information sent by the server.
[0156] The apparatus for acquiring device information based on images provided in this embodiment can execute the method for acquiring device information based on images provided in any embodiment of the present invention, and has corresponding functions and beneficial effects.
[0157] Embodiment 4
[0158] Reference Figure 4 , shows a schematic diagram of the structure of an electronic device in an example of the present invention. Figure 4 As shown, the electronic device may specifically include: a processor 40, a memory 41, a display screen 42 with a touch function, an input device 43, an output device 44, and a communication device 45. The number of processors 40 in the electronic device may be one or more. Figure 4 In the example, a processor 40 is used. The number of memories 41 in the electronic device may be one or more. Figure 4 A memory 41 is taken as an example. The processor 40, memory 41, display screen 42, input device 43, output device 44 and communication device 45 of the electronic device can be connected through a bus or other means. Figure 4 The example of connecting through bus is taken in the following.
[0159] The memory 41 is a computer-readable storage medium that can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the method for obtaining device information based on images described in any embodiment of the present invention (for example, the original image acquisition module 301, the identification area acquisition module 302, the text information extraction module 303 and the device information acquisition module 304 in the above-mentioned device for obtaining device information based on images). The memory 41 may mainly include a program storage area and a data storage area, wherein the program storage area may store an application required for operating the device and at least one function; the data storage area may store data created according to the use of the device, etc. In addition, the memory 41 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 41 may further include a memory remotely arranged relative to the processor 40, and these remote memories may be connected to the device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network and a combination thereof.
[0160] The display screen 42 is a display screen 42 with a touch function, which can be a capacitive screen, an electromagnetic screen or an infrared screen. Generally speaking, the display screen 42 is used to display data according to the instructions of the processor 40, and is also used to receive touch operations acting on the display screen 42 and send corresponding signals to the processor 40 or other devices.
[0161] The communication device 45 is used to establish a communication connection with other devices, and may be a wired communication device and / or a wireless communication device.
[0162] The input device 43 may be used to receive input digital or character information, and to generate key signal input related to user settings and function control of the device. The output device 44 may include an audio device such as a speaker. It should be noted that the specific composition of the input device 43 and the output device 44 may be set according to actual conditions.
[0163] The processor 40 executes various functional applications and data processing of the device by running the software programs, instructions and modules stored in the memory 41, that is, implements the above-mentioned method of acquiring device information based on images.
[0164] Specifically, in the embodiment, when the processor 40 executes one or more programs stored in the memory 41, the steps of the method for acquiring device information based on an image provided in the embodiment of the present invention are specifically implemented.
[0165] Embodiment 5
[0166] Embodiment 5 of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method for acquiring device information based on an image in any embodiment of the present invention can be implemented. The method is applied to a mobile terminal provided with a camera, and specifically may include:
[0167] Obtaining the original image of the device to be identified;
[0168] Inputting the original image into a target detection model to obtain a marked area in the original image;
[0169] Inputting the marked area into a text extraction model to extract text information;
[0170] The device information of the device to be identified is obtained according to the text information.
[0171] Of course, the storage medium containing computer executable instructions provided by an embodiment of the present invention is not limited to the method operations described above, and can also execute related operations in the method for obtaining device information based on images provided by any embodiment of the present invention applied to a device.
[0172] It should be noted that, for the device, electronic device, and storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0173] Through the above description of the implementation methods, technicians in the relevant field can clearly understand that the present invention can be implemented with the help of software and necessary general hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, server, or network device, etc.) to execute the method for obtaining device information based on an image as described in each embodiment of the present invention.
[0174] It is worth noting that in the above-mentioned embodiment of the device based on image acquisition device information, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.
[0175] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for obtaining device information based on an image, characterized in that: Applicable to mobile terminals equipped with cameras, including: Obtaining the original image of the device to be identified; Inputting the original image into a target detection model to obtain a marked area in the original image; Inputting the marked area into a text extraction model to extract text information; Acquire device information of the device to be identified according to the text information; The step of obtaining an original image of the device to be identified includes: Extracting multiple frames of video images as original images from the video data generated by monitoring the device to be identified; The step of inputting the original image into the target detection model to obtain the identification area in the original image includes: Inputting multiple frames of the video image into the target detection model to obtain the identification area in each frame of the video image; Taking a union of the marked areas in each frame of the video image as a final marked area; The object detection model is trained in the following way: Acquire multiple frames of images of the electric device as training images, wherein the training images are marked with a first identification area of the electric device; Initialize the target detection model; Inputting the training image into the target detection model to obtain a second identification area; Calculating the distance between the first marked area and the second marked area to obtain a loss rate; Determining whether the loss rate is less than a preset threshold; If yes, stop iterative training of the target detection model; If not, performing gradient descent on the parameters of the target detection model using the loss rate, and returning to the step of inputting the training image into the target detection model to obtain a second identification area; The text extraction model is trained in the following way: Acquire a training mark image, wherein the training mark image is annotated with first text information; Initialize the text extraction model; Inputting the training identification image into the text extraction model to obtain second text information; Calculating the similarity between the first text information and the second text information to obtain a loss rate; Determining whether the loss rate is less than a preset threshold; If yes, stop iterative training of the text extraction model; If not, the loss rate is used to perform gradient descent on the parameters of the text extraction model, and the process returns to the step of inputting the training identification image into the text extraction model to obtain the second text information.
2. The method for acquiring device information based on an image according to claim 1, characterized in that: The step of inputting the identified area into a text extraction model to extract text information comprises: Cutting out the identification area from any frame of video image to obtain an identification image; The logo image is input into the text extraction model to obtain text information in the logo image.
3. The method for acquiring device information based on an image according to claim 1, characterized in that: The acquiring the device information of the device to be identified according to the text information includes: Extracting basic information of the device to be identified from the text information, wherein the basic information includes a device ID of the device to be identified; Sending an association information request to a server, wherein the association information request includes the device ID, and the server is used to obtain association information associated with the device ID; Receive the associated information sent by the server.
4. A device for acquiring device information based on an image, characterized in that: Applicable to mobile terminals equipped with cameras, including: An original image acquisition module is used to acquire the original image of the device to be identified; A marking region acquisition module, used for inputting the original image into a target detection model to obtain a marking region in the original image; A text information extraction module, used for inputting the marked area into a text extraction model to extract text information; A device information acquisition module, used to acquire the device information of the device to be identified according to the text information; The original image acquisition module comprises: The original image extraction submodule is used to extract multiple frames of video images as original images from the video data generated by monitoring the device to be identified; The identification area acquisition module includes: An initial identification region acquisition submodule, used for inputting multiple frames of the video image into the target detection model to obtain the identification region in each frame of the video image; A union acquisition submodule, used for obtaining a union of the identification regions in each frame of the video image as a final identification region; The target detection model is trained through the following modules: A target detection training image acquisition module, used to acquire multiple frames of images of the electric device as training images, wherein the training images are marked with a first identification area of the electric device; The target detection model initialization module is used to initialize the target detection model; A marker region prediction module, used for inputting the training image into the target detection model to obtain a second marker region; A marking area loss rate calculation module, used for calculating the distance between the first marking area and the second marking area to obtain a loss rate; A first judgment module, used to judge whether the loss rate is less than a preset threshold; A target detection model training stop module is used to stop iterative training of the target detection model; A target detection model parameter updating module, used to perform gradient descent on the parameters of the target detection model using the loss rate, and return to the identification area prediction module; The text extraction model is trained through the following modules: A training mark image acquisition module, used to acquire a training mark image, wherein the training mark image is annotated with first text information; The text extraction model initialization module is used to initialize the text extraction model; A text information prediction module, used for inputting the training identification image into the text extraction model to obtain second text information; A text information loss rate calculation module, used to calculate the similarity between the first text information and the second text information to obtain a loss rate; A second judgment module is used to judge whether the loss rate is less than a preset threshold; A text extraction model training stop module, used to stop iterative training of the text extraction model; The text extraction model parameter updating module is used to perform gradient descent on the parameters of the text extraction model using the loss rate and return to the text information prediction module.
5. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more computer programs; The one or more computer programs are executed by the one or more processors so that the one or more processors implement the method for acquiring device information based on an image according to any one of claims 1 to 3.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for acquiring device information based on an image as described in any one of claims 1 to 3 is implemented.
