Storage method, device, medium and equipment of image data

By managing image data through a multi-database storage system and load balancing algorithm, the efficiency and stability issues of massive image data storage are solved, achieving efficient data storage and management.

CN114048171BActive Publication Date: 2025-12-12江苏云从曦和人工智能有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111070568.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-13
Publication Date
2025-12-12
Estimated Expiration
2041-09-13

AI Technical Summary

Technical Problem

How to efficiently and stably store massive amounts of image data, especially image data generated in the security field.

Method used

A multi-database storage system is adopted, which selects the database according to the type of image data and storage strategy. Combined with load balancing algorithm and data table management module, it realizes efficient storage and management of image data.

Benefits of technology

It enables the even distribution of image data of different data types across multiple databases, reduces the storage pressure on a single database, supports dynamic database expansion, and meets the ever-increasing storage demands.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114048171B_ABST
    Figure CN114048171B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of computer, and particularly provides a kind of image data storage method, device, medium and equipment, to solve the problem of how to efficiently and stably save mass image data.For this purpose, the present application can store image data based on data storage system including multiple databases, each database includes multiple data tables, each data table is configured to store image data of one data type, and image data of the same type is stored in at least one database corresponding to the data type of data table;And can select database according to the data type of image data to be stored and storage strategy to store image data.Based on the above configuration, different data types of image data can be evenly distributed in each database of data storage system, and the high availability and scalability of database in data storage system are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer technology, and specifically provides an image data storage method, device, medium and equipment. BACKGROUND

[0002] With the continuous development of artificial intelligence technology, artificial intelligence commercialization is also becoming more and more widespread. After the commercialization of artificial intelligence, there will inevitably be a large amount of data, and different industries will conduct different dimension analysis to extract valuable information. For example, in the security field, artificial intelligence has been widely used in personnel search and trajectory analysis, and the image data generated is also growing. How to efficiently and stably save these data has become a problem to be solved.

[0003] Correspondingly, there is a need in the art for a new image data storage scheme to solve the above problems. SUMMARY

[0004] The present application aims to solve the above technical problems, i.e., to solve the problem of how to efficiently and stably save a large amount of image data.

[0005] In a first aspect, the present application provides an image data storage method, characterized in that the storage method is applied to a data storage system, the data storage system comprising a plurality of databases, each of the databases comprising a plurality of data tables, each of the data tables being configured to store image data of a data type, wherein image data of the same data type is stored in at least one database corresponding to the data type.

[0006] The storage method comprises:

[0007] receiving a storage request of image data to be stored, and obtaining a data type and a storage strategy of the image data to be stored according to the storage request;

[0008] determining whether the storage strategy specifies to select a database with the least number of stored image data of the data type for data storage; if yes, storing the image data to be stored in the database with the least number of stored image data of the data type; and if no, randomly selecting a database for data storage of the image data to be stored.

[0009] In one technical solution of the above storage method, the data storage system further comprises a plurality of data processing service nodes, the data processing service nodes comprising a data storage service module, the data storage service module comprising a data service interface based on a GPRC protocol, and the storage method further comprises:

[0010] determining, by a load balancing algorithm and according to a load state of each of the data processing service nodes, a data processing service node to perform a data storage operation on the to-be-stored image data;

[0011] accessing, by a data storage service module in the data processing service node, a database for storing the to-be-stored image data, and storing the to-be-stored image data into the database.

[0012] In one technical solution of the above storage method, the data processing service node further comprises a data table management module,

[0013] The data table management module is configured to perform the following steps:

[0014] When storing the image data into a data table in the database corresponding to a data type of the image data, recording a storage time of the image data at the same time;

[0015] determining a time interval in which the storage time falls, and storing the image data into a data storage area in the data table corresponding to the time interval;

[0016] and / or, judging, according to the storage time, whether a duration of storing the image data into the data table exceeds a preset first duration; if yes, marking a state of the image data;

[0017] judging whether a duration of storing the image data marked with the state into the data table exceeds a preset second duration; if yes, deleting the image data;

[0018] wherein the second duration is greater than the first duration.

[0019] In one technical solution of the above storage method, the storage request further comprises a storage area identifier, the storage area identifier being used to specify a data storage area in the data table where the image data is stored, and the method further comprises storing the to-be-stored image data into the database by the following steps:

