CN111078906B - Image query and information synchronization method and device - Google Patents

Image query and information synchronization method and device Download PDF

Info

Publication number
CN111078906B
CN111078906B CN201811216433.5A CN201811216433A CN111078906B CN 111078906 B CN111078906 B CN 111078906B CN 201811216433 A CN201811216433 A CN 201811216433A CN 111078906 B CN111078906 B CN 111078906B
Authority
CN
China
Prior art keywords
index information
image
memory
storage area
area
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811216433.5A
Other languages
Chinese (zh)
Other versions
CN111078906A (en
Inventor
袁延金
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN201811216433.5A priority Critical patent/CN111078906B/en
Publication of CN111078906A publication Critical patent/CN111078906A/en
Application granted granted Critical
Publication of CN111078906B publication Critical patent/CN111078906B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The embodiment of the invention provides an image query and information synchronization method and device, wherein the image query method comprises the following steps: when the analysis result to be queried exists in the second storage area, determining target index information corresponding to the analysis result to be queried according to the second corresponding relation; and acquiring the target identification of the memory subarea corresponding to the analysis result to be queried from the target index information, and acquiring the image pointed by the target index information from the first memory area when judging that the validity information of the target identification is valid according to the first corresponding relation. According to the technical scheme provided by the embodiment of the invention, the image is queried from the first storage area under the condition that the target identifier is judged to be effective, so that the query efficiency of the image is improved, the query operation is prevented from being continuously executed under the condition that the target identifier is invalid, and CPU resources are saved.

Description

Image query and information synchronization method and device
Technical Field
The invention relates to the technical field of data storage, in particular to a method and a device for inquiring images and synchronizing information.
Background
The recording and broadcasting host can store the image shot by the monitoring equipment and the analysis result obtained by intelligent analysis of the stored image. The analysis result stored in the recording host corresponds to the stored image, that is, the analysis result in the recording host is associated with the image, and one image may correspond to one or more analysis results. When the user needs to inquire the image and the corresponding analysis result, the recording and broadcasting host can provide the corresponding image and the corresponding analysis result for the user according to the association between the stored image and the analysis result. The storage mode of the image in the recording and playing host is regional storage.
When the storage area storing a part of the images is formatted, the stored part of the images are deleted, and because some images may correspond to a plurality of analysis results, if the analysis results of the deleted images are selected from the stored analysis results, the analysis results of the deleted images are more complicated, and therefore, the analysis results of the deleted images are generally not processed correspondingly. However, if no processing is performed on the stored analysis result, when searching for the deleted image according to the analysis result, the recording host still performs the query operation, however, only the recording host performs the last step: when the image is obtained according to the storage position of the image which is virtually inquired, the image which is required to be inquired can be determined to be deleted, and therefore the required image cannot be inquired. Thus, not only CPU resources are wasted, but also the query efficiency of images is reduced.
Disclosure of Invention
The embodiment of the invention aims to provide an image query and information synchronization method and device, so that the query efficiency of an image is improved and CPU resources are saved when an electronic device executes query operation. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides an image query method, applied to an electronic device, where the electronic device includes a first storage area and a second storage area, where the first storage area includes at least one storage sub-area for storing images, and the second storage area stores a first correspondence and a second correspondence, where the first correspondence is a correspondence between validity information and an identifier of the storage sub-area, each validity information is used to indicate whether the identifier corresponding to the validity information is valid, and the second correspondence is a correspondence between an analysis result and index information, and each index information is used to indicate a storage path of an image corresponding to the index information and having the analysis result in the first storage area; the method comprises the following steps:
When an analysis result to be queried exists in the second storage area, determining index information corresponding to the analysis result to be queried according to the second corresponding relation, and taking the index information as target index information;
acquiring a target identifier of a memory subarea corresponding to the analysis result to be queried from the target index information, and judging whether validity information of the target identifier is valid or not according to the first corresponding relation;
and if the target index information is valid, acquiring an image pointed by the target index information from the first storage area.
Optionally, the image stored in the first storage area includes a complete image and a feature area image, where the feature area image is an area image in the complete image, where the area image is used to represent an analysis object included in the complete image; the index information comprises first index information and second index information, wherein the first index information is used for representing a storage path of the characteristic region image, and the second index information is used for representing a storage path of the complete image;
the step of determining index information corresponding to the analysis result to be queried according to the second corresponding relation as target index information includes:
Determining first index information corresponding to the analysis result to be queried according to the second corresponding relation, and taking the first index information as first target index information; and/or determining second index information corresponding to the analysis result to be queried according to the second corresponding relation, and taking the second index information as second target index information;
the step of acquiring the image pointed to by the target index information from the first storage area includes:
and acquiring a characteristic area image pointed by the first target index information from the first storage area, and/or acquiring a complete image pointed by the second target index information.
In a second aspect, an embodiment of the present invention provides an information synchronization method, which is applied to an electronic device, where the electronic device includes a first storage area and a second storage area, where the first storage area includes at least one storage sub-area for storing an image, and the second storage area stores a first correspondence between validity information and an identifier of the storage sub-area, and each validity information is used to indicate whether the identifier corresponding to the validity information is valid; the method comprises the following steps:
when the memory subarea exists in the first memory area and is adjusted, acquiring the current identification of the adjusted memory subarea;
And changing the validity information of the identification in the first corresponding relation into invalid in the second storage area.
Optionally, the method further comprises:
reassigning an identification to the adjusted memory sub-region.
Optionally, at least one database is further stored in the second storage area, each database stores an analysis result for the image in the first storage area, each database corresponds to at least one storage subarea, and the image corresponding to the analysis result in each database is stored in the storage subarea corresponding to the database; the method further comprises the steps of:
when the database exists in the second storage area and is deleted, determining the current identification of the storage subarea corresponding to the deleted database;
and carrying out release processing on the identified memory subarea in the first memory area, and reallocating the identification for the memory subarea which completes the release processing.
Optionally, the method further comprises:
acquiring an identifier corresponding to the validity information which is indicated as valid from the first corresponding relation;
judging whether the acquired identifier exists in the identifiers of the memory subareas included in the first memory area;
If so, determining the identification as valid;
if not, the identification is determined to be invalid.
In a third aspect, an embodiment of the present invention provides an image query apparatus, which is applied to an electronic device, where the electronic device includes a first storage area and a second storage area, the first storage area includes at least one storage sub-area for storing an image, and the second storage area stores a first correspondence and a second correspondence, where the first correspondence is a correspondence between validity information and an identifier of the storage sub-area, each validity information is used to indicate whether the identifier corresponding to the validity information is valid, the second correspondence is a correspondence between an analysis result and index information, and each index information is used to indicate a storage path of the image corresponding to the index information and having the analysis result in the first storage area; the device comprises:
the determining module is used for determining index information corresponding to the analysis result to be queried according to the second corresponding relation when the analysis result to be queried exists in the second storage area, and the index information is used as target index information;
the judging module is used for acquiring the target identification of the memory subarea corresponding to the analysis result to be queried from the target index information and judging whether the validity information of the target identification is valid or not according to the first corresponding relation;
And the acquisition module is used for acquiring the image pointed by the target index information from the first storage area when the judging result of the judging module is yes.
Optionally, the image stored in the first storage area includes a complete image and a feature area image, where the feature area image is an area image in the complete image, where the area image is used to represent an analysis object included in the complete image; the index information comprises first index information and second index information, wherein the first index information is used for representing a storage path of the characteristic region image, and the second index information is used for representing a storage path of the complete image;
the determining module is specifically configured to:
determining first index information corresponding to the analysis result to be queried according to the second corresponding relation, and taking the first index information as first target index information; and/or determining second index information corresponding to the analysis result to be queried according to the second corresponding relation, and taking the second index information as second target index information;
the acquisition module is specifically configured to:
and acquiring a characteristic area image pointed by the first target index information from the first storage area, and/or acquiring a complete image pointed by the second target index information.
In a fourth aspect, an embodiment of the present invention provides an information synchronization apparatus, which is applied to an electronic device, where the electronic device includes a first storage area and a second storage area, where the first storage area includes at least one storage sub-area for storing an image, and the second storage area stores a first correspondence between validity information and an identifier of the storage sub-area, and each validity information is used to indicate whether the identifier corresponding to the validity information is valid; the device comprises:
the first acquisition module is used for acquiring the current identification of the adjusted memory subarea when the memory subarea exists in the first memory area and is adjusted;
and the changing module is used for changing the validity information of the identification in the first corresponding relation into invalid in the second storage area.
Optionally, the apparatus further comprises:
and the allocation module is used for reallocating the identification for the adjusted memory subarea.
Optionally, at least one database is further stored in the second storage area, each database stores an analysis result for the image in the first storage area, each database corresponds to at least one storage subarea, and the image corresponding to the analysis result in each database is stored in the storage subarea corresponding to the database; the apparatus further comprises:
The first determining module is used for determining the current identification of the memory subarea corresponding to the deleted database when the database exists in the second memory area and is deleted;
the allocation module is further configured to perform release processing on the identified memory sub-area in the first memory area, and reallocate the identification for the memory sub-area that completes the release processing.
Optionally, the apparatus further comprises:
the second acquisition module is used for acquiring an identifier corresponding to the validity information which is indicated as valid from the first corresponding relation;
the judging module is used for judging whether the obtained identification exists in the identifications of the memory subareas included in the first memory area;
the second determining module is used for determining that the mark is valid when the judging result of the judging module is yes; and when the judging result of the judging module is NO, determining that the mark is invalid.
In a fifth aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
And the processor is used for realizing any one of the image query method steps when executing the program stored in the memory.
In a sixth aspect, embodiments of the present invention provide a machine-readable storage medium having stored thereon a computer program which, when executed by a processor, performs any of the above-described image query method steps.
In a seventh aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
and the processor is used for realizing any one of the information synchronization method steps when executing the program stored in the memory.
In an eighth aspect, embodiments of the present invention provide a machine-readable storage medium having stored thereon a computer program which, when executed by a processor, performs any of the above-described information synchronization method steps.
In the technical scheme provided by the embodiment of the invention, when the analysis result to be queried exists in the second storage area, determining target index information corresponding to the analysis result to be queried according to the second corresponding relation; acquiring a target identifier of a memory subarea corresponding to an analysis result to be queried from target index information, and judging whether validity information of the target identifier is valid or not according to a first corresponding relation; if so, the image to which the target index information points is acquired from the first storage area. According to the technical scheme provided by the embodiment of the invention, after the target index information of the analysis result to be queried is determined, whether the target identifier of the memory subarea corresponding to the analysis result to be queried is valid is judged, and only under the condition that the target identifier is valid, the fact that the image corresponding to the analysis result to be queried is effectively stored in the memory subarea of the target identifier can be determined, and then the image can be queried from the first storage area. Therefore, under the condition that the target identifier is judged to be effective, the image is queried from the first storage area, so that the query efficiency of the image is improved, the query operation is prevented from being continuously executed under the condition that the target identifier is invalid, and CPU resources are saved.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a diagram illustrating a second storage area according to an embodiment of the present invention;
FIG. 2 is a flowchart of an image query method according to an embodiment of the present invention;
FIG. 3 is a flowchart of an information synchronization method according to an embodiment of the present invention;
FIG. 4 is a diagram of a correspondence between a database and a memory sub-region according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an image query device according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an information synchronization device according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In order to improve the query efficiency of an image and save CPU resources when the electronic equipment executes the query operation, the embodiment of the application provides an image query and information synchronization method and device, wherein the image query method is applied to the electronic equipment, the electronic equipment comprises a first storage area and a second storage area, the first storage area comprises at least one storage subarea for storing the image, the second storage area stores a first corresponding relation and a second corresponding relation, the first corresponding relation is a corresponding relation between validity information and identifiers of the storage subareas, each validity information is used for indicating whether the identifier corresponding to the validity information is valid or not, the second corresponding relation is a corresponding relation between an analysis result and index information, and each index information is used for indicating a storage path of the image of the analysis result corresponding to the index information in the first storage area; the image query method comprises the following steps:
when the analysis result to be queried exists in the second storage area, determining index information corresponding to the analysis result to be queried according to the second corresponding relation, and taking the index information as target index information;
acquiring a target identifier of a memory subarea corresponding to an analysis result to be queried from target index information, and judging whether validity information of the target identifier is valid or not according to a first corresponding relation;
If so, the image to which the target index information points is acquired from the first storage area.
In the technical scheme provided by the embodiment of the invention, when the analysis result to be queried exists in the second storage area, determining target index information corresponding to the analysis result to be queried according to the second corresponding relation; acquiring a target identifier of a memory subarea corresponding to an analysis result to be queried from target index information, and judging whether validity information of the target identifier is valid or not according to a first corresponding relation; if so, the image to which the target index information points is acquired from the first storage area. According to the technical scheme provided by the embodiment of the invention, after the target index information of the analysis result to be queried is determined, whether the target identifier of the memory subarea corresponding to the analysis result to be queried is valid is judged, and only under the condition that the target identifier is valid, the fact that the image corresponding to the analysis result to be queried is effectively stored in the memory subarea of the target identifier can be determined, and then the image can be queried from the first storage area. Therefore, under the condition that the target identifier is judged to be effective, the image is queried from the first storage area, so that the query efficiency of the image is improved, the query operation is prevented from being continuously executed under the condition that the target identifier is invalid, and CPU resources are saved.
The following first describes an image query method provided in the embodiments of the present application. The image query method is applied to an electronic device, which is used for storing images and can provide query services for the stored images, for example, the electronic device can be a recording and playing host machine and the like. In this embodiment, an electronic device is taken as a recording and playing host for illustration.
The electronic device may include a first storage area and a second storage area, where the first storage area and the second storage area may be located on the same storage medium, or may be located on different storage media, respectively, and are not limited herein.
When the first storage area and the second storage area are located in different storage media, respectively, the different storage media are each storage media in the electronic device. For example, the first storage area is located in the hard disk 1, the second storage area is located in the SSD (Solid State Drives, solid state disk), wherein the hard disk 1 and the SSD are two different storage media, and the hard disk 1 and the SSD are both storage media in the electronic device.
The first memory area may include at least one memory sub-area, where the memory sub-areas are all used to store images, and the memory spaces of the memory sub-areas may be the same or different, and are not limited herein. For each memory subarea, an identification may be assigned to distinguish from other memory subareas. For any one time, each memory subarea corresponds to only one identifier, that is, at any one time, each memory subarea is in one-to-one correspondence with an identifier.
The identity of each memory subarea may vary. When any one of the processes of formatting, covering, deleting and the like is adjusted to the memory subarea, the image stored in the memory subarea is deleted, and at this time, the identity of the memory subarea needs to be updated.
In one implementation, the current identifier of the memory sub-region is deleted, and an identifier is reassigned to the memory sub-region, where the reassigned identifier is an unused identifier of each memory sub-region in the first memory region.
For example, if the current identifier is 100 for a memory subarea in the first memory area, after formatting the memory subarea, the images stored in the memory subarea are all deleted, at this time, the current identifier 100 is deleted, and an identifier 101 is reassigned to the memory subarea. The memory sub-area is identified as 101.
The reassignment identifiers can be randomly assigned or assigned according to rules, and the rules can be custom set. For example, the allocation is performed sequentially in order of integers from smaller to larger.
Based on the identity of the memory subregion being variable, it is believed that the identity of the memory subregion corresponds to the image stored in that memory subregion. For example, 100 images are stored in the memory sub-area a, and the current identifier of the memory sub-area a is 2, at this time, the identifier 2 can be considered to correspond to the 100 images. After the memory sub-area a is formatted, the 100 images are deleted, and another 50 images are restored in the memory sub-area a, and the identifier allocated to the memory sub-area a again is 3, then the identifier 3 corresponds to the 50 images.
For the second storage area, a first corresponding relation and a second corresponding relation can be stored, wherein the first corresponding relation is a corresponding relation between the validity information and the identification of the storage subarea, and the second corresponding relation is a corresponding relation between the analysis result and the index information.
Wherein, for the first correspondence, the validity information and the identifications of the memory subareas are in one-to-one correspondence, that is, each identification corresponds to one validity information. The first correspondence may be stored in the form of an entry, as shown in table 1 below:
TABLE 1
Identification of memory subareas Validity information
In the first correspondence, each validity information is used to indicate whether the identifier corresponding to the validity information is valid. If the validity information corresponding to the identifier is valid, the memory subarea represented by the identifier is valid, that is, the image stored in the memory subarea represented by the identifier exists. If the validity information corresponding to the identifier is invalid, the memory subarea represented by the identifier is invalid, that is, the image stored in the memory subarea represented by the identifier does not exist.
The representation of the validity information may be represented by any expression of validity and invalidity, presence and absence, and the like, and is not limited thereto.
When the memory sub-area update identifier exists in the first memory area, a new identifier is added. In order to make the first correspondence relation reflect the storage condition of the first storage area timely and accurately, the first correspondence relation in the second storage area needs to be updated correspondingly according to the update condition identified in the first storage area. Specifically, a new correspondence relation for the new identifier is added in the first correspondence relation, that is, the correspondence relation between the new identifier and the validity information is added, and the added correspondence relation is added to the first correspondence relation. In addition, validity information corresponding to the deleted identification is updated in the first correspondence relation.
In one embodiment, the second storage area may store a plurality of databases, each database storing analysis results for the image in the first storage area, and the storing of the analysis results in the second storage area may be performed separately according to the databases. And each database corresponds to at least one memory subarea, and the images corresponding to the analysis results in each database are stored in the memory subareas corresponding to the databases.
In this case, the first correspondence relationship may include information such as an identifier of the database and a name of the database, in addition to the correspondence relationship between the validity information and the identifier of the memory sub-region. That is, in the first correspondence, the identification of the memory subarea, the validity information, the database identification, and the database name are in correspondence. At this time, the first correspondence is stored in the form of an entry, as shown in table 2 below:
TABLE 2
Identification of memory subareas Validity information Database identification Database name
In addition, the first correspondence may further include other information such as a type of a file stored in the memory sub-area and a time of recording an analysis result in the database, and in this case, the first correspondence is stored in a form of a table entry, as shown in table 3 below:
TABLE 3 Table 3
Figure BDA0001833661390000101
The analysis results in the second correspondence are stored in advance, and each image may correspond to at least one analysis result, where the analysis results are obtained by analyzing the images in the first storage area. The analysis of the image may be performed by the electronic device in the embodiments of the present application, or may be performed by another device. When the analysis operation of the image is executed by other equipment, the other equipment can obtain a corresponding analysis result after the analysis of the image is completed, and the obtained analysis result is stored in the electronic equipment of the embodiment of the application.
The analysis results may include a face analysis result and a behavior analysis result. The face analysis result is the faces contained in the image, identity characteristic information corresponding to each face, and the like. In one implementation, the image is analyzed through a face recognition technology, whether the image comprises a face image or not can be judged, and each face image can be further recognized under the condition that the image comprises the face image, so that identity characteristic information corresponding to each face is determined.
For example, the image 1 includes a face a, a face b and a face c, and by analyzing the image 1 through a face recognition technology, it can be determined that the image 1 includes a face, and an image area of each face in the image 1 can be determined. After the image areas of the face a, the face b and the face c are determined, identity recognition can be further performed, so that identity information of the face a, identity information of the face b and identity information of the face c are determined.
The behavior analysis result is a result obtained by analyzing the behavior of the analysis object in the image. The object of the behavioral analysis may be a human or an animal, which is not limited herein. In the embodiment of the present application, a person is described as an analysis object.
The behavior of the analysis object may be standing, sitting, squatting, walking, chatting, playing a mobile phone, etc., and thus, the behavior analysis result is the behavior of each analysis object in the graph. For example, a student's lesson image includes student a, student b and student c, where the behavior analysis result for student a is to play a mobile phone, the behavior analysis result for student b is to stand, and the behavior analysis result for student c is to chat.
The index information in the second corresponding relation is preset, and each index information is used for representing the storage path of the image of the analysis result corresponding to the index information in the first storage area. That is, each analysis result corresponds to one index information. Each index information corresponds to an image representing a storage path of the image. Thus, each analysis result corresponds to one image, and one image can correspond to a plurality of analysis results, and the analysis result is one of the analysis results obtained after the image is analyzed.
For example, one analysis result is that the user a is playing a mobile phone, and index information corresponding to the analysis result is index information a, where the index information a represents a storage path of the image a in the first storage area, and the storage path specifically is: c \Users\ First Storage Area \ Storage sub Area Number \Picturenumber, wherein First Storage Area represents the first storage region, storage sub Area Number represents the identification of the storage sub-region, and Picturenumber represents the identification of the image. The analysis result is one of analysis results obtained by analyzing the image a. When the image corresponding to the result is required to be inquired, index information a corresponding to the analysis result can be determined through the second corresponding relation, then the position of the image a in the first storage area can be determined according to the index information a, and the image a is acquired from the first storage area.
In one embodiment, the second storage area may further include image information and reservation information of the image corresponding to the analysis result, in addition to the first correspondence relationship and the second correspondence relationship, where the image information includes at least one of image type, acquisition time of the image, PTZ (Pan/Tilt/Zoom) information of the image, attribute information of the image, and the like.
As shown in fig. 1, the second storage area stores therein a first correspondence, a second correspondence, an image type, an acquisition time of the image, PTZ information of the image, attribute information of the image, and reservation information. The second correspondence includes a correspondence between a behavior analysis result and index information, and a correspondence between a face analysis result and index information. The image types include a complete image and a feature area image for a behavior, a feature area image for a face. The acquisition time of the image may be filled in by the electronic device, for example, the acquisition time of the image may be: and after the image is analyzed, the time of the image received by the electronic equipment. The PTZ information of the image comprises PTZ information aiming at the behavior and PTZ information aiming at the face, wherein the PTZ information aiming at the behavior can be PTZ position information of a front-end IPC (Internet protocol Camera) when the image aiming at the behavior is acquired, and the PTZ information aiming at the behavior is set to 0 when the front-end IPC does not provide the PTZ information; the PTZ information for a face may be PTZ position information of the front-end IPC when an image for the face is acquired; the front-end IPC may be used to acquire images for behaviors or faces, among other things. The attribute information of the image includes a format, resolution, image size, and the like of the image. The reservation information is used as an extension section, and may include an identification number of an image, etc.
The image query method provided by the embodiment of the application, as shown in fig. 2, includes the following steps.
S201, when the analysis result to be queried exists in the second storage area, determining index information corresponding to the analysis result to be queried according to the second corresponding relation, and taking the index information as target index information.
The analysis result to be queried is the analysis result of the query required by the user. For example, the user needs to query the image corresponding to the action of "playing mobile phone", if the analysis result of "playing mobile phone" exists in the second storage area, the "playing mobile phone" is the analysis result to be queried.
Based on the corresponding relation between the analysis result and the index information recorded in the second corresponding relation, the index information corresponding to the analysis result to be queried can be determined according to the second corresponding relation.
For example, the analysis result to be queried is a mobile phone playing, and in the second corresponding relationship, the index information corresponding to the analysis result of the mobile phone playing includes index information 1 and index information 2, wherein the index information 1 represents a storage path of the image a, and the index information 2 represents a storage path of the image b. The index information corresponding to the analysis result to be queried is index information 1 and index information 2, and the index information 1 and the index information 2 are target index information.
S202, obtaining target identifiers of memory subareas corresponding to analysis results to be queried from target index information, and judging whether validity information of the target identifiers is valid or not according to the first corresponding relation. If so, step S203 is performed.
The target index information indicates a storage path of the image corresponding to the analysis result to be queried in the first storage area, so that the target index information contains an identification of a storage subarea, and the storage subarea is the storage subarea stored by the image corresponding to the analysis result to be queried. After the target index information is determined, the identification of the memory sub-region can be obtained from the target index information and used as a target identification.
Based on the corresponding relation between the validity information in the first corresponding relation and the identification of the memory subareas, the validity information corresponding to the identification of any memory subarea can be determined. After the target identifier is acquired, validity information corresponding to the target identifier can be determined from the first corresponding relation, and whether the target identifier is valid or not can be judged from the determined validity information.
For example, the target index information is: c \Users\ First Storage Area \Number10\Number255, wherein Number10 represents the identification of the memory subarea, and Number255 represents the identification of the image corresponding to the analysis result to be queried. The target identification of the memory sub-area acquired from the target index information is Number10. In the first correspondence, if the validity information corresponding to the Number10 is set to be valid, the validity information corresponding to the Number10 may be determined to be valid according to the first correspondence.
When the validity information of the target identifier is judged to be invalid, the image stored in the storage subarea indicated by the target identifier is indicated to be absent. That is, the image corresponding to the analysis result to be queried is not existed, so that the image corresponding to the analysis result to be queried cannot be obtained from the first storage area.
In one embodiment, when the validity information of the target identifier is determined to be invalid, the electronic device may prompt that the image corresponding to the analysis result to be queried does not exist, and the image corresponding to the analysis result to be queried cannot be obtained.
S203, acquiring the image pointed by the target index information from the first storage area.
When the validity information of the target identifier is judged to be valid, an image pointed by the target index information can be obtained from the first storage area according to the target index information, and the image is the image corresponding to the analysis result to be queried.
For example, the target index information is: c \Users\ First Storage Area \Number5\Number255, wherein Number5 is the identification of the memory subarea, and Number255 is the identification of the image corresponding to the analysis result to be queried. In the first correspondence, if the validity information corresponding to Number5 is valid, an image with an image identification Number of 255 is acquired from a storage sub-area with an identification Number of 5 included in the first storage area according to the target index information. The image with the image identification number of 255 is the image corresponding to the analysis result to be queried.
In one embodiment, one analysis result corresponds to one image, and one image may correspond to a plurality of analysis results. That is, a single image is analyzed, and a plurality of analysis results for the image can be obtained.
In one implementation, the analysis of the image includes an analysis of the entirety of the image, as well as an analysis of the analysis object included in the image. Thus, the analysis result for each image may include the analysis result for the whole image as well as the analysis result for each analysis object in the image.
When the analysis result is the analysis result aiming at the whole image, the image corresponding to the analysis result is the complete image of the image. When the analysis result is the analysis result of each analysis object in the image, the image corresponding to the analysis result is the characteristic area image in the image, wherein the characteristic area image is the area image used for representing the analysis object contained in the complete image.
For example, image a contains 2 analysis objects: object 1 and object 2, then analysing image a may yield 3 analysis results: analysis result 1, analysis result 2, and analysis result 3. The analysis result 1 is an analysis result for the whole image a, and the image corresponding to the analysis result 1 is the image a. The analysis result 2 is an analysis result for the object 1, and the image corresponding to the analysis result 2 is a feature area image b, which is an area image for the object 1 in the image a. The analysis result 3 is an analysis result for the object 2, and the image corresponding to the analysis result 3 is a feature area image c, which is an area image for the object 2 in the image a.
Based on the above description, the type of the image corresponding to the analysis result includes the complete image and the characteristic region image, and then the image stored in the first storage region includes the complete image and the characteristic region image. The index information includes first index information for representing a storage path of the feature area image and second index information for representing a storage path of the complete image.
The step of determining index information corresponding to the analysis result to be queried as target index information according to the second correspondence (S201) may include the following steps.
According to the second corresponding relation, determining first index information corresponding to the analysis result to be queried, and taking the first index information as first target index information; and/or determining second index information corresponding to the analysis result to be queried according to the second corresponding relation, and taking the second index information as second target index information.
That is, when the image corresponding to the analysis result to be queried includes only the feature region image for the analysis object, the index information corresponding to the analysis result to be queried includes only the first index information representing the feature region image, and at this time, the first index information corresponding to the analysis result to be queried may be determined according to the second correspondence.
When the image corresponding to the analysis result to be queried only comprises the complete image aiming at the whole image, the index information corresponding to the analysis result to be queried only comprises the second index information representing the complete image, and at this time, the second index information corresponding to the analysis result to be queried can be determined according to the second corresponding relation.
When the image corresponding to the analysis result to be queried comprises the characteristic area image and the complete image, the index information corresponding to the analysis result to be queried comprises the first index information and the second index information, and at this time, according to the second corresponding relation, the first index information corresponding to the analysis result to be queried and the second index information corresponding to the analysis result to be queried can be determined.
The step of acquiring the image to which the target index information points from the first storage area (S203) may include the following steps.
And acquiring the characteristic region image pointed by the first target index information from the first storage region, and/or acquiring the complete image pointed by the second target index information.
That is, when only the first target index information is determined according to the second correspondence, the feature area image pointed to by the first target index information may be acquired from the first storage area.
When only the second target index information is determined according to the second corresponding relation, the complete image pointed by the second target index information can be obtained from the first storage area.
When the first target index information and the second target index information are determined according to the second corresponding relation, the characteristic area image pointed by the first target index information can be obtained from the first storage area, and the complete image pointed by the second target index information can be obtained.
For example, the analysis result to be queried is a standing-up behavior, the complete image corresponding to the analysis result to be queried is a lesson standing-up image a of the students, the complete image contains 4 students, and the 4 students stand up, so that the 4 students can be considered as analysis objects in the image. Then, the image a, the feature area image b, the feature area image c, the feature area image d, and the feature area image e are stored in the first storage area, wherein the feature area image b, the feature area image c, the feature area image d, and the feature area image e are area images for 4 students, respectively.
Then, for the query analysis result, the corresponding image includes an image a, a feature area image b, a feature area image c, a feature area image d, and a feature area image e, and according to a second correspondence, first target index information and second target index information corresponding to the query analysis result may be determined, where the first target index information includes 4 index information, the 4 index information is a storage path of the area images for 4 students, and the second target index information is a storage path of the image a. After the index information corresponding to the analysis result to be queried is determined, the characteristic area image b, the characteristic area image c, the characteristic area image d and the characteristic area image e for 4 students can be respectively acquired from the first storage area according to 4 index information included in the first target index information, and the image a is acquired according to the second target index information.
In the technical scheme provided by the embodiment of the invention, when the analysis result to be queried exists in the second storage area, determining target index information corresponding to the analysis result to be queried according to the second corresponding relation; acquiring a target identifier of a memory subarea corresponding to an analysis result to be queried from target index information, and judging whether validity information of the target identifier is valid or not according to a first corresponding relation; if so, the image to which the target index information points is acquired from the first storage area. According to the technical scheme provided by the embodiment of the invention, after the target index information of the analysis result to be queried is determined, whether the target identifier of the memory subarea corresponding to the analysis result to be queried is valid is judged, and only under the condition that the target identifier is valid, the fact that the image corresponding to the analysis result to be queried is effectively stored in the memory subarea of the target identifier can be determined, and then the image can be queried from the first storage area. Therefore, under the condition that the target identifier is judged to be effective, the image is queried from the first storage area, so that the query efficiency of the image is improved, the query operation is prevented from being continuously executed under the condition that the target identifier is invalid, and CPU resources are saved.
The embodiment of the invention also provides an information synchronization method which is applied to the electronic equipment, wherein the electronic equipment comprises a first storage area and a second storage area, the first storage area and the second storage area can be positioned on the same storage medium, and can be respectively positioned on different storage media, and the method is not limited.
The first storage area comprises at least one storage subarea for storing images, the second storage area stores the corresponding relation between the validity information and the identification of the storage subarea, and each validity information is used for indicating whether the identification corresponding to the validity information is valid or not.
As shown in fig. 3, the information synchronization method includes the following steps.
S301, when the memory subarea exists in the first memory area and is adjusted, acquiring the current identification of the adjusted memory subarea.
The memory subarea is adjusted in a format, covered, deleted and the like. Formatting means that the memory subarea is formatted, and after formatting, the image stored in the memory subarea is deleted; the overlaying refers to the image stored in the memory subarea being overlaid; deleted refers to the deletion of an image stored in the memory sub-region.
The current identity of the adjusted memory sub-region is obtained. For example, the first memory area includes 5 memory sub-areas, where the current identifiers of the 5 memory sub-areas are 1, 2, 3, 4 and 5, respectively, and when the memory sub-area identified as 2 is formatted, the current identifier of the memory sub-area is 2, and the obtained current identifier of the memory sub-area is 2.
In one embodiment, when a memory subarea exists in the first memory area and is adjusted, then the adjusted memory subarea may be reassigned with an identification. Namely deleting the current identification of the memory subarea, and reassigning a new identification to the memory subarea. Wherein, in order to represent the uniqueness of the corresponding identification of each memory subarea, the reassigned new identification is different from the previous identification of the memory subarea and the current and previous identifications of other memory subareas.
In one implementation, the identifiers used as memory sub-regions may be sequentially allocated in order of positive integer from smaller to larger. For example, if the first memory area includes 6 memory subregions, the initial identifiers of the 6 memory subregions are 1, 2, 3, 4, 5, and 6, and when the memory subregion whose initial identifier is 2 is adjusted, the identifier of the memory subregion is updated to 7. When the memory sub-region initially identified as 6 is adjusted, the identity of the memory sub-region is updated to 8. And so on.
When the memory subarea exists in the first memory area and is adjusted, the current identification of the memory subarea is acquired before the identification of the memory subarea is updated, and the current identification is the identification before the update.
For example, when the memory sub-region with the identifier of 2 is adjusted, the current identifier of the memory sub-region is acquired, the identifier is 2, then the identifier of the memory sub-region is updated to 7, and the identifier of the memory sub-region after the update is 7.
S302, changing the validity information identified in the first corresponding relation to be invalid in the second storage area.
After the current identification of the adjusted memory subarea is obtained, the validity information corresponding to the identification is obtained from the first corresponding relation of the second memory area, and the validity information corresponding to the identification is changed to be invalid.
For example, in the first correspondence, the validity information corresponding to the identifier 2 is valid, the validity information corresponding to the identifier 3 is valid, and the validity information corresponding to the identifier 4 is valid. When the memory subarea of the identifier 3 is formatted, the current identifier 3 of the memory subarea can be obtained, and then the validity information of the identifier 3 in the first corresponding relation is changed to be invalid. At this time, in the first correspondence, the validity information corresponding to the identifier 2 is valid, the validity information corresponding to the identifier 3 is invalid, and the validity information corresponding to the identifier 4 is valid.
According to the information synchronization method provided by the embodiment of the invention, when the memory subarea in the first memory area is adjusted, the validity information of the identification of the memory subarea in the first corresponding relation is updated and changed to be invalid. Therefore, the first corresponding relation is synchronous with the memory subareas in the first memory area, and the validity of each memory subarea in the first memory area can be accurately reflected in real time. Particularly, when the image query is performed, whether the query operation is executed can be determined according to the validity of the memory subarea reflected by the first corresponding relation. Therefore, under the condition that the storage subarea is invalid, the query operation can be stopped, and the CPU resource of the electronic equipment is saved.
In one embodiment, the second storage area further stores at least one database, and each database stores analysis results for the image in the first storage area, wherein the analysis results include a behavior analysis result and a face analysis result.
Each database corresponds to at least one memory subarea, and the images corresponding to the analysis results in each database are stored in the memory subareas corresponding to the database. For each memory subarea only one database may be corresponding.
For example, as shown in fig. 4, two databases, namely, a database 1 and a database 2 are stored in the second storage area, the memory subarea corresponding to the database 1 includes a memory subarea 1, a memory subarea 2 and a memory subarea 3, and the memory subarea corresponding to the database 2 includes a memory subarea 4 and a memory subarea 5. The images corresponding to the analysis results in the database 1 are stored in the memory subarea 1, the memory subarea 2 and the memory subarea 3; the images corresponding to the analysis results in the database 2 are stored in the memory sub-area 4 and the memory sub-area 5.
On the basis of the embodiment corresponding to fig. 3, the information synchronization method may further include the following steps.
And when the database exists in the second storage area and is deleted, determining the current identification of the storage subarea corresponding to the deleted database.
The database in the second storage area is deleted, and the analysis results stored in the database are deleted.
In one implementation manner of deleting the databases in the second storage area, when the second storage area includes at least two databases, the databases may be sequentially utilized for implementing centralized storage when the analysis result is stored. I.e. each stage is stored with only one database, and only when there is no remaining memory space in that database can be stored with another database.
It is considered that the analysis results in the database used first are stored earlier and the analysis results in the database used later are stored relatively later. For example, the second storage area includes the database 1, the database 2 and the database 3, wherein the analysis result is stored in the database 1, then in the database 2, and finally in the database 3, the analysis result in the database 1 may be stored half a year ago, and the analysis result in the database 3 may be stored 1 month ago.
When the remaining storage space in the second storage area is insufficient and the storage space needs to be released, the databases can be deleted according to the time sequence, namely, the databases with earlier storage time are deleted preferentially, and after the databases with earlier storage time are deleted, the current identification of the storage subarea corresponding to the databases with earlier storage time is determined.
For example, the second storage area includes a database 1 and a database 2, where the database 1 is used for storing first, and the database 2 is used for storing when the remaining storage space in the database 1 is insufficient. When the database in the second storage area needs to be deleted, the database 1 is preferentially deleted, and after the database 1 is deleted, the current identification of the memory subarea corresponding to the database 1 is determined.
And performing release processing on the identified memory subarea in the first memory area, and reallocating the identification for the memory subarea which is subjected to the release processing.
The release processing is to delete all the images stored in the memory subarea and release all the memory space of the memory subarea. For example, the release process may be a formatting process for the memory subregion.
The reassigned identity is different from the identity before the memory sub-region is released and the current and previous identities of other memory sub-regions in the first memory region. In this way, the uniqueness of the identity of each memory sub-region is guaranteed.
For example, the memory sub-area corresponding to the database 1 includes a memory sub-area 1 identified as 1, a memory sub-area 2 identified as 2, and a memory sub-area 3 identified as 3, when the database 1 is deleted, release processing is performed on the memory sub-area 1, the memory sub-area 2, and the memory sub-area 3, and the identifiers are allocated to the memory sub-area 1, the memory sub-area 2, and the memory sub-area 3 again, after the identifiers are allocated again, the identifier of the memory sub-area 1 is 4, the identifier of the memory sub-area 2 is 5, and the identifier of the memory sub-area 3 is 6.
In one embodiment, in order to ensure accuracy of the correspondence between the validity information in the first correspondence and the identifier of the memory sub-area, the electronic device may verify and update the stored first correspondence according to a preset rule.
The preset rule may be set in a user-defined manner, for example, the electronic device may perform verification and update on the first corresponding relationship after each start, and may also perform verification and update on the first corresponding relationship every other preset time.
The method for checking and updating the first corresponding relation comprises the following steps.
And acquiring the identification corresponding to the validity information which is indicated as valid from the first corresponding relation, and judging whether the acquired identification exists in the identifications of the memory subareas included in the first memory area.
The corresponding identification may be considered valid for the memory sub-region comprised by the current first memory region. Then, the valid identifier is represented in the first correspondence, and is also present in the identifier of the memory sub-area comprised in the first memory area. If the first correspondence relationship indicates a valid flag, and the flag does not exist in the memory sub-area included in the first memory area, it is considered that the validity information corresponding to the flag is wrong, and it is necessary to change the validity information corresponding to the flag in the first correspondence relationship to invalid.
Therefore, if it is determined that the acquired identifier exists in the identifiers of the memory subareas included in the first memory area, the identifier can be determined to be valid, and validity information corresponding to the identifier in the first correspondence relationship is kept unchanged. If it is determined that the acquired identifier does not exist in the identifiers of the memory subareas included in the first memory area, the identifier may be determined to be invalid, and validity information corresponding to the identifier in the first correspondence relationship may be changed to be invalid.
For example, in the first correspondence, the validity information corresponding to the identifier 1 is valid, the validity information corresponding to the identifier 2 is valid, the validity information corresponding to the identifier 3 is valid, and the validity information corresponding to the identifier 4 is invalid, so that the identifier corresponding to the validity information indicated as valid is obtained from the first correspondence and includes the identifier 1, the identifier 2 and the identifier 3. The identifiers of the memory sub-regions included in the current first memory region are identifier 1, identifier 2 and identifier 5, so that it can be determined that identifier 1 and identifier 2 are present in the identifier of the memory sub-region included in the first memory region, and identifier 3 is absent in the identifier of the memory sub-region included in the first memory region. It may be determined that the flag 1 and the flag 2 are valid and the flag 3 is invalid, and the validity information corresponding to the flag 3 in the first correspondence is changed to be invalid.
According to the information synchronization method provided by the embodiment of the invention, when the memory subarea in the first memory area is adjusted, the validity information of the identification of the memory subarea in the first corresponding relation is updated and changed to be invalid. Therefore, the first corresponding relation is synchronous with the memory subareas in the first memory area, and the validity of each memory subarea in the first memory area can be accurately reflected in real time. Particularly, when the image query is performed, whether the query operation is executed can be determined according to the validity of the memory subarea reflected by the first corresponding relation. Therefore, under the condition that the storage subarea is invalid, the query operation can be stopped, and the CPU resource of the electronic equipment is saved.
Corresponding to the embodiment of the image query method, the embodiment of the invention also provides an image query device which is applied to electronic equipment, wherein the electronic equipment comprises a first storage area and a second storage area, the first storage area comprises at least one storage subarea for storing images, the second storage area stores a first corresponding relation and a second corresponding relation, the first corresponding relation is a corresponding relation between validity information and identification of the storage subarea, each validity information is used for indicating whether the identification corresponding to the validity information is valid or not, the second corresponding relation is a corresponding relation between an analysis result and index information, and each index information is used for indicating a storage path of the image of the analysis result corresponding to the index information in the first storage area; as shown in fig. 5, the image query apparatus includes:
the determining module 510 is configured to determine, when the analysis result to be queried exists in the second storage area, index information corresponding to the analysis result to be queried according to the second correspondence, as target index information;
the judging module 520 is configured to obtain, from the target index information, a target identifier of a memory sub-area corresponding to the analysis result to be queried, and judge, according to the first correspondence, whether validity information of the target identifier is valid;
And an obtaining module 530, configured to obtain, when the determination result of the determining module is yes, the image pointed to by the target index information from the first storage area.
Optionally, the image stored in the first storage area includes a complete image and a feature area image, where the feature area image is an area image in the complete image that is used to represent an analysis object included in the complete image; the index information comprises first index information and second index information, wherein the first index information is used for representing a storage path of the characteristic region image, and the second index information is used for representing a storage path of the complete image;
the determining module 510 is specifically configured to:
according to the second corresponding relation, determining first index information corresponding to the analysis result to be queried, and taking the first index information as first target index information; and/or determining second index information corresponding to the analysis result to be queried according to the second corresponding relation, and taking the second index information as second target index information;
the obtaining module 530 is specifically configured to:
and acquiring the characteristic region image pointed by the first target index information from the first storage region, and/or acquiring the complete image pointed by the second target index information.
In the technical scheme provided by the embodiment of the invention, when the analysis result to be queried exists in the second storage area, determining target index information corresponding to the analysis result to be queried according to the second corresponding relation; acquiring a target identifier of a memory subarea corresponding to an analysis result to be queried from target index information, and judging whether validity information of the target identifier is valid or not according to a first corresponding relation; if so, the image to which the target index information points is acquired from the first storage area. According to the technical scheme provided by the embodiment of the invention, after the target index information of the analysis result to be queried is determined, whether the target identifier of the memory subarea corresponding to the analysis result to be queried is valid is judged, and only under the condition that the target identifier is valid, the fact that the image corresponding to the analysis result to be queried is effectively stored in the memory subarea of the target identifier can be determined, and then the image can be queried from the first storage area. Therefore, under the condition that the target identifier is judged to be effective, the image is queried from the first storage area, so that the query efficiency of the image is improved, the query operation is prevented from being continuously executed under the condition that the target identifier is invalid, and CPU resources are saved.
Corresponding to the above information synchronization method embodiment, the embodiment of the present invention further provides an information synchronization device, which is applied to an electronic device, where the electronic device includes a first storage area and a second storage area, the first storage area includes at least one storage sub-area for storing an image, the second storage area stores a first correspondence between validity information and an identifier of the storage sub-area, and each validity information is used to indicate whether the identifier corresponding to the validity information is valid; as shown in fig. 6, the information synchronization apparatus includes:
a first obtaining module 610, configured to obtain, when a memory sub-region existing in the first storage area is adjusted, a current identifier of the adjusted memory sub-region;
a changing module 620, configured to change the validity information identified in the first correspondence relationship to invalid in the second storage area.
Optionally, the information synchronization device may further include:
and the allocation module is used for reallocating the identification for the adjusted memory subarea.
Optionally, at least one database is further stored in the second storage area, each database stores an analysis result for the image in the first storage area, each database corresponds to at least one storage subarea, and the image corresponding to the analysis result in each database is stored in the storage subarea corresponding to the database; the information synchronization device may further include:
The first determining module is used for determining the current identification of the memory subarea corresponding to the deleted database when the database exists in the second memory area and is deleted;
the allocation module is further configured to perform release processing on the identified memory sub-area in the first memory area, and reallocate the identification for the memory sub-area that completes the release processing.
Optionally, the information synchronization device may further include:
the second acquisition module is used for acquiring the identification corresponding to the validity information which is indicated as valid from the first corresponding relation;
the judging module is used for judging whether the obtained identification exists in the identifications of the memory subareas included in the first memory area;
the second determining module is used for determining that the mark is valid when the judging result of the judging module is yes; and when the judging result of the judging module is NO, determining that the mark is invalid.
According to the information synchronization method provided by the embodiment of the invention, when the memory subarea in the first memory area is adjusted, the validity information of the identification of the memory subarea in the first corresponding relation is updated and changed to be invalid. Therefore, the first corresponding relation is synchronous with the memory subareas in the first memory area, and the validity of each memory subarea in the first memory area can be accurately reflected in real time. Particularly, when the image query is performed, whether the query operation is executed can be determined according to the validity of the memory subarea reflected by the first corresponding relation. Therefore, under the condition that the storage subarea is invalid, the query operation can be stopped, and the CPU resource of the electronic equipment is saved.
Corresponding to the above-mentioned image query method embodiment, the embodiment of the present invention further provides an electronic device, as shown in fig. 7, including a processor 710, a communication interface 720, a memory 730, and a communication bus 740, where the processor 710, the communication interface 720, and the memory 730 complete communication with each other through the communication bus 740;
a memory 730 for storing a computer program;
processor 710, when executing the program stored on memory 730, performs the following steps:
when the analysis result to be queried exists in the second storage area, determining index information corresponding to the analysis result to be queried according to the second corresponding relation, and taking the index information as target index information;
acquiring a target identifier of a memory subarea corresponding to an analysis result to be queried from target index information, and judging whether validity information of the target identifier is valid or not according to a first corresponding relation;
if so, the image to which the target index information points is acquired from the first storage area.
According to the technical scheme provided by the embodiment of the invention, after the target index information of the analysis result to be queried is determined, whether the target identifier of the memory subarea corresponding to the analysis result to be queried is valid is judged, and only under the condition that the target identifier is valid, the fact that the image corresponding to the analysis result to be queried is effectively stored in the memory subarea of the target identifier can be determined, and then the image can be queried from the first storage area. Therefore, under the condition that the target identifier is judged to be effective, the image is queried from the first storage area, so that the query efficiency of the image is improved, the query operation is prevented from being continuously executed under the condition that the target identifier is invalid, and CPU resources are saved.
The communication bus mentioned above for the electronic devices may be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the electronic device and other devices.
The Memory may include random access Memory (Random Access Memory, RAM) or may include Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but also digital signal processors (Digital Signal Processing, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
Corresponding to the above-mentioned image query method embodiments, the present invention further provides a machine-readable storage medium, in which a computer program is stored, which when executed by a processor, implements any of the above-mentioned image query method steps.
Corresponding to the above information synchronization method embodiment, the embodiment of the present invention further provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
and the processor is used for realizing the following steps when executing the program stored in the memory:
when the memory subarea exists in the first memory area and is adjusted, acquiring the current identification of the adjusted memory subarea;
and changing the validity information identified in the first corresponding relation to be invalid in the second storage area.
According to the information synchronization method provided by the embodiment of the invention, when the memory subarea in the first memory area is adjusted, the validity information of the identification of the memory subarea in the first corresponding relation is updated and changed to be invalid. Therefore, the first corresponding relation is synchronous with the memory subareas in the first memory area, and the validity of each memory subarea in the first memory area can be accurately reflected in real time. Particularly, when the image query is performed, whether the query operation is executed can be determined according to the validity of the memory subarea reflected by the first corresponding relation. Therefore, under the condition that the storage subarea is invalid, the query operation can be stopped, and the CPU resource of the electronic equipment is saved.
The communication bus mentioned above for the electronic devices may be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the electronic device and other devices.
The Memory may include random access Memory (Random Access Memory, RAM) or may include Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but also digital signal processors (Digital Signal Processing, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
Corresponding to the above information synchronization method embodiments, the present invention further provides a machine-readable storage medium, in which a computer program is stored, which when executed by a processor, implements any of the above information synchronization method steps.
It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In this specification, each embodiment is described in a related manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for the image query apparatus, the information synchronization apparatus, the electronic device, and the machine-readable storage medium embodiments, since they are substantially similar to the image query method and the information synchronization method embodiments, the description is relatively simple, and the relevant points are referred to in the description of the method embodiments.
The foregoing description is only of the preferred embodiments of the present invention and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims (14)

1. The image query method is characterized by being applied to electronic equipment, wherein the electronic equipment comprises a first storage area and a second storage area, the first storage area comprises at least one storage subarea for storing images, the second storage area stores a first corresponding relation and a second corresponding relation, the first corresponding relation is a corresponding relation between validity information and identification of the storage subarea, each validity information is used for indicating whether the identification corresponding to the validity information is valid or not, the second corresponding relation is a corresponding relation between an analysis result and index information, and each index information is used for indicating a storage path of the images corresponding to the index information in the first storage area;
The method comprises the following steps:
when an analysis result to be queried exists in the second storage area, determining index information corresponding to the analysis result to be queried according to the second corresponding relation, and taking the index information as target index information;
acquiring a target identifier of a memory subarea corresponding to the analysis result to be queried from the target index information, and judging whether validity information of the target identifier is valid or not according to the first corresponding relation;
and if the target index information is valid, acquiring an image pointed by the target index information from the first storage area.
2. The method according to claim 1, wherein the image stored in the first storage area includes a complete image and a characteristic area image, wherein the characteristic area image is an area image in the complete image for representing an analysis object included in the complete image; the index information comprises first index information and second index information, wherein the first index information is used for representing a storage path of the characteristic region image, and the second index information is used for representing a storage path of the complete image;
the step of determining index information corresponding to the analysis result to be queried according to the second corresponding relation as target index information includes:
Determining first index information corresponding to the analysis result to be queried according to the second corresponding relation, and taking the first index information as first target index information; and/or determining second index information corresponding to the analysis result to be queried according to the second corresponding relation, and taking the second index information as second target index information;
the step of acquiring the image pointed to by the target index information from the first storage area includes:
and acquiring a characteristic area image pointed by the first target index information from the first storage area, and/or acquiring a complete image pointed by the second target index information.
3. The method according to claim 1, characterized in that the method comprises:
when the memory subarea exists in the first memory area and is adjusted, acquiring the current identification of the adjusted memory subarea;
and changing the validity information of the identification in the first corresponding relation into invalid in the second storage area.
4. A method according to claim 3, characterized in that the method further comprises:
reassigning an identification to the adjusted memory sub-region.
5. A method according to claim 3, wherein the second storage area further stores at least one database, each database stores analysis results for the images in the first storage area, each database corresponds to at least one storage subarea, and the images corresponding to the analysis results in each database are stored in the storage subareas corresponding to the databases; the method further comprises the steps of:
When the database exists in the second storage area and is deleted, determining the current identification of the storage subarea corresponding to the deleted database;
and carrying out release processing on the identified memory subarea in the first memory area, and reallocating the identification for the memory subarea which completes the release processing.
6. A method according to claim 3, characterized in that the method further comprises:
acquiring an identifier corresponding to the validity information which is indicated as valid from the first corresponding relation;
judging whether the acquired identifier exists in the identifiers of the memory subareas included in the first memory area;
if so, determining the identification as valid;
if not, the identification is determined to be invalid.
7. The image query device is characterized by being applied to electronic equipment, wherein the electronic equipment comprises a first storage area and a second storage area, the first storage area comprises at least one storage subarea for storing images, the second storage area stores a first corresponding relation and a second corresponding relation, the first corresponding relation is a corresponding relation between validity information and identification of the storage subarea, each validity information is used for indicating whether the identification corresponding to the validity information is valid or not, the second corresponding relation is a corresponding relation between an analysis result and index information, and each index information is used for indicating a storage path of the images corresponding to the index information in the first storage area;
The device comprises:
the determining module is used for determining index information corresponding to the analysis result to be queried according to the second corresponding relation when the analysis result to be queried exists in the second storage area, and the index information is used as target index information;
the judging module is used for acquiring the target identification of the memory subarea corresponding to the analysis result to be queried from the target index information and judging whether the validity information of the target identification is valid or not according to the first corresponding relation;
and the acquisition module is used for acquiring the image pointed by the target index information from the first storage area when the judging result of the judging module is yes.
8. The apparatus according to claim 7, wherein the image stored in the first storage area includes a complete image and a characteristic area image, wherein the characteristic area image is an area image in the complete image for representing an analysis object included in the complete image; the index information comprises first index information and second index information, wherein the first index information is used for representing a storage path of the characteristic region image, and the second index information is used for representing a storage path of the complete image;
The determining module is specifically configured to:
determining first index information corresponding to the analysis result to be queried according to the second corresponding relation, and taking the first index information as first target index information; and/or determining second index information corresponding to the analysis result to be queried according to the second corresponding relation, and taking the second index information as second target index information;
the acquisition module is specifically configured to:
and acquiring a characteristic area image pointed by the first target index information from the first storage area, and/or acquiring a complete image pointed by the second target index information.
9. The apparatus of claim 7, wherein the apparatus comprises:
the first acquisition module is used for acquiring the current identification of the adjusted memory subarea when the memory subarea exists in the first memory area and is adjusted;
and the changing module is used for changing the validity information of the identification in the first corresponding relation into invalid in the second storage area.
10. The apparatus of claim 9, wherein the apparatus further comprises:
and the allocation module is used for reallocating the identification for the adjusted memory subarea.
11. The apparatus of claim 10, wherein the second storage area further stores at least one database, each database stores analysis results for the images in the first storage area, each database corresponds to at least one storage subarea, and the images corresponding to the analysis results in each database are stored in the storage subareas corresponding to the databases; the apparatus further comprises:
the first determining module is used for determining the current identification of the memory subarea corresponding to the deleted database when the database exists in the second memory area and is deleted;
the allocation module is further configured to perform release processing on the identified memory sub-area in the first memory area, and reallocate the identification for the memory sub-area that completes the release processing.
12. The apparatus of claim 9, wherein the apparatus further comprises:
the second acquisition module is used for acquiring an identifier corresponding to the validity information which is indicated as valid from the first corresponding relation;
the judging module is used for judging whether the obtained identification exists in the identifications of the memory subareas included in the first memory area;
The second determining module is used for determining that the mark is valid when the judging result of the judging module is yes; and when the judging result of the judging module is NO, determining that the mark is invalid.
13. The electronic equipment is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
a memory for storing a computer program;
a processor for carrying out the method steps of any one of claims 1-6 when executing a program stored on a memory.
14. A machine-readable storage medium, characterized in that it has stored therein a computer program which, when executed by a processor, implements the method steps of any of claims 1-6.
CN201811216433.5A 2018-10-18 2018-10-18 Image query and information synchronization method and device Active CN111078906B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811216433.5A CN111078906B (en) 2018-10-18 2018-10-18 Image query and information synchronization method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811216433.5A CN111078906B (en) 2018-10-18 2018-10-18 Image query and information synchronization method and device

Publications (2)

Publication Number Publication Date
CN111078906A CN111078906A (en) 2020-04-28
CN111078906B true CN111078906B (en) 2023-05-19

Family

ID=70309361

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811216433.5A Active CN111078906B (en) 2018-10-18 2018-10-18 Image query and information synchronization method and device

Country Status (1)

Country Link
CN (1) CN111078906B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102331993A (en) * 2011-06-23 2012-01-25 北京新媒传信科技有限公司 Data migration method of distributed database and distributed database migration system
CN102542005A (en) * 2011-12-13 2012-07-04 中国电子科技集团公司第十五研究所 System and method for counting and inquiring data in growth-type database
CN102779132A (en) * 2011-05-12 2012-11-14 阿里巴巴集团控股有限公司 Data updating method, system and database server
CN107590166A (en) * 2016-12-20 2018-01-16 百度在线网络技术(北京)有限公司 A kind of data creation method and device based on inquiry content
CN108205594A (en) * 2018-01-02 2018-06-26 联想(北京)有限公司 A kind of image processing method and electronic equipment
CN108537577A (en) * 2018-03-26 2018-09-14 上海数据交易中心有限公司 Validity querying method and device, storage medium, the server of data

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102779132A (en) * 2011-05-12 2012-11-14 阿里巴巴集团控股有限公司 Data updating method, system and database server
CN102331993A (en) * 2011-06-23 2012-01-25 北京新媒传信科技有限公司 Data migration method of distributed database and distributed database migration system
CN102542005A (en) * 2011-12-13 2012-07-04 中国电子科技集团公司第十五研究所 System and method for counting and inquiring data in growth-type database
CN107590166A (en) * 2016-12-20 2018-01-16 百度在线网络技术(北京)有限公司 A kind of data creation method and device based on inquiry content
CN108205594A (en) * 2018-01-02 2018-06-26 联想(北京)有限公司 A kind of image processing method and electronic equipment
CN108537577A (en) * 2018-03-26 2018-09-14 上海数据交易中心有限公司 Validity querying method and device, storage medium, the server of data

Also Published As

Publication number Publication date
CN111078906A (en) 2020-04-28

Similar Documents

Publication Publication Date Title
JP4457988B2 (en) Image management apparatus, image management method, and computer program
JP6168996B2 (en) Content control method, content control apparatus, and program
CN110941736B (en) Electronic photograph display method and device and mobile equipment
CN111163072B (en) Method and device for determining characteristic value in machine learning model and electronic equipment
CN111345011A (en) APP pushing method and device, electronic equipment and computer readable storage medium
CN106709042B (en) Index updating method and equipment
CN109656797B (en) Log data association method and device
CN111488377A (en) Data query method and device, electronic equipment and storage medium
CN114708304B (en) Cross-camera multi-target tracking method, device, equipment and medium
CN106776348B (en) Test case management method and device
CN111078906B (en) Image query and information synchronization method and device
CN109165305B (en) Characteristic value storage and retrieval method and device
CN111414528B (en) Method and device for determining equipment identification, storage medium and electronic equipment
CN112836124A (en) Image data acquisition method and device, electronic equipment and storage medium
CN113516529A (en) Abnormal order determining method and device, storage medium and electronic equipment
CN111966339A (en) Method and device for recording buried point parameters, computer equipment and storage medium
CN105653540B (en) Method and device for processing file attribute information
CN110688995A (en) Map query processing method, computer-readable storage medium and mobile terminal
CN112035201B (en) Device parameter display method and device, computer device and storage medium
CN115525523A (en) Data processing method and device, electronic equipment and storage medium
CN111428117A (en) Data acquisition method and device for application program
CN114936269A (en) Document searching platform, searching method, device, electronic equipment and storage medium
CN107656967A (en) A kind of scene information processing method and processing device
CN109036523B (en) Method, device, equipment and storage medium for inquiring case ID diagnosis information
CN113596019A (en) High-performance network traffic data representation and extraction method and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant