[go: up one dir, main page]

CN110781326A - Picture retrieval and acquisition method and device and picture storage system - Google Patents

Picture retrieval and acquisition method and device and picture storage system Download PDF

Info

Publication number
CN110781326A
CN110781326A CN201911015329.4A CN201911015329A CN110781326A CN 110781326 A CN110781326 A CN 110781326A CN 201911015329 A CN201911015329 A CN 201911015329A CN 110781326 A CN110781326 A CN 110781326A
Authority
CN
China
Prior art keywords
picture
index
index data
data
server
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.)
Pending
Application number
CN201911015329.4A
Other languages
Chinese (zh)
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.)
Beijing Mach Valley Technology Co Ltd
Hunan Super Cloud Mdt Infotech Ltd
Hunan Provincial Public Security Department
Original Assignee
Beijing Mach Valley Technology Co Ltd
Hunan Super Cloud Mdt Infotech Ltd
Hunan Provincial Public Security Department
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 Beijing Mach Valley Technology Co Ltd, Hunan Super Cloud Mdt Infotech Ltd, Hunan Provincial Public Security Department filed Critical Beijing Mach Valley Technology Co Ltd
Priority to CN201911015329.4A priority Critical patent/CN110781326A/en
Publication of CN110781326A publication Critical patent/CN110781326A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/51Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/53Querying

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a picture retrieval method, a picture acquisition method, a picture retrieval device, a picture acquisition device and a picture storage system, and relates to the technical field of picture access. In the picture retrieval method provided by the embodiment of the invention, when a first request from an external server or an application module is received, index data meeting conditions can be searched in an index data table with a small occupied storage space according to the picture query conditions in the first request, the searched index data are sorted according to the picture sorting rule in the first request, and then the front specified number of index data in the sorted index data are sent to the external server or the application module in sequence, so that the external server or the application module can start sorting and data processing work, and the rest index data are sent in batches according to instructions, thereby preventing the problem of excessive memory occupation, and having high sorting efficiency and good user experience.

Description

Picture retrieval and acquisition method and device and picture storage system
Technical Field
The invention relates to the technical field of picture access, in particular to a picture retrieval and acquisition method, a picture retrieval and acquisition device and a picture storage system.
Background
In the scenes of artificial intelligence and big data analysis, a large number of pictures are often required to be combined and analyzed, and during analysis, all available pictures are required to be sequenced according to a specified rule, for example, the pictures are orderly analyzed and processed according to the sequence of the creation time of the pictures from morning to evening, so that higher requirements are put forward on the acquisition speed and the sequencing efficiency of a picture storage system.
When an existing distributed storage system meets the requirement of ordered analysis of a large number of pictures, a metadata mode is usually adopted, fig. 1 is a block schematic diagram of a picture acquisition method in the prior art, as shown in fig. 1, that is, important data of a picture is combined into one metadata, the metadata is stored in a storage medium where the picture is located together with image data of the picture, the size of the metadata is several hundred bytes or several K, and the important data includes various attributes of the picture, such as: picture creation time, picture length, picture generation position, picture-related remarks, picture writing time, picture storage position, and the like. When the picture server receives an analysis request of the picture analysis server, searching metadata meeting conditions in all metadata of the storage medium, then sending the metadata meeting the conditions to the picture analysis server, sequencing the received metadata according to specified rules by the picture analysis server, and then acquiring image data of pictures corresponding to each metadata from the storage medium in sequence for picture analysis.
In the metadata method, although the metadata data volume is small, when the large data is analyzed, the required pictures are massive, so that the data volume of the metadata received by the picture analysis server is huge, a large amount of memory is occupied, the sorting efficiency is low, the time for waiting to acquire the pictures is too long, and the user experience of subsequent picture analysis is influenced.
Disclosure of Invention
The invention provides a picture retrieval and acquisition method, a picture retrieval and acquisition device and a picture storage system, which are used for overcoming the technical problems in the prior art, so that the picture analysis server is prevented from occupying too much memory, the sequencing efficiency is improved, the picture acquisition time is shortened, and better user experience can be obtained.
The picture retrieval method provided by the invention comprises the following steps: (1) receiving a first request, wherein the first request comprises a picture query condition, a picture sorting rule and an index feedback number; (2) searching index data meeting the picture query condition in an index data table, and designating the index data as target index data; the index data table comprises at least one index datum, and the index datum comprises an attribute to be inquired, an attribute to be sorted and a picture ID of a picture; (3) sequencing and numbering all the target index data according to the picture sequencing rule to form an index queue; (4) sequentially sending the first M index data of the index queue, wherein M is equal to the index feedback number; (5) and sending the rest index data in the index queue in batches according to the instructions.
Further, the step (5) includes: (6) receiving a second request, wherein the second request comprises the number of the supplementary indexes; (7) sequentially sending the first N index data of the rest index data in the index queue, wherein N is less than or equal to the number of the supplementary indexes; (8) and (5) executing the steps (6) to (7) until the number of the index data remained in the index queue is 0.
Further, the step (8) includes: when the N is judged to be less than the number of the supplementary indexes, sending a termination request; and (5) when the N is judged to be equal to the number of the supplementary indexes, executing the steps (6) to (7).
Further, before the step (1), the method further comprises: and generating the index data table on the Solid State Disk (SSD).
The picture acquisition method provided by the invention comprises the following steps: (1) sending first requests to all picture servers in a picture storage system, wherein the first requests comprise picture query conditions, picture sorting rules and index feedback numbers; (2) receiving index data with the number being the index feedback number from each picture server, and designating the index data as a pre-sorting index queue, wherein the index data in the pre-sorting index queue meet the picture query condition, are sorted according to the picture sorting rule and have continuous numbers; (3) sorting the index data in all the pre-sorting index queues according to the picture sorting rule to form a sorting queue; (4) acquiring image data corresponding to continuous index data in the sorting queue; (5) and obtaining the rest index data from the picture server in batches through instructions.
Further, the step (5) includes: (6) sending a second request to a target picture server with a non-empty index queue in the picture server to which the continuous index data belongs, wherein the second request comprises the number of supplementary indexes and is used for requesting the supplementary index data with the number of the supplementary indexes so as to complement the number of the index data used for acquiring the image data in the sorting queue; (7) receiving the supplementary index data from each target picture server, wherein the supplementary index data meet the picture query condition, are sorted according to the picture sorting rule and have a serial number which is continuous with the serial number of the corresponding pre-sorting index queue; (8) supplementing the supplementary index data into the corresponding pre-sorting index queue; (9) and (4) sequentially executing the steps (3), (4), (6), (7) and (8) until all index data of the sorting queue are used for acquiring the image data.
Optionally, between the step (4) and the step (5), further comprising: designating a picture server with an empty index queue in the picture servers to which the continuous index data belongs as an invalid picture server, wherein the picture server with the non-empty index queue is the target picture server; averagely dividing the number of index data used for acquiring image data in a pre-sorting index queue corresponding to the invalid picture server according to the number of the target servers to obtain the number of additional indexes; and summing the number of the index data used for acquiring the image data in the pre-sorting index queue corresponding to the target picture server and the number of the additional indexes to form the number of the additional indexes.
Further, the step (4) includes: searching a picture server to which the continuous index data belongs according to the picture ID contained in the continuous index data, and using the picture server as an image acquisition server; searching a storage position corresponding to the picture ID from the image acquisition server; and acquiring the image data according to the storage position.
Optionally, the step of obtaining the picture further includes: and analyzing the image data according to a specified analysis rule.
Further, before the step (1), the method further comprises: acquiring the number C of all picture servers in the storage system; acquiring local storage capacity D; and calculating the index feedback number E according to a formula, wherein E is D/(k C), and k is the number of bytes of single index data and is a constant.
The invention provides a picture retrieval device, comprising: the instruction receiving module is used for receiving a first request, wherein the first request comprises a picture query condition, a picture sorting rule and an index feedback number; the index searching module is used for searching index data meeting the picture searching condition in an index data table and designating the index data as target index data; the index data table comprises at least one index datum, and the index datum comprises an attribute to be inquired, an attribute to be sorted and a picture ID of a picture; the first sequencing module is used for sequencing and numbering all the target index data according to the picture sequencing rule to form an index queue; the index sending module is used for sending the first M index data of the index queue in sequence, wherein M is equal to the index feedback number; and the index queue is used for sending the rest index data in batches according to instructions in sequence.
Further, the instruction receiving module is further configured to receive a second request, where the second request includes the number of the supplementary indexes; the index sending module is further configured to send the first N index data of the remaining index data in the index queue in sequence, where N is less than or equal to the number of the supplementary indexes; the image retrieval device further comprises a first circulation module, which is used for adopting the methods executed by the instruction receiving module and the index sending module in sequence until the number of the index data left in the index queue is 0.
Further, the above-mentioned picture retrieval apparatus further includes: the first judging module is used for judging whether the N is less than or equal to the number of the supplementary indexes; a termination module for sending a termination request when the N is less than the number of supplemental indices.
Further, the above-mentioned picture retrieval apparatus further includes a solid state disk SSD for storing the index data table.
The picture acquisition device provided by the invention comprises: the system comprises an instruction sending module, an index feedback module and a storage module, wherein the instruction sending module is used for sending first requests to all picture servers in a picture storage system, and the first requests comprise picture query conditions, picture sorting rules and index feedback numbers; the index receiving module is used for receiving index data with the number being the index feedback number from each picture server and appointing the index data as a pre-sorting index queue, wherein the index data in the pre-sorting index queue meet the picture query condition, are sorted according to the picture sorting rule and have continuous numbers; the second sorting module is used for sorting the index data in all the pre-sorting index queues according to the picture sorting rule to form a sorting queue; the data acquisition module is used for acquiring image data corresponding to the continuous index data in the sorting queue; the instruction sending module is further used for sending an instruction, and the index receiving module is further used for obtaining residual index data from the picture server in batches.
Further, the instruction sending module is further configured to send a second request to a target picture server whose index queue is not empty in the picture server to which the continuous index data belongs, where the second request includes a number of supplementary indexes, and is used to request supplementary index data whose number is the number of the supplementary indexes, so as to complement the number of index data used for acquiring image data in the sorting queue; the index receiving module is used for receiving the supplementary index data from each target picture server, and the supplementary index data meet the picture query condition, are sorted according to the picture sorting rule and have a serial number which is continuous with the serial number of the corresponding pre-sorting index queue; the image acquisition device also comprises an index supplementing module used for supplementing the supplementing index data into the corresponding pre-sorting index queue; and the second circulating module is used for sequentially adopting the methods executed by the second sorting module, the data acquisition module, the instruction sending module, the index receiving module and the index supplementing module until all index data of the sorting queue are used for acquiring image data.
Optionally, the image capturing apparatus further includes: the designating module is used for designating a picture server with an empty indexing queue in the picture servers to which the continuous indexing data belongs as an invalid picture server, wherein the picture server with the non-empty indexing queue is the target picture server; the additional index module is used for averagely dividing the number of index data which are used for acquiring image data in a pre-sorting index queue corresponding to the invalid picture server according to the number of the target servers to obtain the number of additional indexes; and the supplementary index module is used for summing the number of the index data which are used for acquiring the image data in the pre-sorting index queue corresponding to the target picture server and the number of the additional indexes to form the supplementary index number.
Further, the data acquisition module comprises: the positioning unit is used for searching a picture server to which the continuous index data belongs according to the picture ID contained in the continuous index data and using the picture server as an image acquisition server; the addressing unit is used for searching the storage position corresponding to the picture ID from the image acquisition server; and the acquisition unit acquires the image data according to the storage position.
Optionally, the image obtaining apparatus further includes an analysis module, configured to analyze the image data according to a specified analysis rule.
Optionally, the above image capturing device further includes: the first acquisition module is used for acquiring the number C of all the picture servers in the storage system; the second acquisition module is used for acquiring the local storage capacity D; and the calculating module is used for calculating the index feedback number E according to a formula, wherein E is D/(k C), and k is the number of bytes of single index data and is a constant.
The invention provides a picture storage system, comprising: the picture retrieval device and the picture acquisition device are provided.
In the picture retrieval, acquisition method, device and picture storage system provided by the invention, the picture retrieval device executes the picture retrieval method, the picture acquisition device executes the picture acquisition method, the picture acquisition device firstly sends a first request to all the picture retrieval devices in the picture retrieval system, wherein the picture retrieval devices comprise a picture query condition, a picture sorting rule and an index feedback number, an index data table is arranged on the picture retrieval device, each index data in the table only comprises the attribute to be queried, the attribute to be sorted and a picture ID of a corresponding picture, the occupied space is small, when the first request from the picture acquisition device is received, the index data meeting the condition can be searched in the index data table according to the picture query condition in the first request, then the searched index data are sorted according to the picture sorting rule in the first request, and then the front specified number of index data in the sorted index data are sent to the picture acquisition device according to the order, the specified amount is included in the first request, the image acquisition device can start processing after the part of the index data is provided for the image acquisition device, the memory pressure of the image acquisition device is low because only one part of the index data is transmitted at one time, and the rest of the index data is transmitted in batches according to the instructions, so that the total amount of data can be controlled, and the problem of excessive memory occupation can be prevented.
In addition, because the picture retrieval device sends the sorted index data, when the part of the index data and the index data from other picture retrieval devices are concentrated and sorted again in the picture acquisition device, the processing program is simple, the sorting efficiency is high, the speed is high, the occupied memory is small, the time for subsequently acquiring the image data is obviously reduced, and therefore better user experience can be obtained.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a block diagram illustrating a method for acquiring a picture according to the prior art;
fig. 2 is a flowchart of a picture retrieval method according to an embodiment of the present invention;
fig. 3 is a flowchart of a picture obtaining method according to an embodiment of the present invention;
FIG. 4 is a data flow diagram of instructions associated with the methods of FIGS. 2 and 3;
FIG. 5 is a flowchart of another image retrieval method according to an embodiment of the present invention;
fig. 6 is a flowchart of another image obtaining method according to an embodiment of the present invention;
FIG. 7 is a data flow diagram of instructions associated with the methods of FIGS. 5 and 6;
fig. 8 is a block diagram of an image retrieving device according to an embodiment of the present invention;
fig. 9 is a block diagram of a picture taking apparatus according to an embodiment of the present invention;
fig. 10 is a block diagram of a picture storage system according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In order to make the technical solution of the present invention clearer, embodiments of the present invention are described in detail below with reference to the accompanying drawings.
Fig. 2 is a flowchart of an image retrieval method according to an embodiment of the present invention, and as shown in fig. 2, the image retrieval method includes the following steps.
Step 201, receiving a first request, where the first request includes a picture query condition, a picture sorting rule, and an index feedback number.
Specifically, the execution subject of the picture retrieval method is a picture server in a distributed picture storage system, which is used for accessing pictures, and a picture stored on the picture server generally comprises various attributes of the picture and image data of the picture. Attributes typically include: picture ID, picture creation time, picture length, picture generation position, picture-related remark description, picture writing time, picture storage position, and the like.
In the picture retrieval method, when an external server or an application module acquires a picture in a picture server, a first request is sent to the picture server, wherein the request comprises a picture query condition, a picture sorting rule and an index feedback number. The picture query condition is a condition that the picture to be obtained should satisfy, for example, the range of the picture creation time, and the obtained picture belongs to the time range. The picture ordering rule is how the pictures to be obtained are ordered, for example, the order of the picture creation time from morning to evening. The index feedback number is the number of index data which needs to be sent to an external server or an application module.
Step 202, index data meeting the picture query condition is searched in an index data table and designated as target index data, the index data table comprises at least one index data, and the index data comprises an attribute to be queried, an attribute to be ordered and a picture ID of a picture.
Specifically, the picture server is pre-formed with an index data table, where the index data table includes at least one index data, and each picture corresponds to one index data. The attribute to be inquired is used for judging whether the image inquiry condition is met or not, the attribute to be sorted is used for sorting, and the image ID is a number capable of uniquely identifying the image and used for searching the storage position of the image.
According to the picture query condition, index data with the attribute to be queried matched with the condition is searched in the picture server index data table and designated as target index data.
And step 203, sequencing and numbering all target index data according to the picture sequencing rule to form an index queue.
Specifically, all the searched target index data are sorted according to the picture sorting rule, that is, the attributes to be sorted of the target index data are sorted according to the picture sorting rule, so that the index data are sorted according to the picture sorting rule and numbered in sequence, for example, the number of the first index data is 0, the number of the second index data is 1, and the number of the third index data is 2, … ….
And step 204, sequentially sending the first M index data of the index queue, wherein M is equal to the index feedback number.
Specifically, the index data with the number from front to back as the index feedback number in sequence is used as the first batch of index data and sent to the external server or the application module. For example, if the index feedback number is 3, three index data with the numbers of 0-2 are sent.
And 205, sending the rest index data in the index queue in batches according to the order.
Specifically, the picture server may send the remaining index data in batches, i.e., multiple times, according to the received instruction, and send a part of the index data each time.
In the picture retrieval method provided by the embodiment of the invention, the execution main body is a picture server, an index data table is arranged on the picture server, each index data in the table only comprises the attribute to be inquired, the attribute to be sequenced and a picture ID of a corresponding picture, the occupied space is small, when a first request from an external server or an application module is received, the index data meeting the condition can be searched in the index data table according to the picture query condition in the first request, the searched index data are sequenced according to the picture sequencing rule in the first request, then the index data with the front appointed number in the sequenced index data are sent to the external server or the application module in sequence, the appointed number is included in the first request, and the external server or the application module can start processing after the part of index data is provided to the external server or the application module, because only a part of data is sent to the external server or the application module at a time, the memory pressure of the external server or the application module is small, and the rest index data is sent in batches according to the instruction, the total data amount can be controlled, and the problem of excessive memory occupation is solved.
In addition, since the sorted index data is sent, when the part of index data and the index data from other picture servers are concentrated and sorted again in an external server or an application module, the processing program is simple, the sorting efficiency is high, the speed is high, the occupied memory is small, the time for subsequently acquiring the image data is obviously reduced, and therefore better user experience can be obtained.
Fig. 3 is a flowchart of a picture obtaining method according to an embodiment of the present invention, and fig. 4 is a command data flow diagram of the method shown in fig. 2 and fig. 3, which is combined with the embodiments shown in fig. 2 to fig. 4 and described above. The picture acquisition method comprises the following steps.
Step 301, sending a first request to all picture servers in the picture storage system, where the first request includes a picture query condition, a picture sorting rule, and an index feedback number.
Specifically, the execution subject of the method may be the above-mentioned external server, such as a picture analysis server and a picture acquisition server, or may be an application module in the server for acquiring pictures. Taking the execution subject as an image analysis server as an example, the image analysis server and a plurality of image servers form an image storage system, the image server is used for storing attributes and image data of images, and the image analysis server is used for acquiring a plurality of image data from the image server and analyzing the image data.
When the picture analysis server acquires the image data in the picture server, a first request is sent to all the picture servers in the picture storage system, wherein the request comprises picture query conditions, picture sorting rules and index feedback numbers. The picture query condition is the condition which the picture to be acquired should meet; the picture ordering rule is how the pictures to be taken are ordered. The index feedback number is the number of index data required to be returned by the picture server.
Step 302, receiving index data with the number of index feedback numbers from each picture server, and designating the index data as a pre-sorting index queue, wherein the index data in the pre-sorting index queue meet the picture query condition, are sorted according to the picture sorting rule, and have continuous numbers.
Specifically, according to the descriptions of the above-mentioned steps 202 to 204 of the picture retrieval method, after receiving the first request, the picture server searches the index data table for index data meeting the picture query condition, designates the index data as target index data, sorts and numbers all the target index data according to the picture sorting rule, and finally sends the first M index data of the index queue in sequence, where M is equal to the index feedback number. Therefore, the picture analysis server can receive index data of the index feedback number from each picture server, wherein the index data meet the picture query condition, are sorted according to the picture sorting rule and have continuous numbers.
And 303, sorting the index data in all the pre-sorting index queues according to the picture sorting rule to form a sorting queue.
Specifically, the picture storage system includes a plurality of picture servers, receives one pre-sorting index queue from each picture server, and sorts index data of all received pre-sorting index queues to form a sorting queue.
And step 304, acquiring image data corresponding to the continuous index data in the sorting queue.
Specifically, after all the pre-sorting index queues are sorted, the first a index data in the sorting queue must be continuous, and this "continuous" refers to the continuity of the attributes to be sorted. For example, there are three picture servers in the picture storage system, the index data in each picture server is sorted from morning to evening according to the generation time, the attribute to be sorted in the index data is the generation time t, and t1, t2, t3, … … are consecutive generation times. Assuming that 12 pictures are provided in total for the first picture server meeting the query condition, the generation time of the sorted index data in the first picture server is as follows: t1, t6, t7, t 8; the generation time of the sorted index data in the second picture server is as follows in sequence: t2, t4, t9, t 10; the generation time of the sorted index data in the third picture server is as follows in sequence: t3, t5, t11 and t 12. After receiving the first request, each picture server sends the first 3 index data to the picture analysis server.
Therefore, the picture analysis server can receive three pre-ordered index queues, and 3 index data received from the first picture server are designated as a first pre-ordered index queue L1, 3 index data received from the second picture server are designated as a second pre-ordered index queue L2, and 3 index data received from the third picture server are designated as a third pre-ordered index queue L3, all of which are ordered from early to late in terms of the generation time. The generation time t of the index data included in the first pre-sorting index queue L1 is, in order: t1, t6, t 7; the generation time t of the index data included in the second pre-sorting index queue L2 is, in order: t2, t4, t 9; the generation time t of the index data included in the third pre-sorting index queue L3 is, in order: t3, t5, t 11.
The generation time of the index data in the sorting queue is as follows: t1(L1), t2(L2), t3(L3), t4(L2), t5(L3), t6(L1), and t7 (L1). For clarity, the content in brackets shows from which pre-ordered index queue the index data came, that is, from which picture server. It can be seen that the generation time of the continuous index data ranges from t1 to t7, there are a total of 7 continuous index data, and the generation time of the last index data in the first pre-sorted index queue L1 is t7, which is the earliest of the generation times (t7, t9, t11) of the last index data in the three pre-sorted index queues. That is, the first a index data in the sorting queue are consecutive, and the value of a is related to the top attribute to be sorted among the attributes to be sorted of the last index data in each pre-sorting index queue.
Each index data in the continuous index data contains a picture ID capable of addressing the image data in the picture server, so that the image data corresponding to the continuous index data can be acquired from the picture server for subsequent image processing or picture analysis.
Step 305, obtaining the residual index data from the picture server in batches through instructions.
Specifically, the picture server sends the first batch of index data according to the first request and then remains the rest of index data, and the picture analysis server can send the rest of index data in batches according to the order through the instruction according to the requirement, so that the picture analysis server can receive the sorted index data in batches.
In the picture acquiring method provided by the embodiment of the invention, the execution main body is a picture acquiring server, a picture analyzing server or a picture acquiring module in an external server, taking the picture analyzing server as an example, first requests are sent to all picture servers in a picture storage system, wherein the first requests comprise picture query conditions, picture sorting rules and index feedback numbers, the first requests are used for requesting index data with the number of the index feedback numbers to each picture server, and then the index data are respectively received from each picture server.
Moreover, the index data received by the picture analysis server from each picture server not only meets the picture query condition, but also meets the sorting rule and has continuous serial numbers, so that when the index data of each picture server is mixed and sorted subsequently, the processing procedure is simple, the sorting efficiency is high, and the waiting time for acquiring the image data from partial continuous index data can be greatly shortened, thereby improving the user experience.
The picture acquisition method provided by the embodiment of the invention can sort, cache and decompose the total pictures into a plurality of picture servers, thereby greatly lightening the burden of the picture analysis server and reducing the performance requirement of the server to the minimum.
Fig. 5 is a flowchart of another image retrieval method according to an embodiment of the present invention, and as shown in fig. 5, the image retrieval method includes the following steps.
Step 501, receiving a first request, where the first request includes a picture query condition, a picture sorting rule, and an index feedback number.
Specifically, the execution subject of the picture retrieval method is a picture server in the distributed picture storage system. In the picture retrieval method, when an external server or an application module acquires a picture in a picture server, a first request is sent to the picture server, wherein the request comprises a picture query condition, a picture sorting rule and an index feedback number. The picture query condition is a condition that the picture to be obtained should satisfy, for example, the range of the picture creation time, and the obtained picture belongs to the time range. The picture ordering rule is how the pictures to be obtained are ordered, for example, the order of the picture creation time from morning to evening. The index feedback number is the number of index data which needs to be sent to an external server or an application module.
Step 502, index data meeting the picture query condition is searched in an index data table and designated as target index data, the index data table comprises at least one index data, and the index data comprises an attribute to be queried, an attribute to be ordered and a picture ID of a picture.
Specifically, the picture server is pre-formed with an index data table, where the index data table includes at least one index data, and each picture corresponds to one index data. The attribute to be inquired is used for judging whether the image inquiry condition is met or not, the attribute to be sorted is used for judging the sorting position, and the image ID is a number capable of uniquely identifying the image and is used for searching the storage position of the image.
According to the picture query condition, index data with the attribute to be queried matched with the condition is searched in the picture server index data table and designated as target index data.
And 503, sequencing and numbering all the target index data according to the picture sequencing rule to form an index queue.
Specifically, all the searched target index data are sorted according to the picture sorting rule, that is, the attributes to be sorted of the target index data are sorted according to the picture sorting rule, so that the index data are arranged according to the picture sorting rule and numbered according to the sequence.
And step 504, sending the first M index data of the index queue in sequence, wherein M is equal to the index feedback number.
Specifically, the index data with the number from front to back as the index feedback number in sequence is used as the first batch of index data and sent to the external server or the application module.
Step 505, receiving a second request, wherein the second request comprises the number of the supplementary indexes.
After the first batch of index data is sent, the picture server continues to send the rest index data in batches according to the instructions. The instruction is a second request from an external server or an application module, and the request includes the number requirement of the index data to be sent, namely the number of the supplementary indexes.
And step 506, sequentially sending the first N index data of the rest index data in the index queue, wherein N is less than or equal to the number of the supplementary indexes.
Specifically, the index data needs to be sent in sequence, for example, if the number of the remaining index data is 5 to 20, and the number of the supplementary indexes is 3, the numbers of the index data needing to be sent are 5, 6, and 7 in sequence. In this way, the index data received by the external server or application module can be concatenated with the previously received index data for further sorting. When the number of the remaining index data in the index queue is less than the number of the supplementary indexes, the number N of the sent index data is less than the number of the supplementary indexes.
And 507, judging whether the N is less than or equal to the number of the supplementary indexes, executing the step 508 when the N is less than the number of the supplementary indexes, and executing the steps (505) to (506) when the N is equal to the number of the supplementary indexes.
Specifically, when N is less than the number of supplemental indexes, it is described that all index data in the index queue satisfying the query condition are sent after the N index data are sent, and when N is equal to the number of supplemental indexes, there may be remaining index data in the index queue, and it is determined that it is necessary to wait for the next batch of index data to be sent.
Step 508, send termination request.
Specifically, when N is less than the number of supplementary indexes, the picture server may send a termination request to the external server or the application module, notifying the external server or the application module that there is no available index data.
In the picture retrieval method provided by the embodiment of the invention, the execution main body is a picture server, an index data table is arranged on the picture server, each index data in the table only comprises the attribute to be inquired, the attribute to be sequenced and a picture ID of a corresponding picture, the occupied space is small, when a first request from an external server or an application module is received, the index data meeting the condition can be searched in the index data table according to the picture query condition in the first request, the searched index data are sequenced according to the picture sequencing rule in the first request, then the index data with the front appointed number are sent to the external server or the application module in sequence in the sequenced index data, the appointed number is included in the first request, and the external server or the application module can start processing after the part of index data is provided to the external server or the application module, because only a part of data is sent at one time, the memory pressure of the external server or the application module is low, and the rest index data is sent in batches according to the instructions, the total data amount can be controlled, and the problem of excessive memory occupation is solved.
Because the sorted index data is sent, when the part of index data and the index data from other picture servers are concentrated and sorted again in the external server or the application module, the processing program is simple, the sorting efficiency is high, the speed is high, the occupied memory is small, the time for subsequently acquiring the image data is obviously reduced, and better user experience can be obtained.
In addition, the instruction for sending the remaining index data in batches can be a second request from the external server or the application module, wherein the second request comprises the number of the supplementary indexes, the instruction is used for continuously sending the remaining index data to the external server or the application module according to the sequence and the requirement of the number of the supplementary indexes, and a part of index data is sent every time the second request is received.
In the above embodiment, before step 501, the method may further include: and generating the index data table on the Solid State Disk (SSD).
In the prior art, data of a picture server is stored in a storage medium, which is usually a Hard Disk Drive (HDD), and is a mechanical Hard Disk. When searching for metadata meeting the condition in all metadata of the HDD, the metadata is used as a single file, and although the data size is small, the number of pictures is large, the searching process needs to repeatedly read a large number of small files, which causes a large I/O overhead and low efficiency.
To solve this problem, the present embodiment may separately provide a solid State drive (ssd) for storing the index data table in the picture server independently from the HDD, as shown in fig. 4. Because the magnetic head of the HDD is not used in the reading and writing process of the solid state disk SSD, compared with the HDD, the reading and writing speed is much higher, so that even if the index data amount in the index data table is large, the problems of large I/O overhead and low efficiency do not exist when the index data is read because the acquisition processing of metadata is directly skipped.
Fig. 6 is a flowchart of another image obtaining method according to an embodiment of the present invention, fig. 7 is a data flow diagram of instructions associated with the methods shown in fig. 5 and 6, and the image obtaining method is described with reference to fig. 5 to 7 and the above embodiments, where the image obtaining method includes the following steps.
Step 601, sending a first request to all picture servers in the picture storage system, wherein the first request comprises picture query conditions, picture sorting rules and index feedback numbers.
Specifically, the execution subject of the method may be the above-mentioned external server, such as a picture analysis server and a picture acquisition server, or may be an application module in the server for acquiring pictures. Taking the execution subject as an image analysis server as an example, the image analysis server and a plurality of image servers form an image storage system, the image server is used for storing attributes and image data of images, and the image analysis server is used for acquiring a plurality of image data from the image server and analyzing the image data.
When the picture analysis server acquires the image data in the picture server, a first request is sent to all the picture servers in the picture storage system, wherein the request comprises picture query conditions, picture sorting rules and index feedback numbers. The picture query condition is the condition which the picture to be acquired should meet; the picture ordering rule is how the pictures to be taken are ordered. The index feedback number is the number of index data required to be returned by the picture server.
Fig. 7 shows an example of the cooperation of the picture retrieval method and the picture acquisition method, and in practical application, the picture servers are not limited to the three shown in the figure, and the number of the index data and the number of the image data interacted with each picture server are not limited to the number shown in the figure.
As shown in fig. 7, assume that the picture storage system includes 3 picture servers: the number of index feedbacks is 50 for the first picture server S1, the second picture server S2, and the third picture server S3, and the picture query condition is the picture creation time in the designated time range. The picture ordering rule is the order of picture creation time from morning to evening. In fig. 7, the inside of the picture analysis server may be divided into a picture obtaining component and a picture analysis module, the picture analysis module is dedicated to processing and analyzing image data, both the picture query condition and the picture sorting rule in the first request may be sent to the picture obtaining component by the picture analysis module, and the rest of the picture obtaining method provided in this embodiment is mainly executed by the picture obtaining component.
Step 602, receiving index data with the number of index feedback from each picture server, and designating the index data as a pre-sorting index queue, wherein the index data in the pre-sorting index queue meets the picture query condition, is sorted according to the picture sorting rule, and has continuous numbers.
Specifically, according to the descriptions of steps 502 to 504 of the above-mentioned picture retrieval method, after receiving the first request, the picture server searches the index data table for index data meeting the picture query condition, designates the index data as target index data, sorts and numbers the attributes to be sorted of all the target index data according to the sorting rule of the picture creation time from morning to evening, and finally sends the first 50 index data of the index queue in sequence. As shown in fig. 7, the first index data number of the index queue in each picture server is 0, the second index data number is 1, and so on, in order to distinguish the index data of each picture server, different background colors are used for representation, the white background is the index data of the first picture server S1, the light gray background is the index data of the second picture server S2, and the dark gray background color is the index data of the third picture server S3.
And 603, sorting the index data in all the pre-sorting index queues according to the picture sorting rule to form a sorting queue.
Specifically, as shown in fig. 7, in the sorting process, 50 index data (numbered from 0 to 49) of the first picture server S1, 21 index data (numbered from 0 to 20) of the second picture server S2, and 8 index data (numbered from 0 to 7) of the third picture server S3 form continuous index data, and the rest of the data are non-continuous index data, and further sorting needs to wait for receiving the rest of the index data.
And step 604, acquiring image data corresponding to the continuous index data in the sorting queue.
Specifically, each index data in the continuous index data includes a picture ID that can address image data in the picture server, so that the image data corresponding to the continuous index data can be acquired from the picture server for image processing or picture analysis. The picture analysis module in fig. 7 is dedicated to the processing or analysis of image data. Therefore, the index data can be acquired and sequenced and the image data can be acquired while image processing or picture analysis is performed, so that the user does not need to wait for too long time for acquiring the data before image processing or analysis operation, and the user experience is further improved.
As shown in fig. 7, 50 of the consecutive index data come from the first picture server S1, and therefore, 50 image data corresponding to these index data (numbered from 0 to 49) are acquired from the first picture server S1; 21 of the consecutive index data are from the second picture server S2, and therefore, 21 image data corresponding to these index data (numbered from 0 to 20) are acquired from the second picture server S2; there are 8 of the consecutive index data from the third picture server S3, and therefore, 8 image data corresponding to these index data (numbered from 0 to 7) are acquired from the third picture server S3.
Step 605, determining whether a picture server with an empty index queue exists in the picture servers to which the continuous index data belongs, if so, executing step 606, and if not, executing step 609.
Specifically, according to the above description of step 507 and step 508 in the embodiment of the picture retrieval method, when the picture server sends index data to the picture analysis server according to the instruction, if the number of sent index data is less than the number of supplementary indexes, it indicates that the picture server has no remaining index data that satisfies the query condition, and the picture analysis server is notified by sending a termination request. The picture analysis server may determine whether the index queue on the corresponding picture server is empty according to whether the termination request is received, that is, the index queue has no remaining index data.
Step 606, designating the picture server with the index queue being empty in the picture servers to which the continuous index data belongs as an invalid picture server, and designating the picture server with the index queue being non-empty as the target picture server.
Specifically, when a picture server with an empty index queue exists in the picture servers to which the continuous index data belongs, it is indicated that no index data remains in the index queue on the picture server.
Step 607, the number of index data used for acquiring image data in the pre-sorting index queue corresponding to the invalid picture server is divided equally according to the number of the target servers, and the number of additional indexes is acquired.
Specifically, for example, the picture servers to which the consecutive index data belong are a first picture server S1, a second picture server S2, and a third picture server S3, wherein, if the second picture server S2 has no index data left, the designation as an invalid picture server, and the index data, which is referred to as being sorted and becomes a component of the continuous index data in the pre-sorting index queue from the second picture server S2, has been used for acquiring the image data, and thus belongs to the used data, these used data would otherwise have to be complemented by the remaining index data of the index queue on the second picture server S2, but since the second picture server S2 already has no remaining index data, the number of index data that should be acquired from the second picture server S2 is equally distributed to each target picture server (the first picture server S1 and the third picture server S3) according to the principle of load balancing of the respective picture servers.
For example, when there are 6 index data in the consecutive index data, the pre-sorted index queue from the second picture server S2, the 6 index data being used for obtaining the image data and belonging to the used data, since the second picture server S2 belongs to the invalid picture server, the task of supplementing the 6 index data is distributed to the first picture server S1 and the third picture server S3, each picture server is divided into 3, and the number of 3 is designated as the number of additional indexes.
Step 608, summing the number of index data already used for acquiring image data in the pre-sorting index queue corresponding to the target picture server and the number of additional indexes to form the number of additional indexes.
Specifically, the number of index data re-requested from the picture server with the non-empty index queue includes not only the number of index data participating in sorting in the pre-sorting index queue of the picture server in the continuous index data, but also the number of additional indexes, so as to ensure that the re-requested index data can complement the number of index data used for acquiring the image data.
With the example of step 607, if the number of index data in the first picture server S1 pre-sort index queue in the consecutive index data is 2, the number of index data requested again to the first picture server S1 is 2 plus the number of additional indexes (3), for a total of 5. This number 5 is the number of supplemental indices in the request to the first picture server S1.
Step 609, sending a second request to a target picture server with a non-empty index queue in the picture server to which the continuous index data belongs, wherein the second request comprises the number of supplementary indexes, and is used for requesting the supplementary index data with the number of the supplementary indexes so as to complement the number of the index data used for acquiring the image data in the sorting queue.
Step 610, receiving supplementary index data from each target picture server, the supplementary index data satisfying the picture query condition, being sorted according to the picture sorting rule and having a number consecutive to the corresponding pre-sorting index queue number.
Specifically, as shown in fig. 7, since 50 consecutive index data are from the first picture server S1, the number of supplementary indexes in the second request sent to the first picture server S1 is 50, and since the index data with the numbers 0 to 49 in the first picture server S1 have been sent to the picture analysis server to form a pre-ordered index queue, the number of the re-requested supplementary index data is 50 to 99, which is consecutive to the number of the corresponding pre-ordered index queue.
Since 21 consecutive index data are from the second picture server S2, the number of supplementary indexes in the second request sent to the second picture server S2 is 21, and since the index data with the numbers 0 to 49 in the second picture server S2 have been sent to the picture analysis server to form a pre-ordered index queue, the number of the supplementary index data requested again is 50 to 70, which is consecutive to the number of the corresponding pre-ordered index queue.
Since 8 of the consecutive index data are from the third picture server S3, the number of the supplementary index in the second request sent to the third picture server S3 is 8, and since the index data with the numbers 0 to 49 in the third picture server S3 have been sent to the picture analysis server to form the pre-ordered index queue, the number of the supplementary index data requested again is 50 to 57, which is consecutive to the number of the corresponding pre-ordered index queue.
Step 611, the supplementary index data is added to the corresponding pre-sorted index queue.
Specifically, a new pre-ordered index queue is thus formed.
And 612, judging whether all index data of the sorting queue are continuous, if not, executing the step 603, and if so, ending the step.
Specifically, as shown in fig. 7, the double-headed wide arrow between the picture taking apparatus and the third picture server S3 represents the instruction data interaction between the picture analysis server and each picture server when steps 603 to 612 are subsequently executed; the double-headed wide arrow between the picture analysis module and the picture taking component indicates the instruction data interaction between the picture analysis module and the picture taking component when the steps 603 to 612 are subsequently executed.
In the picture acquiring method provided by the embodiment of the invention, the execution main body is a picture acquiring server, a picture analyzing server or a picture acquiring module in an external server, taking the picture analyzing server as an example, first requests are sent to all picture servers in a picture storage system, wherein the first requests comprise picture query conditions, picture sorting rules and index feedback numbers, the first requests are used for requesting index data with the number of the index feedback numbers to each picture server, and then the index data are respectively received from each picture server.
Moreover, the index data received by the picture analysis server from each picture server not only meets the picture query condition, but also meets the sorting rule and has continuous serial numbers, so that when the index data of each picture server is mixed and sorted in the subsequent process, the processing procedure is simple, the sorting efficiency is high, the waiting time for the operation of acquiring the image data from the local continuous index data can be greatly shortened, and the user experience is improved.
In addition, according to the number of the index data of each picture server used in the continuous index data for acquiring the image data, the picture analysis server issues a second request, wherein the number of the supplementary indexes is used for requesting the supplementary index data with the number of the supplementary indexes from the corresponding picture server so as to complement the number of the index data for acquiring the image data. Due to the adoption of the principle of 'using amount and supplementing amount', the memory occupation amount on the image analysis server cannot be increased, and the problem of excessive memory occupation is further effectively prevented.
The picture acquisition method provided by the embodiment of the invention can sort, cache and decompose the total pictures into a plurality of picture servers, thereby greatly lightening the burden of the picture analysis server and reducing the performance requirement of the server to the minimum.
In the method for obtaining an image provided in the foregoing embodiment, step 604 may include: searching a picture server to which the continuous index data belongs according to the picture ID contained in the continuous index data, and using the picture server as an image acquisition server; searching a storage position corresponding to the picture ID from the image acquisition server; and acquiring the image data according to the storage position.
By the method, the image data of the required picture can be acquired.
The image obtaining method provided by the above embodiment may further include: the image data is analyzed according to a specified analysis rule. As shown in fig. 7, in the picture analysis server, through the interaction between the picture analysis module and the picture taking component (a single-direction thin arrow and a double-direction wide arrow), the image data obtained by the picture taking component can be handed to the picture analysis module for analysis of a specified analysis rule, such as big data analysis or artificial intelligence data analysis.
According to the description of the embodiment, the image acquisition component acquires image data from the image server in batches, the acquired image data is sent to the image analysis module for analysis, and meanwhile, the image acquisition component continues the next image data acquisition operation, so that the pipeline work is realized, the working efficiency is high, and compared with the existing metadata one-time sorting, the method and the device have the advantages that the one-time sorting work is decomposed into multiple combined sorting processing, the image analysis module can quickly take the image for image analysis, and the response speed is high.
In the above embodiment, before step 601, the method may further include: acquiring the number C of all picture servers in a storage system; acquiring local storage capacity D; and calculating the index feedback number E according to a formula, wherein E is D/(k C), and k is the number of bytes of single index data and is a constant.
And K is usually 12 bytes and can contain the attribute to be inquired, the attribute to be sorted and the image ID. The method is used for calculating the index feedback number, and the local storage capacity D of the image analysis server and the total number of the image servers in the storage system are mainly considered during calculation, so that the total amount of the local index data to be sequenced is controlled, and the phenomenon that the memory is excessively occupied is avoided. Therefore, the picture analysis server can obtain different numbers of pictures each time according to the local resource condition, so that the resource occupancy rate is reduced, and the server with weaker processing performance can also run.
Fig. 8 is a block diagram of an image retrieving apparatus according to an embodiment of the present invention, as shown in fig. 8, the image retrieving apparatus includes: the instruction receiving module 81 is configured to receive a first request, where the first request includes a picture query condition, a picture sorting rule, and an index feedback number; an index searching module 82, configured to search, in the index data table, index data that meets the picture query condition, and designate the index data as target index data; the index data table comprises at least one index datum, and the index datum comprises an attribute to be inquired, an attribute to be sorted and a picture ID of one picture; the first sequencing module 83 is configured to sequence and number all target index data according to a picture sequencing rule to form an index queue; an index sending module 84, configured to send the first M index data of the index queue in sequence, where M is equal to the index feedback number; and the index data in the index queue is sent in batches according to the order.
The methods executed by the modules have been described in detail in the embodiments of the image retrieval method, and are not described herein again.
The picture retrieval device provided by the embodiment of the invention is a component of a picture server, an index data table is arranged on the picture retrieval device, each index data in the table only comprises an attribute to be inquired, an attribute to be sorted and a picture ID of a corresponding picture, the occupied space is small, when an instruction receiving module 81 receives a first request from an external server or an application module, an index searching module 82 can search index data meeting the condition in the index data table according to the picture inquiry condition in the first request, a first sorting module 83 sorts the searched index data according to the picture sorting rule in the first request, then an index sending module 84 sends the index data with the front appointed number in the sorted index data to the external server or the application module in sequence, the appointed number is contained in the first request, and after the part of index data is provided for the external server, the external server or the application module can start to process, the internal memory pressure of the external server or the application module is low because only part of data is sent to the external server or the application module at one time, and the rest index data is sent in batches according to instructions, so that the total data amount can be controlled, and the problem of excessive internal memory occupation is solved.
In addition, since the index sending module 84 sends the sorted index data, when the index data and the index data from other picture servers are concentrated and sorted again in the external server or the application module, the processing procedure is simple, the sorting efficiency is high, the speed is high, the occupied memory is small, the time for subsequently obtaining the image data is significantly reduced, and thus better user experience can be obtained.
In the above-mentioned picture retrieval apparatus, the instruction receiving module 81 may be further configured to receive a second request, where the second request includes the number of supplementary indexes; the index sending module 84 may be further configured to send the first N index data of the remaining index data in the index queue in sequence, where N is less than or equal to the number of the supplementary indexes, and the image retrieval apparatus may further include a first loop module, which is configured to sequentially use the methods executed by the instruction receiving module and the index sending module described above until the number of the remaining index data in the index queue is 0.
The above-described picture retrieval apparatus may further include: the first judging module is used for judging whether the N is less than or equal to the number of the supplementary indexes; and the termination module is used for sending a termination request when the N is less than the number of the supplementary indexes.
The methods executed by the modules have been described in detail in the embodiments of the image retrieval method, and are not described herein again.
The instruction for sending the remaining index data in batches can be a second request from the external server or the application module, wherein the second request includes the number of the supplementary indexes, the instruction is used for the index sending module 84 to continue sending the remaining index data to the external server or the application module according to the requirements of the sequence and the number of the supplementary indexes, and a part of index data is sent every time the second request is received.
The above-mentioned picture retrieval apparatus may further include a solid state disk SSD for storing the index data table. By independently arranging a Solid State Drive (SSD) outside the HDD in the picture server for storing the index data table, the Solid State Drive (SSD) does not use a magnetic head of the HDD in the read-write process, and the read-write speed is much higher than that of the HDD, so that the index data in the index data table has large volume, and the problems of large I/O overhead and low efficiency do not exist during reading.
Fig. 9 is a block diagram of a picture capturing apparatus according to an embodiment of the present invention, as shown in fig. 9, the picture capturing apparatus includes: the instruction sending module 91 is configured to send a first request to all the picture servers in the picture storage system, where the first request includes a picture query condition, a picture ordering rule, and an index feedback number; an index receiving module 92, configured to receive, from each picture server, index data of which the number is an index feedback number, and designate the index data as a pre-ordering index queue, where the index data in the pre-ordering index queue satisfies a picture query condition, is ordered according to a picture ordering rule, and has consecutive numbers; the second sorting module 93 is configured to sort the index data in all pre-sorting index queues according to the picture sorting rule to form a sorting queue; a data obtaining module 94, configured to obtain image data corresponding to the continuous index data in the sorting queue; the instruction sending module 91 is further configured to send an instruction, and the index receiving module 92 is further configured to obtain the remaining index data from the picture server in batches.
The method executed by each module has been described in detail in the embodiment of the image obtaining method, and is not described herein again.
The picture acquiring device provided by the embodiment of the invention can be a picture analysis server, the instruction sending module 91 sends first requests to all picture servers in the picture storage system, wherein the first requests comprise picture query conditions, picture sorting rules and index feedback numbers and are used for requesting index data with the index feedback numbers to each picture server, and then the index receiving module 92 receives the index data from each picture server respectively.
Moreover, the index data received by the index receiving module 92 of the picture analysis server from each picture server not only satisfies the picture query condition, but also conforms to the sorting rule and has continuous numbers, so that when the subsequent second sorting module 93 performs mixed sorting on the index data of each picture server, the processing procedure is simple, the sorting efficiency is high, and then the waiting time for the data acquisition module 94 to acquire the image data from part of the continuous index data can be greatly shortened, thereby improving the user experience.
In the image obtaining apparatus provided in the foregoing embodiment, the instruction sending module 91 may further be configured to send a second request to a target image server whose index queue is not empty in the image server to which the consecutive index data belongs, where the second request includes the number of supplementary indexes, and is used to request the supplementary index data whose number is the number of supplementary indexes, so as to complement the number of index data that has been used for obtaining the image data in the sorting queue; the index receiving module 92 may be configured to receive supplemental index data from each target picture server, the supplemental index data satisfying the picture query condition and being ordered according to the picture ordering rule and having a number consecutive to the corresponding pre-ordered index queue number; the image acquisition device also comprises an index supplementing module used for supplementing the supplementing index data into the corresponding pre-sorting index queue; and the second circulating module is used for sequentially adopting the methods executed by the second sorting module, the data acquisition module, the instruction sending module, the index receiving module and the index supplementing module until all index data of the sorting queue are used for acquiring the image data.
The image capturing device may further include: the designating module is used for designating a picture server with an empty indexing queue in the picture servers to which the continuous indexing data belongs as an invalid picture server, and the picture server with the non-empty indexing queue is a target picture server; the additional index module is used for averagely dividing the number of index data which are used for acquiring the image data in the pre-sorting index queue corresponding to the invalid picture server into a plurality of additional indexes according to the number of the target servers; and the supplementary index module is used for summing the number of the index data which are used for acquiring the image data in the pre-sorting index queue corresponding to the target picture server and the number of the additional indexes to form the number of the supplementary indexes.
The method executed by each module has been described in detail in the embodiment of the image obtaining method, and is not described herein again.
As can be seen from the foregoing description of the embodiment, according to the number of the index data of each picture server used in the continuous index data for acquiring image data, the instruction sending module 91 in the picture analysis server issues a second request, which includes the number of the supplementary indexes, to request the supplementary index data, the number of which is the number of the supplementary indexes, from the corresponding picture server, so as to complement the number of the index data for acquiring image data. Due to the adoption of the principle of 'using amount and supplementing amount', the memory occupation amount on the image analysis server cannot be increased, and the problem of excessive memory occupation is further effectively prevented.
In the above embodiment, the data obtaining module 94 may include: the positioning unit is used for searching a picture server to which the continuous index data belongs according to the picture ID contained in the continuous index data and using the picture server as an image acquisition server; the addressing unit is used for searching a storage position corresponding to the picture ID from the image acquisition server; and an acquisition unit that acquires the image data according to the storage position. Image data of a desired picture can be acquired by the data acquisition module 94.
The above-mentioned picture acquiring apparatus may further include an analysis module, i.e. the picture analysis module shown in fig. 7, for analyzing the image data according to a specified analysis rule. The specified analysis rules may include big data analysis or artificial intelligence data analysis.
In addition, the above-mentioned picture taking apparatus may further include: the first acquisition module is used for acquiring the number C of all the picture servers in the storage system; the second acquisition module is used for acquiring the local storage capacity D; and the calculating module is used for calculating the index feedback number E according to a formula, wherein E is D/(k C), and k is the number of bytes of single index data and is a constant. The index feedback number is calculated and obtained by considering the local storage capacity D of the picture analysis server and the total number of the picture servers in the storage system, so that the total amount of the local index data to be sequenced is conveniently controlled, and the phenomenon that the memory is excessively occupied is avoided.
The methods executed by the modules are already described in detail in the embodiment of the image obtaining method, and are not described herein again.
Fig. 10 is a block diagram of a picture storage system according to an embodiment of the present invention, and as shown in fig. 10, the picture storage system includes: the picture retrieval apparatus 1001 described in the above embodiment and the picture taking apparatus 1002 described in the above embodiment. Fig. 7 also shows the picture storage system, where the picture server in fig. 7 corresponds to a picture retrieval device, the picture analysis server corresponds to a picture acquisition device, a picture analysis module in the picture analysis server implements functions of processing and analyzing acquired image data in the picture acquisition device, and a picture acquisition component in the picture analysis server implements functions of sending instructions, receiving index data in batches, and acquiring image data in batches. Specifically, the number of the picture retrieval devices 1001 and the picture taking devices is not limited to those shown in fig. 10 and 7.
The picture storage system provided by the embodiment of the invention comprises a picture acquisition device and a picture retrieval device, wherein the picture acquisition device sends a first request to all the picture retrieval devices, the picture retrieval devices comprise a picture query condition, a picture sorting rule and an index feedback number, an index data table is arranged on the picture retrieval devices, each index data in the table only comprises an attribute to be queried, an attribute to be sorted and a picture ID of a corresponding picture, the occupied space is small, when a first request from the picture acquisition device is received, index data meeting the condition can be searched in the index data table according to the picture query condition in the first request, the searched index data are sorted according to the picture sorting rule in the first request, then the index data with the front appointed number in the sorted index data are sent to the picture acquisition device according to the order, and the appointed number is contained in the first request, after the part of index data is provided for the picture acquisition device, the picture acquisition device can start processing, the memory pressure of the picture acquisition device is low because only a part of data is sent at one time, and the rest of index data is sent in batches according to instructions, so that the total data amount can be controlled, and the problem of excessive memory occupation is solved.
In addition, because the picture retrieval device sends the sorted index data, when the part of the index data and the index data from other picture retrieval devices are concentrated and sorted again in the picture acquisition device, the processing program is simple, the sorting efficiency is high, the speed is high, the occupied memory is small, the time for subsequently acquiring the image data is obviously reduced, and therefore better user experience can be obtained.
The picture storage system provided by the embodiment of the invention can sort, cache and decompose the full pictures into a plurality of picture servers, thereby greatly lightening the burden of the picture analysis server and reducing the performance requirement of the server to the minimum.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (21)

1. An image retrieval method, comprising:
(1) receiving a first request, wherein the first request comprises a picture query condition, a picture sorting rule and an index feedback number;
(2) searching index data meeting the picture query condition in an index data table, and designating the index data as target index data; the index data table comprises at least one index datum, and the index datum comprises an attribute to be inquired, an attribute to be sorted and a picture ID of a picture;
(3) sequencing and numbering all the target index data according to the picture sequencing rule to form an index queue;
(4) sequentially sending the first M index data of the index queue, wherein M is equal to the index feedback number;
(5) and sending the rest index data in the index queue in batches according to the instructions.
2. The method of claim 1, wherein step (5) comprises:
(6) receiving a second request, wherein the second request comprises the number of the supplementary indexes;
(7) sequentially sending the first N index data of the rest index data in the index queue, wherein N is less than or equal to the number of the supplementary indexes;
(8) and (5) executing the steps (6) to (7) until the number of the index data remained in the index queue is 0.
3. The method according to claim 2, wherein the step (8) comprises:
when the N is judged to be less than the number of the supplementary indexes, sending a termination request;
and (5) when the N is judged to be equal to the number of the supplementary indexes, executing the steps (6) to (7).
4. The method according to any one of claims 1 to 3, further comprising, before the step (1): and generating the index data table on the Solid State Disk (SSD).
5. A picture acquisition method, comprising:
(1) sending first requests to all picture servers in a picture storage system, wherein the first requests comprise picture query conditions, picture sorting rules and index feedback numbers;
(2) receiving index data with the number being the index feedback number from each picture server, and designating the index data as a pre-sorting index queue, wherein the index data in the pre-sorting index queue meet the picture query condition, are sorted according to the picture sorting rule and have continuous numbers;
(3) sorting the index data in all the pre-sorting index queues according to the picture sorting rule to form a sorting queue;
(4) acquiring image data corresponding to continuous index data in the sorting queue;
(5) and obtaining the rest index data from the picture server in batches through instructions.
6. The method of claim 5, wherein the step (5) comprises:
(6) sending a second request to a target picture server with a non-empty index queue in the picture server to which the continuous index data belongs, wherein the second request comprises the number of supplementary indexes and is used for requesting the supplementary index data with the number of the supplementary indexes so as to complement the number of the index data used for acquiring the image data in the sorting queue;
(7) receiving the supplementary index data from each target picture server, wherein the supplementary index data meet the picture query condition, are sorted according to the picture sorting rule and have a serial number which is continuous with the serial number of the corresponding pre-sorting index queue;
(8) supplementing the supplementary index data into the corresponding pre-sorting index queue;
(9) and (4) sequentially executing the steps (3), (4), (6), (7) and (8) until all index data of the sorting queue are used for acquiring the image data.
7. The method of claim 5 or 6, further comprising, between step (4) and step (5):
designating a picture server with an empty index queue in the picture servers to which the continuous index data belongs as an invalid picture server, wherein the picture server with the non-empty index queue is the target picture server;
averagely dividing the number of index data used for acquiring image data in a pre-sorting index queue corresponding to the invalid picture server according to the number of the target servers to obtain the number of additional indexes;
and summing the number of the index data used for acquiring the image data in the pre-sorting index queue corresponding to the target picture server and the number of the additional indexes to form the number of the additional indexes.
8. The method of claim 7, wherein the step (4) comprises:
searching a picture server to which the continuous index data belongs according to the picture ID contained in the continuous index data, and using the picture server as an image acquisition server;
searching a storage position corresponding to the picture ID from the image acquisition server;
and acquiring the image data according to the storage position.
9. The method of claim 8, further comprising: and analyzing the image data according to a specified analysis rule.
10. The method of claim 7, further comprising, prior to step (1):
acquiring the number C of all picture servers in the storage system;
acquiring local storage capacity D;
and calculating the index feedback number E according to a formula, wherein E is D/(k C), and k is the number of bytes of single index data and is a constant.
11. An image retrieval apparatus, comprising:
the instruction receiving module is used for receiving a first request, wherein the first request comprises a picture query condition, a picture sorting rule and an index feedback number;
the index searching module is used for searching index data meeting the picture searching condition in an index data table and designating the index data as target index data; the index data table comprises at least one index datum, and the index datum comprises an attribute to be inquired, an attribute to be sorted and a picture ID of a picture;
the first sequencing module is used for sequencing and numbering all the target index data according to the picture sequencing rule to form an index queue;
the index sending module is used for sending the first M index data of the index queue in sequence, wherein M is equal to the index feedback number; and the index queue is used for sending the rest index data in batches according to instructions in sequence.
12. The apparatus according to claim 11, wherein the instruction receiving module is further configured to receive a second request, the second request including a number of supplementary indexes; the index sending module is further configured to send the first N index data of the remaining index data in the index queue in sequence, where N is less than or equal to the number of the supplementary indexes;
the image retrieval device further comprises a first circulation module, which is used for adopting the methods executed by the instruction receiving module and the index sending module in sequence until the number of the index data left in the index queue is 0.
13. The picture retrieval device according to claim 12, further comprising:
the first judging module is used for judging whether the N is less than or equal to the number of the supplementary indexes;
and the termination module is used for sending a termination request when the N is less than the number of the supplementary indexes.
14. The picture retrieval device according to any one of claims 11 to 13, further comprising a Solid State Disk (SSD) for storing an index data table.
15. A picture taking apparatus, comprising:
the system comprises an instruction sending module, an index feedback module and a storage module, wherein the instruction sending module is used for sending first requests to all picture servers in a picture storage system, and the first requests comprise picture query conditions, picture sorting rules and index feedback numbers;
the index receiving module is used for receiving index data with the number being the index feedback number from each picture server and appointing the index data as a pre-sorting index queue, wherein the index data in the pre-sorting index queue meet the picture query condition, are sorted according to the picture sorting rule and have continuous numbers;
the second sorting module is used for sorting the index data in all the pre-sorting index queues according to the picture sorting rule to form a sorting queue;
the data acquisition module is used for acquiring image data corresponding to the continuous index data in the sorting queue;
the instruction sending module is further used for sending an instruction, and the index receiving module is further used for obtaining residual index data from the picture server in batches.
16. The apparatus according to claim 15, wherein the instruction sending module is further configured to send a second request to a target picture server in which an index queue in the picture servers to which the consecutive index data belongs is not empty, where the second request includes a number of supplementary indexes, and is used to request supplementary index data whose number is the number of supplementary indexes, so as to complement the number of index data that have been used for acquiring image data in the sorting queue; the index receiving module is used for receiving the supplementary index data from each target picture server, and the supplementary index data meet the picture query condition, are sorted according to the picture sorting rule and have a serial number which is continuous with the serial number of the corresponding pre-sorting index queue;
the image acquisition device also comprises an index supplementing module used for supplementing the supplementing index data into the corresponding pre-sorting index queue;
and the second circulating module is used for sequentially adopting the methods executed by the second sorting module, the data acquisition module, the instruction sending module, the index receiving module and the index supplementing module until all index data of the sorting queue are used for acquiring image data.
17. The picture taking apparatus according to claim 15 or 16, further comprising:
the designating module is used for designating a picture server with an empty indexing queue in the picture servers to which the continuous indexing data belongs as an invalid picture server, wherein the picture server with the non-empty indexing queue is the target picture server;
the additional index module is used for averagely dividing the number of index data which are used for acquiring image data in a pre-sorting index queue corresponding to the invalid picture server according to the number of the target servers to obtain the number of additional indexes;
and the supplementary index module is used for summing the number of the index data which are used for acquiring the image data in the pre-sorting index queue corresponding to the target picture server and the number of the additional indexes to form the supplementary index number.
18. The image capturing device as claimed in claim 17, wherein the data capturing module comprises:
the positioning unit is used for searching a picture server to which the continuous index data belongs according to the picture ID contained in the continuous index data and using the picture server as an image acquisition server;
the addressing unit is used for searching the storage position corresponding to the picture ID from the image acquisition server;
and the acquisition unit acquires the image data according to the storage position.
19. The image capturing device according to claim 18, further comprising an analysis module configured to analyze the image data according to a specified analysis rule.
20. The image capturing device according to claim 17, further comprising:
the first acquisition module is used for acquiring the number C of all the picture servers in the storage system;
the second acquisition module is used for acquiring the local storage capacity D;
and the calculating module is used for calculating the index feedback number E according to a formula, wherein E is D/(k C), and k is the number of bytes of single index data and is a constant.
21. A picture storage system, comprising: the picture retrieval apparatus according to any one of claims 11 to 14 and the picture taking apparatus according to any one of claims 15 to 20.
CN201911015329.4A 2019-10-25 2019-10-25 Picture retrieval and acquisition method and device and picture storage system Pending CN110781326A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911015329.4A CN110781326A (en) 2019-10-25 2019-10-25 Picture retrieval and acquisition method and device and picture storage system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911015329.4A CN110781326A (en) 2019-10-25 2019-10-25 Picture retrieval and acquisition method and device and picture storage system