[0020] obtaining a hash value of the storage area identifier according to a storage area identifier of the to-be-stored image data;

[0021] storing the to-be-stored image data into a data storage area specified by the storage area identifier in the data table according to the hash value.

[0022] In one technical solution of the above storage method, the storage method further comprises performing data reading on the image data stored in the data storage system by the following steps:

[0023] receiving a read request of image data to be read, obtaining a data type and a storage area identifier of the image data to be read contained in the read request;

[0024] obtaining a hash value of the storage area identifier;

[0025] for each database, judging whether the database stores image data containing the data type according to the data type, and if so, accessing a data storage area specified by the storage area identifier in a data table corresponding to the data type according to the hash value, and performing reading of the image data to be read.

[0026] In a second aspect, the present application provides a storage device for image data, which is applied to a data storage system, the data storage system comprising a plurality of databases, each of the databases comprising a plurality of data tables, each of the data tables being configured to store image data of a data type, wherein image data of the same data type is stored in at least one database in a data table corresponding to the data type;

[0027] The storage device comprises:

[0028] a data type and storage strategy obtaining module configured to receive a storage request of image data to be stored, and obtain a data type and a storage strategy of the image data to be stored according to the storage request;

[0029] an image data storage module configured to judge whether the storage strategy specifies to select a database with the least number of stored image data of the data type for data storage; if so, store the image data to be stored in the database with the least number of stored image data of the data type; and if not, randomly select a database for data storage of the image data to be stored.

[0030] In one of the above technical solutions of the storage device, the data storage system further comprises a plurality of data processing service nodes, each of the data processing service nodes comprising a data storage service module, the data storage service module comprising a data service interface based on a GPRC protocol, and the storage device further comprises:

[0031] a data processing service node determining module configured to determine a data processing service node for performing data storage operation on the image data to be stored according to a load state of each of the data processing service nodes by a load balancing algorithm;

[0032] a database accessing module configured to access a database for storing the image data to be stored by the data storage service module in the data processing service node, and store the image data to be stored in the database.

[0033] In one of the technical solutions of the above storage device, the data processing service node further comprises a data table management module,

[0034] The data table management module is configured to perform the following steps:

[0035] When storing the image data into the data table corresponding to the data type of the image data in the database, the storage time of the image data is recorded at the same time;

[0036] Determine the time interval in which the storage time falls, and store the image data into the data storage area corresponding to the time interval in the data table;

[0037] And / or, according to the storage time, determine whether the duration of the image data stored in the data table exceeds a preset first duration; if so, mark the state of the image data;

[0038] Determine whether the duration of the image data marked with the state stored in the data table exceeds a preset second duration; if so, delete the image data;

[0039] Wherein, the second duration is greater than the first duration.

[0040] In one of the technical solutions of the above storage device, the storage request further comprises a storage area identifier, which is used to specify the data storage area in which the image data is stored in the data table, and the storage device further comprises a data storage area specifying module, which is configured to store the image data to be stored in the database by the following steps:

[0041] According to the storage area identifier of the image data to be stored, obtain the hash value of the storage area identifier;

[0042] According to the hash value, store the image data to be stored into the data storage area specified by the storage area identifier in the data table.

[0043] In one of the technical solutions of the above storage device, the storage device further comprises an image data reading module, which is configured to perform data reading on the image data stored in the data storage system by the following steps:

[0044] Receive a reading request of image data to be read, and obtain the data type and storage area identifier of the image data to be read contained in the reading request;

[0045] Obtain the hash value of the storage area identifier;

[0046] For each database, it is judged according to the data type whether the image data containing the data type is stored in the database, if yes, according to the hash value, the data storage area specified by the storage area identifier in the data table corresponding to the data type is accessed, and the reading of the to-be-read image data is performed.

[0047] In a third aspect, a computer readable storage medium, the storage medium stores a plurality of program codes, the program codes are suitable for being loaded and run by a processor to perform the image data storage method of any one of the technical solutions of the above-mentioned image data storage method.

[0048] In a fourth aspect, a computer device is provided, comprising a processor and a memory, the memory is suitable for storing a plurality of program codes, the program codes are suitable for being loaded and run by the processor to perform the image data storage method of any one of the technical solutions of the above-mentioned image data storage method.

