Data storage method and data query method
By extracting the feature vectors of unstructured data in the database system and storing it in association with the directory address, the complexity and user cost problems of processing and querying unstructured data in the prior art are solved, and unified storage and query of structured and unstructured data is realized, which improves the efficiency and simplicity of data processing.
Patent Information
- Application Number
- CN201910139006.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-02-25
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2039-02-25
AI Technical Summary
The prior art is difficult to effectively process and query unstructured data, especially in database systems, where users need external services to convert images into vectors, increasing user costs and processing complexity.
Through a data storage method, the data to be stored is determined whether it belongs to a predetermined data type. If it belongs, its feature vector is extracted and stored in association with the directory address, supporting the storage and query of structured and unstructured data.
It realizes unified storage and query of structured and unstructured data, reduces user understanding and use costs, supports semantic queries, and improves the efficiency and simplicity of data processing.
Smart Images

Figure CN111611418B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a data storage method and a data query method. Background Art
[0002] Traditional query languages (such as SQL) used in database management systems are all aimed at structured data to achieve data access, query, update and management. However, traditional semantic retrieval methods are generally based on the data itself and do not understand the meaning behind the data.
[0003] With the rapid development of artificial intelligence, unstructured data such as audio, video, images, and text are increasingly being used. For these unstructured data, their semantics can only be known through recognition. Therefore, when processing this type of data, it is often necessary to obtain the meaning behind it.
[0004] Some existing database systems support the storage and retrieval of vectors. Thus, when users use the database to query unstructured data, such as images, they need to call a special service outside the database to convert the image into a vector, and then store the vector in the database. When querying / retrieval later, users also use vectors for retrieval. This processing method is complicated on the one hand, and has too high requirements on the user on the other hand. Users need to convert images into vectors, and vectors have no intuitive meaning for users, which increases user costs.
[0005] In view of this, a data management method that can support both structured data and unstructured data is needed to achieve data storage, query / retrieval, etc. Summary of the invention
[0006] To this end, the present invention provides a data storage method and a data query method, in an effort to solve or at least alleviate at least one of the above problems.
[0007] According to one aspect of the present invention, there is provided a data storage method, comprising the steps of: determining whether the data to be stored belongs to a predetermined data type; if the data belongs to the predetermined data type, storing the data in a first storage area and obtaining a directory address of the data; extracting a feature vector of the data; and associating the feature vector of the data with the directory address and storing it in a second storage area.
[0008] Optionally, the data storage method according to the present invention further comprises the step of: if it is determined after judgment that the data to be stored does not belong to a predetermined data type, storing the data in a second storage area.
[0009] Optionally, in the data storage method according to the present invention, the step of extracting the feature vector of the data includes: inputting the directory address of the data into a feature extraction model to output the feature vector of the data.
[0010] Optionally, the data storage method according to the present invention further comprises the step of obtaining description information of the data and storing it in association with the directory address of the data, wherein the description information comprises at least a feature extraction model for extracting feature vectors and a measurement method for calculating feature similarity.
[0011] Optionally, in the data storage method according to the present invention, the step of extracting the feature vector of the data also includes: extracting the feature vector corresponding to the data based on the description information and directory address of the data, more specifically, obtaining a feature extraction model corresponding to the data for extracting the feature vector based on the description information of the data; and inputting the directory address into the feature extraction model to output the feature vector corresponding to the data.
[0012] Optionally, in the data storage method according to the present invention, the predetermined data type includes one or more of the following data types: text, picture, XML, HTML, image, audio, video.
[0013] According to another aspect of the present invention, there is provided a data storage device, comprising: a judgment unit, adapted to judge whether the data to be stored belongs to a predetermined data type; a first storage unit, adapted to store the data and generate a directory address of the data when the data belongs to the predetermined data type; a feature extraction unit, adapted to extract a feature vector of the data; and a second storage unit, adapted to associate the feature vector of the stored data with the directory address.
[0014] Optionally, the data storage device according to the present invention further comprises: a metadata storage unit adapted to obtain description information of the data when the data to be stored belongs to a predetermined data type, and store the information in association with the directory address of the data.
[0015] According to another aspect of the present invention, a data query method is provided, comprising the steps of: generating at least one feature vector to be queried; determining at least one feature vector similar to the feature vector to be queried; acquiring at least one directory address associated with the determined at least one feature vector; and determining at least one data pointed to by the acquired at least one directory address as target data.
[0016] According to another aspect of the present invention, a data query method is provided, comprising the steps of: obtaining at least one feature vector to be queried; determining at least one feature vector similar to the feature vector to be queried; obtaining at least one directory address associated with the determined at least one feature vector; and determining at least one data pointed to by the obtained at least one directory address as target data.
[0017] According to another aspect of the present invention, a data query device is provided, comprising: a judgment unit, adapted to judge whether a predetermined data type is contained in the query information; a feature calculation unit, adapted to generate at least one feature vector to be queried based on the query information, and further adapted to determine at least one feature vector similar to the feature vector to be queried; a first query unit, adapted to obtain at least one directory address associated with the determined at least one feature vector from a second storage area; and a second query unit, adapted to determine at least one data pointed to by the obtained at least one directory address from the first storage area as target data.
[0018] According to yet another aspect of the present invention, there is provided a data management system, comprising: the data storage device as described above and the data query device as described above.
[0019] According to another aspect of the present invention, there is provided a computing device comprising: at least one processor; and a memory storing program instructions, wherein the program instructions are configured to be suitable for execution by the at least one processor, and the program instructions include instructions for executing the data storage method and the data query method as described above.
[0020] According to another aspect of the present invention, a readable storage medium storing program instructions is provided. When the program instructions are read and executed by a computing device, the computing device executes the data storage method and data query method as described above.
[0021] According to the solution of the present invention, structured data and unstructured data are stored separately, such as storing unstructured data in a first storage area and storing structured data in a second storage area; and a feature vector of unstructured data is generated through a built-in feature extraction service, and it is associated with the storage address (i.e., directory address) of the unstructured data and stored in the second storage area. In this way, the storage of various unstructured data can be directly supported. At the same time, based on this data storage method, in addition to supporting queries for structured data, semantic-based queries for various unstructured data can also be supported. In addition, users do not need to have an in-depth understanding of the relevant deep learning algorithms and feature extraction models, which can effectively reduce the user's understanding and usage costs.
[0022] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] To achieve the above and related purposes, certain illustrative aspects are described herein in conjunction with the following description and accompanying drawings, which indicate various ways in which the principles disclosed herein can be practiced, and all aspects and their equivalents are intended to fall within the scope of the claimed subject matter. The above and other purposes, features and advantages of the present disclosure will become more apparent by reading the following detailed description in conjunction with the accompanying drawings. Throughout the present disclosure, the same reference numerals generally refer to the same parts or elements.
[0024] Figure 1 A schematic diagram of an environment of a data management system 100 according to an embodiment of the present invention is shown;
[0025] Figure 2 A schematic diagram of a data management system 100 according to an embodiment of the present invention is shown;
[0026] Figure 3 A schematic diagram of a computing device 300 according to one embodiment of the present invention is shown;
[0027] Figure 4 A flowchart showing a data storage method 400 according to an embodiment of the present invention; and
[0028] Figure 5 A flow chart of a data query method 500 according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0029] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0030] Figure 1 FIG. 1 shows an environment diagram of a data management system 100 according to an embodiment of the present invention. Figure 1 As shown, the data management system 100 is connected to the client 200 for communication. Figure 1Only three clients 200 are shown, but it should be understood that in practice, there are quite a large number of clients 200, and the clients 200 have various forms, including but not limited to mobile terminals, personal computers, personal digital assistants, etc. The present invention is not limited to the type of the client 200, as long as the user can use the client 200 to send a request to store data and / or a request to query data to the data management system 100, and receive the result returned by the system 100 and display it in the client 200.
[0031] For example, the client 200 may be a computing device, which sends a data storage request to the system 100 through an application installed on the computing device, and stores the structured data and / or unstructured data in a corresponding location in the system 100. At the same time, the system 100 may use the stored data to provide query / retrieval services for the client 200. For another example, the client 200 may be a mobile terminal, which sends a data query request to the system 100 through an application installed on the mobile terminal, and displays the query results on the interface of the mobile terminal.
[0032] Figure 2 FIG. 1 is a schematic diagram of a data management system 100 according to an embodiment of the present invention. Figure 2 As shown, the data management system 100 according to an embodiment of the present invention includes a data storage device 110 and a data query device 120. According to an embodiment of the present invention, the data storage device 110 is mainly used to store data. In an embodiment of the present invention, the stored data can be structured data or unstructured data such as text, pictures, XML, HTML, images, audio, and video. When a user initiates an operation request to store data, in response to the user's operation to store data, the data is stored in a corresponding storage area according to the data type of the data to be stored. According to an embodiment, if the data to be stored belongs to unstructured data (such as text, pictures, XML, HTML, images, audio, and video), the data is stored in a first storage area; if the data to be stored belongs to structured data, the data is stored in a second storage area. At the same time, the feature vector of the data stored in the first storage area is extracted, and the feature vector is associated with the directory address of the data (that is, the location of the data in the first storage area) and stored in the second storage area.
[0033] The data query device 120 is mainly used for users to query / retrieve data. In an embodiment of the present invention, the user performs a query by inputting query information, and the query information may include multiple query conditions. When the user initiates a request to query / retrieve data, in response to the user operation, the query information input by the user is obtained, and it is determined whether the query information contains a predetermined data type. If it contains a predetermined data type, a feature vector to be queried is generated according to the query information. Of course, the query information input by the user may also contain a feature vector to be queried. In this way, when the data query device 120 determines that the query information contains a predetermined data type, it directly obtains the feature vector to be queried. Alternatively, the data query device 120 can obtain the feature vector corresponding to the query information from the outside. The embodiment of the present invention does not impose too many restrictions on this. Then, at least one feature vector is matched to the feature vector to be queried from the feature vectors stored in the second storage area, and the directory address associated with it is obtained, and then the relevant data is taken out from the first storage area according to the address pointed to by the directory address, which is the query result.
[0034] Figure 2 A schematic diagram of a data storage device 110 and a data query device 120 according to an embodiment of the present invention is further shown.
[0035] like Figure 2 The data storage device 110 includes: a judgment unit 111, a first storage unit 113, a feature extraction unit 115, a second storage unit 117 and a metadata storage unit 119. The second storage unit 117 has the same structure as a traditional database and is used to store structured data; and for unstructured data, it is stored in the first storage unit 113. The feature extraction unit 115 is used to extract feature vectors of unstructured data as an abstraction of unstructured data for use in query.
[0036] When the user inputs data to be stored, the judgment unit 111 first judges whether the data to be stored belongs to a predetermined data type. According to an embodiment of the present invention, the predetermined data type is an unstructured data type, including one or more of the following data types: text, picture, XML, HTML, image, audio, video, various reports, etc.
[0037] According to an embodiment of the present invention, when the data to be stored is confirmed to belong to a predetermined data type after the judgment unit 111 judges, the first storage unit 113 stores the data, and uses the storage location of the data in the first storage unit 113 as the directory address of the data for storage. Assuming that the data to be stored is a picture, it is stored in the first storage unit 113 and a directory address is generated, for example, / home / ex / 000001.jpg. Then, the feature extraction unit 115 extracts the feature vector of the data based on the directory address. It is then handed over to the second storage unit 117, which associates and stores the feature vector of the data with the directory address. In an embodiment of the present invention, at least one feature extraction model is pre-stored in the feature extraction unit 115. When extracting the feature vector, in one embodiment, the feature extraction unit 115 inputs the directory address of the data into the feature extraction model, and the output is the feature vector of the data; in another embodiment, the feature extraction unit 115 can also input the data itself into the feature extraction model, and use the output feature vector as the feature vector of the data. It should be noted that the embodiment of the present invention does not impose too many restrictions on the method of extracting the feature vector of the data. Those skilled in the art can select an appropriate feature extraction method according to the actual application scenario to implement the data storage solution according to the present invention. Since the feature vector of the data is generated by using the directory address of the data, the amount of calculation during feature extraction can be effectively reduced. The following takes the example of inputting the directory address of the data into the feature extraction model to obtain the feature vector as an example for explanation. In an embodiment of the present invention, if the data to be stored belongs to a predetermined data type, the data to be stored, in addition to the data itself, also carries relevant description information of the data. The description information is, for example: a feature extraction model that specifies the feature vector of the data and a measurement method for calculating the feature similarity of the data. According to an embodiment, the feature extraction model can adopt various neural network models (such as CNN, Resnet, etc., but not limited thereto), and the feature similarity measurement method can adopt Euclidean distance, Consine similarity, etc., but not limited thereto. When the data to be stored belongs to a predetermined data type, the metadata storage unit 119 will obtain the description information of the data, and associate the description information and directory address of the data for storage. In this way, the feature extraction unit 115 can extract the feature vector corresponding to the data based on the description information and directory address of the data. Specifically, the feature vector of the data is extracted by calling the feature extraction model specified in the description information. Optionally, the feature extraction unit 115 extracts a corresponding embedding feature vector as an abstraction of the data according to a feature extraction model specified in the description information of the data.
[0038] In addition, since at least one feature extraction model is pre-stored in the feature extraction unit 115, the embodiment according to the present invention also includes a process of pre-training and generating these feature extraction models. A process of training and generating a feature extraction model is given below, but it is only used as an example, and the embodiment of the present invention is not limited thereto.
[0039] First, construct a pre-trained feature extraction model and set the initial model parameters. After that, input the training samples (e.g., collect multiple images as training samples) into the pre-trained feature extraction model, and fine-tune the model parameters according to the output results to generate a new feature extraction model. Repeat the above steps until the output of the feature extraction model meets the predetermined conditions (it can be the loss value between the calculated model output and the target output. When the loss value reaches a certain condition, it is confirmed that the predetermined conditions are met; it can also be confirmed that the predetermined conditions are met after a certain number of iterative trainings), and the training ends. The feature extraction model generated at this time is used as the trained feature extraction model and is stored in the feature extraction unit 115.
[0040] In some embodiments according to the present invention, each time data is stored in the first storage unit 113, the feature extraction unit 115 synchronously extracts the feature vector of the data, and stores it in the second storage unit 117 in association with the directory address. However, this method increases the time for storing data each time. Therefore, in some other embodiments according to the present invention, the feature vector of the data is extracted in an asynchronous manner, that is, the data to be stored is first stored in the first storage unit 113, and the corresponding directory address is obtained, and then the feature extraction of the newly stored data in the first storage unit 113 is performed regularly (assuming that it is during the idle period of each day, such as 1:00-5:00 in the morning every day, but not limited to this), and the feature vector corresponding to each data is generated, and then the feature vector is associated with the directory address and stored in the second storage unit 117.
[0041] According to another embodiment of the present invention, when the determination unit 111 determines that the data to be stored does not belong to the predetermined data type, the second storage unit 117 directly stores the data. In other words, if the data to be stored is structured data, it is directly stored in the second storage unit 117.
[0042] Continue as Figure 2 The data query device 120 includes: a judgment unit 121, a feature calculation unit 123, a first query unit 125 and a second query unit 127.
[0043] When the user inputs query information to conduct a query, the judgment unit 121 judges whether the query information contains a predetermined data type. According to an embodiment, the query information may contain at least one query condition. For example, the query information is: to search for images "whose similarity with image A is greater than 0.8 and whose evaluation of the image is 'nice skirt'", then, it contains two query conditions, namely: the similarity with image A is greater than 0.8 and the evaluation of the image is 'nice skirt'. At the same time, it can also be confirmed that the target data to be queried in the query information is an image, which belongs to the predetermined data type.
[0044] According to an embodiment of the present invention, if the judgment unit 121 determines that the query information does not contain a predetermined data type, the target data that meets the query conditions is queried from the above-mentioned second storage unit 117 according to a traditional data query method; if the judgment unit 121 determines that the query information contains a predetermined data type, the target data that meets the query conditions is queried by executing the following process.
[0045] That is, according to the embodiment of the present invention, the user can input multiple query conditions, which can be traditional queries based on structured data or queries based on unstructured data, and the judgment unit 121 determines which method to use for data query after judging each query condition. For example, the user can upload an image, input a voice, and input a text at the same time on the application interface, in order to finally obtain the target data that meets each query condition.
[0046] The feature calculation unit 123 generates at least one feature vector to be queried based on the query information. According to an embodiment of the present invention, two methods can be used to generate the feature vector to be queried. The first method is the same as the method of extracting the feature vector by the data storage device 110 described above. In response to the query information, each unstructured data contained in the query information is cached separately to obtain the corresponding directory address as the directory address to be queried; then, based on these directory addresses to be queried, the respective feature vectors to be queried are generated. Optionally, the directory address to be queried is input into the feature extraction model, and the corresponding feature vector to be queried is output. Taking the example of the query information in the previous text as an example, the image A and the text "nice skirt" are cached separately to obtain the corresponding directory address to be stored, recorded as URL1 and URL2, and then URL1 and URL2 are respectively input into the feature extraction model to obtain the corresponding feature vectors to be queried. The second method is to directly input the unstructured data contained in the query information into the feature extraction model and output the corresponding feature vector to be queried. Taking the query information in the previous text as an example, image A is input into the feature extraction model, and its corresponding feature vector to be queried is output; the text "nice skirt" is input into the feature extraction model, and its corresponding feature vector to be queried is output. Of course, as mentioned above, the feature calculation unit 123 can also directly obtain at least one feature vector to be queried. For example, the query information contains the feature vector of the information to be queried.
[0047] It should be noted that the feature extraction model can be specified by the user when inputting the query information, or it can be pre-configured in the data query device 120 (for example, for image data, a CNN model is used; for text data, a ResNet model is used, etc.), and the same fixed feature extraction model can also be used to generate all feature vectors to be queried. In addition, the feature calculation unit 123 can call the relevant feature extraction model in the feature extraction unit 115 to perform the step of extracting feature vectors, and the embodiments of the present invention do not impose too many restrictions on this. For more information about the feature extraction model, please refer to the relevant description above.
[0048] The feature calculation unit 123 further determines at least one feature vector that is similar to the feature vector to be queried. According to one embodiment, for each feature vector to be queried, the feature calculation unit 123 determines at least one feature vector that is similar to the feature vector to be queried from the second storage area according to a specified measurement method for calculating feature similarity. In an embodiment of the present invention, the second storage area is a storage area corresponding to the second storage unit 117, in which feature vectors of unstructured data and their directory addresses are associated and stored. As described above, the metadata storage unit 119 stores the directory address and description information of the data in an associated manner, and the description information also specifies a measurement method for calculating feature similarity. Therefore, the feature calculation unit 123 can calculate the similarity between the feature vector to be queried and the feature vector of the data based on the measurement method for calculating feature similarity corresponding to each data stored in the second storage area, and determine at least one feature vector whose similarity meets the query condition.
[0049] Then, the first query unit 125 obtains at least one directory address associated with the determined at least one feature vector from the second storage area. According to an embodiment of the present invention, the first query unit 125 maintains communication with the second storage unit 117 to obtain the directory address associated with the feature vector from the second storage unit 117 for storing structured data.
[0050] Next, the second query unit 127 determines at least one data pointed to by the obtained at least one directory address from the first storage area as the target data. According to an embodiment of the present invention, the second query unit 127 maintains communication with the first storage unit 115 to obtain corresponding data from the first storage unit 115 for storing unstructured data according to the directory address.
[0051] It should be noted that Figure 2 It is only exemplary. In actual applications, the judgment unit 111 and the judgment unit 121 can be configured as the same unit to determine whether there is data belonging to a predetermined data type in the received information. The feature extraction unit 113 and the feature calculation unit 123 can be configured as the same unit to extract the feature vector of the data and calculate the similarity between the feature vectors. The first query unit 125 can also be implemented as a module in the second storage unit 117. Similarly, the second query unit 127 can also be implemented as a module in the first storage unit 115 to obtain corresponding data from the second storage area and the first storage area, respectively. At the same time, in other embodiments, there may be fewer, additional or different components in the system 100.
[0052] According to the data management system 100 of the present invention, unstructured data is stored in a first storage area, structured data is stored in a second storage area, and a feature vector of the unstructured data is generated through a built-in feature extraction service, which is associated with the storage address (i.e., directory address) of the unstructured data and stored in the second storage area. In this way, the data management system 100 can directly support the storage of various unstructured data. At the same time, based on this data storage method, in addition to supporting queries for structured data, the system 100 can also support semantic-based queries for various unstructured data. In addition, users do not need to have an in-depth understanding of the relevant deep learning algorithms and feature extraction models, which can effectively reduce the user's understanding and usage costs.
[0053] According to an embodiment of the present invention, the data management system 100 may be implemented by one or more computing devices 300 as described below. In some embodiments, the data management system 100 and its components, such as the data storage device 110 and the data query device 120, may be implemented by the computing device 300 as described below.
[0054] Figure 3 A schematic diagram of a computing device 300 according to one embodiment of the present invention is shown.
[0055] like Figure 3 As shown, in a basic configuration 302, computing device 300 typically includes a system memory 306 and one or more processors 304. A memory bus 308 may be used for communication between processor 304 and system memory 306.
[0056] Depending on the desired configuration, the processor 304 can be any type of processor, including but not limited to: a microprocessor (μP), a microcontroller (μC), a digital information processor (DSP), or any combination thereof. The processor 304 can include one or more levels of cache such as a first-level cache 310 and a second-level cache 312, a processor core 314, and registers 316. An example processor core 314 can include an arithmetic logic unit (ALU), a floating point unit (FPU), a digital signal processing core (DSP core), or any combination thereof. An example memory controller 318 can be used with the processor 304, or in some implementations, the memory controller 318 can be an internal part of the processor 304.
[0057] Depending on the desired configuration, system memory 306 may be any type of memory, including but not limited to: volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. System memory 306 may include an operating system 320, one or more applications 322, and program data 324. In some implementations, application 322 may be arranged to execute instructions on the operating system by one or more processors 304 using program data 324.
[0058] The computing device 300 may also include an interface bus 340 that facilitates communication from various interface devices (e.g., output devices 342, peripheral interfaces 344, and communication devices 346) to the basic configuration 302 via the bus / interface controller 330. Example output devices 342 include a graphics processing unit 348 and an audio processing unit 350. They can be configured to facilitate communication with various external devices such as a display or speakers via one or more A / V ports 352. Example peripheral interfaces 344 may include a serial interface controller 354 and a parallel interface controller 356, which may be configured to facilitate communication with external devices such as input devices (e.g., keyboards, mice, pens, voice input devices, touch input devices) or other peripherals (e.g., printers, scanners, etc.) via one or more I / O ports 358. Example communication devices 346 may include a network controller 360, which may be arranged to facilitate communication with one or more other computing devices 362 via a network communication link via one or more communication ports 364.
[0059] A network communication link can be an example of a communication medium. Communication media can generally be embodied as computer-readable instructions, data structures, program modules in a modulated data signal such as a carrier wave or other transmission mechanism, and can include any information delivery medium. A "modulated data signal" can be a signal in which one or more of its data sets or its changes can be carried out in a manner that encodes information in the signal. As non-limiting examples, communication media can include wired media such as a wired network or a dedicated line network, and various wireless media such as sound, radio frequency (RF), microwave, infrared (IR) or other wireless media. The term computer-readable medium used herein can include both storage media and communication media.
[0060] The computing device 300 can be implemented as a server, such as a file server, a database server, an application server, and a WEB server, etc., and can also be implemented as a personal computer including a desktop computer and a notebook computer configuration. Of course, the computing device 300 can also be implemented as a part of a small-size portable (or mobile) electronic device. In an embodiment according to the present invention, the computing device 300 is configured to execute the data storage method 400 and the data query method 500 according to the present invention. Among them, the application 322 of the computing device 300 contains a plurality of program instructions for executing the method 400 and the method 500 according to the present invention.
[0061] In the following we will refer to Figure 4 and 5 Methods 400 and 500 of managing data storage and querying by the data management system 100 are further described in detail.
[0062] Figure 4 FIG. 4 is a flow chart of a data storage method 400 according to an embodiment of the present invention. Figure 2 As well as the above description of the data storage device 110 , the process of the data storage device 110 executing the method 400 is described in detail.
[0063] like Figure 4 As shown, the method 400 starts at step S410. In step S410, it is determined whether the data to be stored belongs to a predetermined data type. As mentioned above, unstructured data is data belonging to a predetermined data type, and the predetermined data type may include one or more of the following data types: text, picture, XML, HTML, image, audio, video.
[0064] If it is determined after judgment that the data to be stored does not belong to the predetermined data type, the data is confirmed to be structured data, and in the subsequent step S420, the data is stored in the second storage area (ie, the storage area corresponding to the second storage unit 117).
[0065] If it is determined that the data to be stored belongs to the predetermined data type, then in the subsequent step S430, the data is stored in the first storage area (ie, the storage area corresponding to the first storage unit 113), and the storage location of the data is obtained as the directory address of the data.
[0066] Then in step S440, a feature vector of the corresponding data is extracted.
[0067] According to one embodiment, the directory address of the data is input into the feature extraction model, and the output is the feature vector of the data. According to another embodiment, the data itself can also be input into the feature extraction model to output the feature vector of the data. In addition, the feature extraction model can be fixed by the system or specified by the user, and the embodiments of the present invention do not impose too many restrictions on this. Generally, the feature extraction model is based on a convolutional neural network, such as CNN.
[0068] According to another embodiment, when a user inputs data to be stored, the user will also define the metadata of the data, that is, the description information of the data. In an embodiment of the present invention, the description information includes: a feature extraction model for extracting feature vectors. The data storage device 110 can display pre-stored feature extraction models to the user through a drop-down menu or the like, so that the user can select one of the feature extraction models as the model for the device 110 to extract the feature vector of the data. Regarding the process of how to train and generate pre-stored feature extraction models, please refer to the previous description of the device 110, which will not be repeated here.
[0069] Thus, in step S440, based on the description information and directory address of the data, the feature vector corresponding to the data is extracted. Further, firstly, according to the description information of the data, a feature extraction model for extracting the feature vector corresponding to the data is obtained; then the directory address of the data is input into the feature extraction model to output the feature vector corresponding to the data.
[0070] In addition, in addition to the feature extraction model, the data description information may also include: a measurement method for calculating feature similarity, so as to calculate the similarity between the feature vector of the data and the feature vector of the data to be queried in the subsequent data query process.
[0071] Then, in step S450, the feature vector of the data is associated with the directory address and stored in the second storage area (ie, the storage area corresponding to the second storage unit 117).
[0072] Figure 5 FIG. 5 is a flow chart of a data query method 500 according to an embodiment of the present invention. Figure 2 As well as the above description of the data query device 120 , the process of the data query device 120 executing the method 500 is described in detail.
[0073] like Figure 5 As shown, the method 500 starts at step S510. In step S510, in response to the query information input by the user, it is determined whether the query information contains a predetermined data type. The predetermined data type includes the data type of unstructured data, such as text, picture, XML, HTML, image, audio, and video.
[0074] As mentioned above, the query information includes at least one query condition, and according to the query condition, it can be determined whether the data to be queried belongs to structured data or unstructured data, that is, it can be determined whether the query information includes a predetermined data type.
[0075] If it is determined after judgment that the query information contains non-predetermined data types, then in the subsequent step S520, the target data is obtained from the second storage area according to the traditional structured data query method.
[0076] If it is determined after judgment that the query information contains the predetermined data type, then in the subsequent step S530, at least one feature vector to be queried is generated.
[0077] As described above, in an embodiment of the present invention, two methods can be used to generate a feature vector to be queried. The first method is the same as the method of extracting feature vectors described in method 400. In response to the query information, each unstructured data contained in the query information is cached separately to obtain the corresponding directory address (i.e., storage address) as the directory address to be queried; then, based on these directory addresses to be queried, the respective feature vectors to be queried are generated. Optionally, the directory address to be queried is input into the feature extraction model, and the corresponding feature vector to be queried is output. The second method is to directly input the unstructured data (such as an image) contained in the query information into the feature extraction model, and output the corresponding feature vector to be queried. The first method can maximize the consistency of the acquisition method of the feature vector, but it will increase the cache. The second method can save the cache and improve the calculation efficiency. In practical applications, those skilled in the art can select a suitable feature extraction method and feature extraction model in combination with the actual scenario, and the embodiments of the present invention are not limited to this.
[0078] It should be noted that the feature extraction model can be specified by the user when inputting the query information, or it can be pre-configured in the data query device 120 (for example, for image data, a CNN model is used; for text data, a ResNet model is used, but not limited thereto), and can be consistent with the feature extraction model used when executing method 400, or the same fixed feature extraction model can be used to generate all feature vectors to be queried. For more information about the feature extraction model, please refer to the relevant description above.
[0079] In some other embodiments, when the user inputs the query information, he or she may also input the feature vector corresponding to the information to be queried, or call an external feature extraction model to generate the feature vector to be queried corresponding to the query information. In this way, if it is determined after judgment that the query information contains the predetermined data type, at least one feature vector to be queried is directly obtained.
[0080] Then in step S540, at least one feature vector similar to the feature vector to be queried is determined.
[0081] Specifically, at least one feature vector similar to the feature vector to be queried is determined from the second storage area (ie, the storage area corresponding to the second storage unit 117 ).
[0082] As mentioned above, the metadata storage unit 119 stores the directory address and description information of the data in association, and the description information also specifies the measurement method for calculating feature similarity. Therefore, in step S540, the similarity between the feature vector to be queried and the feature vector of the data can be calculated based on the measurement method for calculating feature similarity corresponding to each data stored in the second storage area, and at least one feature vector whose similarity meets the query condition can be determined.
[0083] Then in step S550, at least one directory address associated with the determined at least one feature vector is obtained.
[0084] As mentioned above, the second storage area stores the feature vector of the unstructured data and its directory address in an associated manner. After the feature vector is obtained in step S540, the directory address associated with the feature vector is further obtained from the second storage area.
[0085] Then in step S560, at least one data pointed to by the acquired at least one directory address is determined as target data.
[0086] As described above, the first storage area stores the unstructured data itself and its directory address in association with each other, so based on the at least one directory address obtained, the data pointed to by each directory address can be determined from the first storage area as the target data.
[0087] The various techniques described herein may be implemented in combination with hardware or software, or a combination thereof. Thus, the method and apparatus of the present invention, or some aspects or parts of the method and apparatus of the present invention may be in the form of program codes (i.e., instructions) embedded in a tangible medium, such as a removable hard disk, a USB flash drive, a floppy disk, a CD-ROM, or any other machine-readable storage medium, wherein when the program is loaded into a machine such as a computer and executed by the machine, the machine becomes a device for practicing the present invention.
[0088] In the case where the program code is executed on a programmable computer, the computing device generally includes a processor, a storage medium readable by the processor (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device. The memory is configured to store the program code; the processor is configured to execute the data storage method and / or data query method of the present invention according to the instructions in the program code stored in the memory.
[0089] By way of example and not limitation, readable media include readable storage media and communication media. Readable storage media stores information such as computer readable instructions, data structures, program modules or other data. Communication media generally embody computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and include any information transfer medium. Any combination of the above is also included within the scope of readable media.
[0090] In the description provided herein, algorithms and displays are not inherently related to any particular computer, virtual system or other device. Various general purpose systems can also be used together with the examples of the present invention. According to the above description, it is obvious that the structure required for constructing such systems. In addition, the present invention is not directed to any specific programming language either. It should be understood that various programming languages can be utilized to implement the content of the present invention described herein, and the above description of specific languages is for the purpose of disclosing the best mode of the present invention.
[0091] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.
[0092] Similarly, it should be understood that in order to streamline the present disclosure and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, the various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting the following intention: that the claimed invention requires more features than the features explicitly recited in each claim. More specifically, as reflected in the claims below, inventive aspects lie in less than all the features of the individual embodiments disclosed above. Therefore, the claims that follow the specific embodiment are hereby expressly incorporated into the specific embodiment, with each claim itself serving as a separate embodiment of the present invention.
[0093] Those skilled in the art will appreciate that the modules or units or components of the devices in the examples disclosed herein may be arranged in the devices described in the embodiment, or alternatively may be located in one or more devices different from the devices in the examples. The modules in the foregoing examples may be combined into one module or may be divided into multiple submodules.
[0094] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.
[0095] In addition, those skilled in the art will appreciate that, although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present invention and form different embodiments. For example, in the claims below, any one of the claimed embodiments may be used in any combination.
[0096] In addition, some of the embodiments are described herein as methods or combinations of method elements that can be implemented by a processor of a computer system or by other devices that perform the functions. Therefore, a processor with necessary instructions for implementing the method or method elements forms a device for implementing the method or method elements. In addition, the elements described herein of the device embodiments are examples of devices for implementing the functions performed by the elements for the purpose of implementing the invention.
[0097] As used herein, unless otherwise specified, the use of ordinal numbers "first," "second," "third," etc. to describe common objects merely indicates that different instances of similar objects are involved, and is not intended to imply that the objects so described must have a given order in time, space, order, or in any other manner.
[0098] Although the present invention has been described according to a limited number of embodiments, it will be apparent to those skilled in the art, with the benefit of the above description, that other embodiments may be envisioned within the scope of the invention thus described. In addition, it should be noted that the language used in this specification is selected primarily for readability and teaching purposes, rather than for explaining or defining the subject matter of the present invention. Therefore, many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the appended claims. The disclosure of the present invention is illustrative and not restrictive with respect to the scope of the present invention, and the scope of the present invention is defined by the appended claims.
Claims
1. A data storage method, applied to a data storage device, the data storage device comprising: A feature extraction unit, a first storage unit and a second storage unit; the feature extraction unit is used to extract feature vectors of unstructured data, the first storage unit is used to store unstructured data, and the second storage unit is used to store structured data; Includes steps: Determine whether the data to be stored is unstructured data; If the data is unstructured data, the data is stored in the first storage unit and a directory address of the data is obtained, where the directory address is a storage location of the data in the first storage unit; Obtaining description information of the data and storing it in association with the directory address of the data; Based on the description information and directory address of the data, extracting a feature vector of the data by the feature extraction unit; as well as storing the feature vector of the data in association with the directory address in the second storage unit; If the data is structured data, the data is stored in the second storage unit.
2. The method of claim 1, wherein: The description information at least includes: a feature extraction model for extracting feature vectors and a measurement method for calculating feature similarity.
3. The method of claim 1, wherein: The step of extracting the feature vector of the data by the feature extraction unit based on the description information and the directory address of the data further includes: According to the description information of the data, a feature extraction model corresponding to the data for extracting a feature vector is obtained; The directory address is input into the feature extraction model to output a feature vector corresponding to the data.
4. The method according to any one of claims 1 to 3, wherein: The predetermined data type includes one or more of the following data types: text, picture, XML, HTML, image, audio, and video.
5. A data storage device, comprising: A judging unit, adapted to judge whether the data to be stored is unstructured data; a first storage unit, adapted to store the data and generate a directory address of the data when the data is unstructured data, the directory address being a storage location of the data in the first storage unit; A metadata storage unit adapted to obtain description information of the data when the data to be stored belongs to a predetermined data type, and store the information in association with a directory address of the data; A feature extraction unit, adapted to extract a feature vector of the data based on the description information and the directory address of the data; as well as The second storage unit is adapted to associate and store the feature vector of the data with the directory address; and, when the data to be stored is structured data, store the data to be stored.
6. A data query method, applied to a data query device, wherein the data query device comprises a feature calculation unit; Includes steps: In response to a user's query information, determining whether the query information contains unstructured data; If the query information includes unstructured data, generating at least one feature vector to be queried by the feature calculation unit; Determine at least one feature vector similar to the feature vector to be queried from a second storage unit of the data storage device, wherein the feature vector and the directory address of the unstructured data are stored in association in the second storage unit, and the feature vector of the unstructured data is extracted by the feature extraction unit in the data storage device based on the description information of the unstructured data and the directory address; the second storage unit is used to store the data when the data to be stored is structured data; Acquire at least one directory address associated with the determined at least one feature vector from the second storage unit, the directory address being a storage location of the data in the first storage unit of the data storage device; as well as Determine at least one data pointed to by the acquired at least one directory address from the first storage unit as target data; If the query information does not include unstructured data, the target data is obtained from the second storage unit.
7. The method of claim 6, wherein: The predetermined data type includes one or more of the following data types: text, picture, XML, HTML, image, audio, and video.
8. The method according to claim 6 or 7, wherein: The step of determining at least one feature vector similar to the feature vector to be queried comprises: According to a specified measurement method for calculating feature similarity, at least one feature vector similar to the feature vector to be queried is determined from the second storage unit.
9. The method according to claim 6 or 7, wherein: The step of generating at least one feature vector to be queried further comprises: In response to the query information, obtaining at least one directory address to be queried; At least one feature vector to be queried is generated based on at least one directory address to be queried.
10. A data query method, applied to a data query device, wherein the data query device comprises a feature calculation unit; Includes steps: generating at least one feature vector to be queried by the feature calculation unit, wherein the feature vector to be queried is generated when the query information contains unstructured data; Determine at least one feature vector similar to the feature vector to be queried from a second storage unit of the data storage device, wherein the feature vector and the directory address of the unstructured data are stored in association in the second storage unit, and the feature vector of the unstructured data is extracted by the feature extraction unit in the data storage device based on the description information of the unstructured data and the directory address; the second storage unit is used to store the data when the data to be stored is structured data; Acquire at least one directory address associated with the determined at least one feature vector, the directory address being a storage location of the data in a first storage unit of the data storage device; as well as At least one data pointed to by the acquired at least one directory address is determined from the first storage unit as target data.
11. A data query device, comprising: a determination unit adapted to determine, in response to a user's query information, whether the query information contains unstructured data; a feature calculation unit adapted to generate at least one feature vector to be queried if the query information contains unstructured data, and further adapted to respectively determine at least one feature vector similar to the feature vector to be queried from a second storage unit of a data storage device, wherein the second storage unit stores feature vectors and directory addresses of unstructured data in association, wherein the feature vectors of the unstructured data are extracted by a feature extraction unit in the data storage device based on description information of the unstructured data and the directory address; and the second storage unit is used to store the data when the data to be stored is structured data; a first query unit adapted to obtain at least one directory address associated with the determined at least one feature vector from the second storage unit, the directory address being a storage location of the data in the first storage unit of the data storage device; The second query unit is adapted to determine at least one data pointed to by the acquired at least one directory address from the first storage area as target data.
12. The device of claim 11, wherein: The data includes one or more of the following data types: text, picture, XML, HTML, image, audio, and video.
13. A data management system, comprising: The data storage device as claimed in claim 5; and A data query device as claimed in claim 11 or 12.
14. A computing device comprising: at least one processor; and A memory storing program instructions, wherein the program instructions are configured to be suitable for execution by the at least one processor, and the program instructions include instructions for executing the method as described in any one of claims 1-4, and instructions for executing the method as described in any one of claims 6-10.
15. A readable storage medium storing program instructions, when the program instructions are read and executed by a computing device, the computing device executes the method according to any one of claims 1 to 4 and the method according to any one of claims 6 to 10.
Citation Information
Patent Citations
Data storage method, data processing method, device and mobile terminal
CN104169914A
Image classification method and device, server, user terminal, and storage medium
CN108304882A
Real estate information inquiry method and device, computer equipment and storage medium
CN108846015A
Data query method, data query system determining method, apparatus
CN109074363A
Cited By
Data storage method and data query method
WO2020173334A1