Publications (1)

Publication Number Publication Date
CN110781326A true CN110781326A (en) 2020-02-11

Family

ID=69387359

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911015329.4A Pending CN110781326A (en) 2019-10-25 2019-10-25 Picture retrieval and acquisition method and device and picture storage system

Country Status (1)

Country Link
CN (1) CN110781326A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100293167A1 (en) * 2007-06-18 2010-11-18 Daniele Biasci Biological database index and query searching
CN103092848A (en) * 2011-10-28 2013-05-08 浙江大华技术股份有限公司 Method for storing and retrieving pictures
CN103853797A (en) * 2012-12-07 2014-06-11 中兴通讯股份有限公司 Image retrieval method and system based on n-gram image indexing structure
CN104321766A (en) * 2012-12-31 2015-01-28 华为技术有限公司 Data processing method and device
CN105760395A (en) * 2014-12-18 2016-07-13 华为技术有限公司 Data processing method, device and system
CN110222209A (en) * 2019-06-14 2019-09-10 北京马赫谷科技有限公司 Picture storage method, querying method, device and access system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100293167A1 (en) * 2007-06-18 2010-11-18 Daniele Biasci Biological database index and query searching
CN103092848A (en) * 2011-10-28 2013-05-08 浙江大华技术股份有限公司 Method for storing and retrieving pictures
CN103853797A (en) * 2012-12-07 2014-06-11 中兴通讯股份有限公司 Image retrieval method and system based on n-gram image indexing structure
CN104321766A (en) * 2012-12-31 2015-01-28 华为技术有限公司 Data processing method and device
CN105760395A (en) * 2014-12-18 2016-07-13 华为技术有限公司 Data processing method, device and system
CN110222209A (en) * 2019-06-14 2019-09-10 北京马赫谷科技有限公司 Picture storage method, querying method, device and access system