[0049] In the case of adopting the above technical solutions, the present application can store image data based on a data storage system comprising a plurality of databases, each database comprising a plurality of data tables, each data table being configured to store image data of a data type, and image data of the same type being stored in at least one database corresponding to the data type; and the database can be selected according to the data type and storage strategy of the image data to be stored. Through the above configuration, efficient management of massive image data can be achieved, and image data of different data types is stored in different databases, so that image data of different data types is relatively evenly distributed in each database, which not only reduces the storage pressure of a single database, but also realizes dynamic expansion of the database and improves the storage space of image data for data storage, meeting the increasing storage demand of image data. BRIEF DESCRIPTION OF DRAWINGS

[0050] The disclosure of the present application will become more readily apparent from the following description of the present application. Those skilled in the art will readily understand that the drawings are only for the purpose of illustration and are not intended to limit the scope of protection of the present application. Among them:

[0051] Figure 1 is a main step flow diagram of the image data storage method according to an embodiment of the present application;

[0052] Figure 2 is a main structure diagram of a data storage system according to an embodiment of the present application;

[0053] Figure 3 is a main structure block diagram of an image data storage device according to an embodiment of the present application. Detailed Implementation

[0054] Some embodiments of the present invention will now be described with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are merely illustrative of the technical principles of the present invention and are not intended to limit the scope of protection of the present invention.

[0055] In the description of this invention, "module" and "processor" can include hardware, software, or a combination of both. A module can include hardware circuitry, various suitable sensors, communication ports, memory, and may also include software components, such as program code, or a combination of software and hardware. A processor can be a central processing unit, a microprocessor, a digital signal processor, or any other suitable processor. The processor has data and / or signal processing capabilities. The processor can be implemented in software, in hardware, or a combination of both. Non-transitory computer-readable storage media include any suitable medium capable of storing program code, such as magnetic disks, hard disks, optical disks, flash memory, read-only memory, random access memory, etc. The term "A and / or B" means all possible combinations of A and B, such as only A, only B, or A and B. The terms "at least one A or B" or "at least one of A and B" have a similar meaning to "A and / or B" and can include only A, only B, or A and B. The singular terms "a" or "this" can also include plural forms.

[0056] See appendix Figure 1 , Figure 1 This is a schematic flowchart illustrating the main steps of an image data storage method according to an embodiment of the present invention. In this embodiment, the image data storage method can be applied to a data storage system. The data storage system includes multiple databases, each database includes multiple data tables, and each data table is configured to store image data of a specific data type. Image data of the same data type is stored in at least one database in a data table corresponding to that data type. Figure 1 As shown, the image data storage method in this embodiment of the invention mainly includes the following steps S101-S104.

[0057] Step S101: Receive a storage request for the image data to be stored, and obtain the data type and storage strategy of the image data to be stored according to the storage request.

[0058] In this embodiment, a storage request for the image data to be stored can be obtained, and the data type and storage strategy of the image data to be stored can be obtained based on the storage request.

[0059] In one implementation, see Appendix Figure 2 , Figure 2is a schematic diagram of the main structure of a data storage system according to an embodiment of the present application. As shown in Figure 2 In the present embodiment, a plurality of databases (MYSQL, a relational database management system) can be included in the data storage layer of the data storage system, and the database can be expanded in the data storage layer. The number of databases can be increased according to the application needs to increase the storage capacity of the image data of the data storage system. A plurality of data tables can be included in each database, and each data table is configured to store image data of a data type. For example, the database includes data tables A, B and C, the data table A stores image data of a data type, the data table B stores image data of a data type, and the data table C stores image data of a data type. For another example, the data table A stores image data of a data type, the data table B also stores image data of a data type, and the data table C stores image data of a data type.

[0060] In an embodiment, the data to be stored can be image data of a plurality of data types, such as image data of a human face data type, image data of a human body data type, etc. The storage strategy is a method for specifying how to store image data.

[0061] Step S102: Determine whether the storage strategy specifies to select the database that stores the least number of image data of the data type to store the data. If yes, go to step S103; if no, go to step S104.

[0062] In the present embodiment, the storage strategy can be obtained according to step S101, and it is determined whether the storage strategy specifies to select the database that stores the least number of image data of the data type to store the data.

[0063] Step S103: Store the image data to be stored in the database that stores the least number of image data of the data type.

[0064] In the present embodiment, if the storage strategy of the image data to be stored specifies to select the database that stores the least number of image data of the data type to store the data, the image data to be stored is stored in the database that stores the least number of image data of the data type.

[0065] Step S104: If the storage strategy of the image data to be stored does not specify the database for data storage, a database can be randomly selected for data storage of the image data to be stored.

[0066] In the embodiment, if the storage strategy of the image data to be stored does not specify the database for storing the data, a database can be randomly selected for storing the image data to be stored. If the randomly selected database contains a data table for storing the image data of the data type, the image data to be stored is stored in the data table; if the randomly selected database does not contain a data table for storing the image data of the data type, a data table for storing the image data of the data type is first established, and then the image data to be stored is stored in the newly established data table.

[0067] In an application scenario of the present application, it is required to use the image data of the face data type obtained from the security monitoring system to find a person, i.e., to find a specific face image in a large amount of image data of the face data type. Therefore, the image data of the face data type obtained from the security monitoring system needs to be stored so as to facilitate finding a person by using the image data of the face data type. First, the image data generated by the security monitoring system can be classified, such as image data of the face data type and image data of the human body data type, and the classified image data is marked with a corresponding category label, such as marking the image data of the face data type with a face feature label. The marked image data can be stored in a data table corresponding to the face feature in each database in the data storage system. When new image data of the face data type needs to be stored, whether to store the image data of the face data type in the database containing the least amount of image data of the face data type can be determined according to the data type and the storage strategy contained in the storage request. If yes, the image data of the face data type to be stored is stored in the database containing the least amount of image data of the face data type. If no, a database can be randomly selected for storing the image data of the face data type to be stored.

[0068] Based on the steps S101-S104, the application can store image data based on a data storage system including a plurality of databases, each database including a plurality of data tables, each data table being configured to store image data of one data type, and image data of the same type being stored in at least one database corresponding to the data type; and the database can be selected according to the data type and storage strategy of the image data to be stored. Through the above configuration, efficient management of massive image data can be realized, and image data of different data types is stored in different databases, so that image data of different data types is relatively evenly distributed in different databases, which not only reduces the storage pressure of a single database, but also realizes dynamic expansion of the database and improves the storage space of image data for data storage, thereby meeting the increasing storage demand of image data.

[0069] In one embodiment of the embodiment of the application, the data storage system can further include a plurality of data processing service nodes, and the data processing service nodes can include a data storage service module, and the data storage service module can include a data service interface based on the GPRC protocol. In addition to the steps S101-S104, the application can further include:

[0070] Step S105: determining a data processing service node for performing data storage operation on the image data to be stored by a load balancing algorithm and according to the load state of each data processing service node;

[0071] Step S106: accessing the database for storing the image data to be stored by the data storage service module in the data processing service node, and storing the image data to be stored in the database.

[0072] In the embodiment, the data storage system can include a plurality of data processing service nodes, the data processing service nodes can include data storage service modules in the data service layer, and the data storage service modules can include data service interfaces based on the GRPC protocol. The GRPC (Google Remote Procedure Call) protocol is a high-performance, general-purpose open-source RPC (Remote Procedure Call) framework protocol, which is developed based on the ProtoBuf (Protocol Buffers) data description language and supports a plurality of development languages. The data service interfaces based on the GRPC protocol have a fast transmission rate and can quickly respond to data storage requests for image data. In addition, the GRPC protocol supports a plurality of development languages, so that the data service interfaces can communicate between data storage systems using different development languages, further improving the storage efficiency and availability of the data storage system. Meanwhile, the data processing service nodes including the data service interfaces based on the GRPC protocol can be arbitrarily extended, that is, the number of data service processing nodes can be increased at will according to the needs of the application process. On the premise of ensuring the efficiency of image data storage and reading, the database (MYSQL) can be infinitely extended for image data storage. In addition, the data processing service nodes are stateless, that is, the image data storage request does not specify which data processing service node to use. This can effectively avoid the situation that the failure of a certain data processing service node leads to the failure of image data storage or reading, further improving the high availability of the data storage system. The data processing service node performing the data storage operation on the to-be-stored image data can be determined by a load balancing algorithm and the load state of each data processing service node, and the database for storing the to-be-stored image data can be accessed by the data storage service module in the data processing service node, and the to-be-stored image data can be stored in the database. The load balancing algorithm is an algorithm for distributing tasks to a plurality of operation units for execution. In the embodiment, it is an algorithm for distributing tasks for accessing the database for storing the to-be-stored image data to a plurality of data processing service nodes.