Similar Documents

Publication Publication Date Title
US10826980B2 (en) Command process load balancing system
US8954985B2 (en) Dependency management in task scheduling
CA2840523C (en) Method and system for processing images
JP2002519748A (en) Image retrieval system
CN109766318B (en) File reading method and device
US8190857B2 (en) Deleting a shared resource node after reserving its identifier in delete pending queue until deletion condition is met to allow continued access for currently accessing processor
CN111143587B (en) Data retrieval method and device and electronic equipment
US20110179013A1 (en) Search Log Online Analytic Processing
CN117234732A (en) Shared resource allocation method, device, equipment and medium
CN116166690A (en) A Hybrid Vector Retrieval Method and Device for High Concurrency Scenarios
CN110781326A (en) Picture retrieval and acquisition method and device and picture storage system
CN114077690A (en) Vector data processing method, device, equipment and storage medium
CN114168084B (en) File merging method, file merging device, electronic equipment and storage medium
KR101744017B1 (en) Method and apparatus for indexing data for real time search
CN113835613B (en) File reading method and device, electronic equipment and storage medium
WO2023124135A1 (en) Feature retrieval method and apparatus, electronic device, computer storage medium and program
CN109241098B (en) Query optimization method for distributed database
CN112860641A (en) Small file storage method and device based on HADOOP
CN113742346A (en) Asset big data platform architecture optimization method
KR102668905B1 (en) Method for migration of workspace and apparatus for performing the method
KR102680768B1 (en) Method for converting non-structured data to binary data and an apparatus for performing the method
CN112559789A (en) Face searching method, device, equipment and computer readable storage medium
KR102675553B1 (en) Method for backup workspace and apparatus for performing the method
CN113392252B (en) Data processing method and device
KR102636753B1 (en) Method for migration of workspace and apparatus for performing the method

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20200211

RJ01 Rejection of invention patent application after publication