[0073] In one embodiment, a polling load balancing algorithm can be used to determine the data processing service node that performs the data storage operation on the image data to be stored, i.e., the data processing service nodes are sequentially applied according to a preset order of the data processing service nodes to access the database for storing the image data to be stored. A weight load balancing algorithm can also be used to determine the data processing service node that performs the data storage operation on the image data to be stored, i.e., for a plurality of data processing service nodes, a weight value of each data processing service node is set, and the data processing service nodes are distributed with access tasks (including but not limited to data storage and data reading) according to the weight values, the data processing service nodes with higher weight values are distributed with more access tasks, and the data processing service nodes with lower weight values are distributed with less access tasks.

[0074] In one embodiment of the present embodiment, the data service node can further include a data table management module, which can be configured to perform the following steps S107-S108:

[0075] Step S107: When storing the image data into the data table corresponding to the data type of the image data in the database, the storage time of the image data is recorded at the same time;

[0076] Step S108: Determine the time interval in which the storage time falls, and store the image data into the data storage area corresponding to the time interval in the data table.

[0077] In the present embodiment, when storing the image data into the data table corresponding to the data type of the image data in the database, the data table management module can be applied to record the storage time of the image data, and further determine the time interval in which the storage time of the image data falls, and store the image data into the data storage area corresponding to the time interval in the data table.

[0078] Specifically, the data table can divide the data storage area according to the time interval to which the storage time of the image data belongs. When storing the image data, the image data can be stored into the data storage area corresponding to the time interval to which the storage time of the image data belongs. In this way, when reading and managing the image data, the reading and management of the image data can be performed according to the time interval of the storage time, and the reading and management of the image data in a smaller range can be achieved.

[0079] In one embodiment of the present embodiment, the data table management module can be further configured to perform the following steps S109-S110:

[0080] Step S109: Determine whether the duration of the image data stored in the data table exceeds a preset first duration according to the storage time; if yes, mark the image data with a state;

[0081] Step S110: Determine whether the duration for which the image data with status marking is stored in the data table exceeds the preset second duration; if so, delete the image data; wherein the second duration is longer than the first duration.

[0082] In this embodiment, the data table management module can manage image data based on its storage time. Specifically, when image data has been stored in the data table for more than a preset first duration, the image data can be marked as having a longer storage time. When the image data has been stored in the data table for more than a preset second duration, the image can be deleted. This configuration allows for full lifecycle management of image data, ensuring timely marking and deletion of images with longer storage times, thus enabling effective image data updates. Those skilled in the art can set the values ​​of the first and second durations as needed.

[0083] In one implementation, such as Figure 2 As shown, the data processing service node may further include a service routing layer, a data service layer, and a data management layer. The service routing layer determines the data processing service node to perform data storage operations on the image data to be stored, based on a load balancing algorithm and the load status of each data processing service node. The data service layer provides the data storage service module. The data management layer provides the data table management module.

[0084] In one embodiment of the present invention, the storage request may further include a storage area identifier, which is used to specify the data storage area where the image data is stored in the data table. The image data storage method may also store the image data to be stored in the database through the following steps S111-S112:

[0085] Step S111: Obtain the hash value of the storage area identifier based on the storage area identifier of the image data to be stored;

[0086] Step S112: Based on the hash value, store the image data to be stored in the data storage area specified by the storage area identifier in the data table.

[0087] In the embodiment, the storage request of the image data can further include a storage area identifier for specifying a data storage area of the image data in the data. The hash value of the storage area can be obtained according to the storage area identifier of the image data to be stored, and the image data to be stored can be stored in the data storage area specified by the storage area identifier in the data table according to the hash value. The storage area identifier can be an identifier obtained by dividing the data table according to time, area, etc. By setting the storage area identifier, the data table of the stored image data can be divided according to time and area, so as to obtain more accurate and smaller data amount of image data in the reading process of the image data. The hash value is a value obtained by a hash function, that is, a longer data is mapped to a shorter data by the hash function, and the shorter data is the hash value of the longer data.

[0088] In one embodiment of the embodiment of the present application, the storage method of the image data can further include steps S113-S115 for reading the image data stored in the data storage system:

[0089] Step S113: receiving a reading request of image data to be read, obtaining the data type and the storage area identifier of the image data to be read contained in the reading request;

[0090] Step S114: obtaining the hash value of the storage area identifier;

[0091] Step S115: for each database, judging whether the image data containing the data type is stored in the database according to the data type, if yes, accessing the data storage area specified by the storage area identifier in the data table corresponding to the data type according to the hash value, and reading the image data to be read.

[0092] In the embodiment, the reading request of the image data to be read can be received, and the data type and the storage area identifier of the image data to be read contained in the reading request can be obtained, and the hash value of the storage area identifier can be further obtained. For each database, whether the image data containing the data type is stored in the database can be judged according to the data type of the image data to be read, if yes, the data storage area specified by the storage area identifier in the data table corresponding to the data type of the image data to be read can be accessed according to the hash value, so as to read the image data to be read.

[0093] It should be noted that although the steps in the above embodiments are described in a specific order, those skilled in the art can understand that, in order to achieve the effect of the present application, the different steps do not necessarily have to be executed in such an order, they can be executed simultaneously (in parallel) or in other orders, and these changes are within the protection scope of the present application.

[0094] Further, the present application also provides an image data storage device.

[0095] Referring to the drawings Figure 3 , Figure 3 is a main structure block diagram of the image data storage device according to an embodiment of the present application. As shown in the figure, Figure 3 The image data storage device in the embodiment of the present application can be applied to a data storage system, which can include a plurality of databases, each of which can include a plurality of data tables, each of which can be respectively configured to store image data of a data type, wherein image data of the same data type is stored in at least one database corresponding to the data type. The storage device can include a data type and storage strategy acquisition module and an image data storage module. In this embodiment, the data type and storage strategy acquisition module can be configured to receive a storage request for image data to be stored, and to acquire the data type and storage strategy of the image data to be stored according to the storage request. The image data storage module can be configured to determine whether the storage strategy specifies to select a database with the least number of image data of the storage data type for data storage; if so, store the image data to be stored in the database with the least number; if not, randomly select a database for data storage of the image data to be stored.

[0096] In one embodiment, the data storage system can further include a plurality of data processing service nodes, the data processing service nodes can include a data storage service module, the data storage service module can include a data service interface based on the GPRC protocol, and the storage device can further include a data processing service node determination module and a database access module. In this embodiment, the data processing service node determination module can be configured to determine a data processing service node for performing a data storage operation on the image data to be stored according to the load state of each data processing service node through a load balancing algorithm. The database access module can be configured to access the database for storing the image data to be stored through the data storage service module in the data processing service node, and store the image data to be stored in the database.

[0097] In one embodiment, the data processing service node can further include a data table management module, which can be configured to perform the following steps: when storing image data in a data table corresponding to the data type of the image data in the database, simultaneously recording the storage time of the image data; determining the time interval in which the storage time falls, and storing the image data in a data storage area corresponding to the time interval in the data table;

[0098] In one implementation, the data table management module can also be configured to perform the following steps: determine whether the duration for which image data is stored in the data table exceeds a preset first duration based on the storage time; if so, mark the image data with a status; determine whether the duration for which the marked image data is stored in the data table exceeds a preset second duration; if so, delete the image data; wherein the second duration is longer than the first duration.

[0099] In one embodiment, the storage request may further include a storage area identifier, which can be used to specify the data storage area in the data table where the image data is stored. The storage device may also include a data storage area specifying module, which can be configured to store the image data to be stored in the database through the following steps: obtaining the hash value of the storage area identifier based on the storage area identifier of the image data to be stored; and storing the image data to be stored in the data storage area specified by the storage area identifier in the data table based on the hash value.

[0100] In one embodiment, the storage device may further include an image data reading module, which can be configured to read image data stored in the data storage system through the following steps: receiving a read request for image data to be read; obtaining the data type and storage area identifier of the image data to be read contained in the read request; obtaining the hash value of the storage area identifier; for each database, determining whether the database stores image data containing the data type based on the data type; if so, accessing the data storage area specified by the storage area identifier in the data table corresponding to the data type based on the hash value, and reading the image data to be read.

[0101] The aforementioned image data storage device is used for execution Figure 1 The image data storage method embodiments shown are similar in technical principle, the technical problems solved and the technical effects produced. Those skilled in the art can clearly understand that, for the sake of convenience and brevity, the specific working process and related descriptions of the image data storage device can be referred to the content described in the embodiments of the image data storage method, and will not be repeated here.

[0102] Those skilled in the art can understand that all or part of the processes in the method of the above-mentioned embodiment of the present application can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by a processor. The computer program includes computer program code, which can be in the form of source code, object code, executable files or some intermediate forms. The computer readable medium can include any entity or device, medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory, random access memory, electrical carrier signal, telecommunication signal and software distribution medium, etc. that can carry the computer program code. It should be noted that the content included in the computer readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, according to legislation and patent practice in some jurisdictions, the computer readable medium does not include electrical carrier signals and telecommunication signals.

[0103] Further, the present application also provides a computer readable storage medium. In an embodiment of the computer readable storage medium according to the present application, the computer readable storage medium can be configured to store a program for executing the image data storage method of the above-mentioned method embodiments, which can be loaded and run by a processor to implement the image data storage method. For the convenience of description, only the parts related to the embodiments of the present application are shown, and the specific technical details not disclosed are referred to the method part of the embodiments of the present application. The computer readable storage medium can be a storage device formed by various electronic devices. Optionally, the computer readable storage medium in the embodiments of the present application is a non-transitory computer readable storage medium.

[0104] Further, the present application also provides a computer device. In an embodiment of the computer device according to the present application, the computer device can include a processor and a storage device. The storage device can be configured to store a program for executing the image data storage method embodiments described above, and the processor can be configured to execute the program in the storage device, which includes but is not limited to the program for executing the image data storage method embodiments described above. For the convenience of description, only the parts related to the embodiments of the present application are shown, and the specific technical details not disclosed are referred to the method part of the embodiments of the present application. The computer device can be a device formed by various electronic devices.

[0105] Further, it should be understood that, since the setting of each module is only for illustrating the functional units of the device of the present application, the corresponding physical device of the module can be the processor itself, or a part of software, hardware or the combination of software and hardware in the processor. Therefore, the number of each module in the figure is only illustrative.

[0106] Those skilled in the art can understand that the various modules in the device can be adaptively split or combined. Such splitting or combining of specific modules does not cause the technical solution to deviate from the principles of the present application, and therefore, the technical solutions after splitting or combining will fall within the protection scope of the present application.

[0107] So far, the technical solutions of the present application have been described in combination with the preferred embodiments shown in the drawings, but those skilled in the art can easily understand that the protection scope of the present application is obviously not limited to these specific embodiments. Those skilled in the art can make equivalent changes or replacements to the related technical features without deviating from the principles of the present application, and the technical solutions after such changes or replacements will fall within the protection scope of the present application.

Claims

1. A method for storing image data, characterized in that, The storage method is applied to a data storage system, which includes multiple databases, each database including multiple data tables, and each data table being configured to store image data of a certain data type. Image data of the same data type is stored in at least one database in a data table corresponding to that data type. The storage method includes: Receive a storage request for image data to be stored, and obtain the data type and storage strategy of the image data to be stored based on the storage request; Determine whether the storage strategy specifies selecting the database with the fewest number of image data of the specified data type for data storage; if yes, store the image data to be stored in the database with the fewest number of images; if no, randomly select a database for storing the image data to be stored. The data storage system also includes multiple data processing service nodes, each of which includes a data table management module. The data table management module is configured to perform the following steps: When storing image data in a database table corresponding to the data type of the image data, the storage time of the image data is recorded simultaneously. Determine the time interval into which the storage time falls, and store the image data in the data table to the data storage area corresponding to the time interval; The data processing service node includes a data storage service module, which includes a data service interface based on the GPRC protocol. The storage method further includes: The data processing service node that performs the data storage operation on the image data to be stored is determined by using a load balancing algorithm and based on the load status of each data processing service node. The data storage service module in the data processing service node accesses the database used to store the image data to be stored, and stores the image data to be stored in the database.

2. The storage method according to claim 1, characterized in that, The data table management module is also configured to perform the following steps: Based on the storage time, determine whether the duration for which the image data has been stored in the data table exceeds a preset first duration; if so, mark the status of the image data. Determine whether the duration for which the image data with status marking is stored in the data table exceeds a preset second duration; If so, then delete the image data; Wherein, the second duration is longer than the first duration.

3. The storage method according to claim 1, characterized in that, The storage request also includes a storage area identifier, which specifies the data storage area where the image data is stored in the data table. The method further includes storing the image data to be stored in the database through the following steps: Obtain the hash value of the storage area identifier based on the storage area identifier of the image data to be stored; Based on the hash value, the image data to be stored is stored in the data storage area specified by the storage area identifier in the data table.

4. The storage method according to claim 3, characterized in that, The storage method further includes reading image data stored in the data storage system through the following steps: Receive a read request for image data to be read, and obtain the data type and storage area identifier of the image data to be read contained in the read request; Obtain the hash value of the storage area identifier; For each database, determine whether the database stores image data containing the data type based on the data type. If so, access the data storage area specified by the storage area identifier in the data table corresponding to the data type based on the hash value, and read the image data to be read.

5. A storage device for image data, characterized in that, The storage device is applied to a data storage system, which includes multiple databases, each database including multiple data tables, and each data table being configured to store image data of a certain data type. Image data of the same data type is stored in at least one database in a data table corresponding to the data type. The storage device includes: The data type and storage strategy acquisition module is configured to receive a storage request for image data to be stored, and acquire the data type and storage strategy of the image data to be stored according to the storage request. An image data storage module is configured to determine whether the storage strategy specifies the selection of the database with the fewest number of image data of the data type for data storage; if yes, the image data to be stored is stored in the database with the fewest number; if no, a database is randomly selected for data storage of the image data to be stored. The data storage system also includes multiple data processing service nodes, each of which includes a data table management module. The data table management module is configured to perform the following steps: When storing image data in a database table corresponding to the data type of the image data, the storage time of the image data is recorded simultaneously. Determine the time interval into which the storage time falls, and store the image data in the data table to the data storage area corresponding to the time interval; The data processing service node includes a data storage service module, which includes a data service interface based on the GPRC protocol. The storage device further includes: A data processing service node determination module is configured to determine the data processing service node that performs the data storage operation on the image data to be stored by means of a load balancing algorithm and based on the load status of each data processing service node. The database access module is configured to access the database used to store the image data to be stored through the data storage service module in the data processing service node, and to store the image data to be stored in the database.

6. The storage device according to claim 5, characterized in that, The data table management module is also configured to perform the following steps: Based on the storage time, determine whether the duration for which the image data has been stored in the data table exceeds a preset first duration; if so, mark the status of the image data. Determine whether the duration for which the image data with status marking is stored in the data table exceeds a preset second duration; If so, then delete the image data; Wherein, the second duration is longer than the first duration.

7. The storage device according to claim 5, characterized in that, The storage request also includes a storage area identifier, which specifies the data storage area where the image data is stored in the data table. The storage device also includes a data storage area specifying module, which is configured to store the image data to be stored in the database through the following steps: Obtain the hash value of the storage area identifier based on the storage area identifier of the image data to be stored; Based on the hash value, the image data to be stored is stored in the data storage area specified by the storage area identifier in the data table.

8. The storage device according to claim 7, characterized in that, The storage device further includes an image data reading module, which is configured to read image data stored in the data storage system through the following steps: Receive a read request for image data to be read, and obtain the data type and storage area identifier of the image data to be read contained in the read request; Obtain the hash value of the storage area identifier; For each database, determine whether the database stores image data containing the data type based on the data type. If so, access the data storage area specified by the storage area identifier in the data table corresponding to the data type based on the hash value, and read the image data to be read.

9. A computer-readable storage medium storing a plurality of program codes, characterized in that, The program code is adapted to be loaded and run by a processor to perform the method for storing image data according to any one of claims 1-4.

10. A computer device comprising a processor and a memory, the memory being adapted to store multiple lines of program code, characterized in that, The program code is adapted to be loaded and run by the processor to perform the method for storing image data according to any one of claims 1-4.

Citation Information

Patent Citations

  • DATA STORAGE METHOD, device AND COMPUTER device

    CN109408509A

  • Data storage method, device and system, electronic equipment and readable storage medium

    CN112783445A