Disclosure of Invention
In view of the foregoing, it is desirable to provide a data storage method, an electronic device and a storage medium, which can save storage resources, reduce query time, and enable dynamic partition creation.
A method of data storage, the method comprising:
acquiring attribute data of a picture to be stored;
determining at least one partition type according to the attribute data of the picture to be stored;
calculating the number of the pictures to be stored corresponding to each partition type in the at least one partition type according to the attribute data of the pictures to be stored;
and generating a storage partition according to the number of the pictures to be stored corresponding to each partition type.
According to a preferred embodiment of the present invention, the determining at least one partition type according to the attribute data of the picture to be stored includes:
acquiring the object type in the picture to be stored;
acquiring a software version corresponding to the picture to be stored;
and combining the object type in the picture to be stored and the software version corresponding to the picture to be stored, and determining the at least one partition type.
According to a preferred embodiment of the present invention, the generating a storage partition according to the number of pictures to be stored corresponding to each partition type includes:
screening the partition types with the number of the pictures to be stored larger than a number threshold value according to the number of the pictures to be stored corresponding to each partition type;
and generating a storage partition corresponding to the screened partition type.
According to a preferred embodiment of the invention, the method further comprises:
when the storage partition is not generated and new picture data are received, storing the new picture data in a cache;
after the storage partition is established, acquiring target attribute data of the new picture data;
and storing the new picture data according to the target attribute data.
According to a preferred embodiment of the present invention, the storing the new picture data according to the target attribute data includes:
determining whether a target partition matching the target attribute data is stored in the storage partition;
when the target partition exists in the storage partition, storing the new picture data in the target partition;
generating the target partition when the target partition does not exist in the storage partition.
A data storage device, the device comprising:
the acquisition module is used for acquiring attribute data of the picture to be stored;
the determining module is used for determining at least one partition type according to the attribute data of the picture to be stored;
the calculation module is used for calculating the number of the pictures to be stored corresponding to each partition type in the at least one partition type according to the attribute data of the pictures to be stored;
and the generating module is used for generating storage partitions according to the number of the pictures to be stored corresponding to each partition type.
According to a preferred embodiment of the present invention, the determining, by the determining module, at least one partition type according to the attribute data of the picture to be stored includes:
acquiring the object type in the picture to be stored;
acquiring a software version corresponding to the picture to be stored;
and combining the object type in the picture to be stored and the software version corresponding to the picture to be stored, and determining the at least one partition type.
According to a preferred embodiment of the present invention, the generating, by the generating module, a storage partition according to the number of pictures to be stored corresponding to each partition type includes:
screening the partition types with the number of the pictures to be stored larger than a number threshold value according to the number of the pictures to be stored corresponding to each partition type;
and generating a storage partition corresponding to the screened partition type.
An electronic device comprising a memory for storing at least one instruction and a processor for executing the at least one instruction to implement the data storage method of any of the embodiments.
A computer readable storage medium having stored thereon at least one instruction which, when executed by a processor, implements the data storage method of any of the embodiments.
According to the technical scheme, the attribute data of the picture to be stored is acquired; determining at least one partition type according to the attribute data of the picture to be stored; calculating the number of the pictures to be stored corresponding to each partition type in the at least one partition type according to the attribute data of the pictures to be stored; and generating a storage partition according to the number of the pictures to be stored corresponding to each partition type. The invention can save storage resources, reduce query time and realize dynamic partition creation.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
FIG. 1 is a flow chart of a data storage method according to a preferred embodiment of the present invention. The order of the steps in the flow chart may be changed and some steps may be omitted according to different needs.
And S10, the electronic equipment acquires the attribute data of the picture to be stored.
In the present invention, the electronic device communicates with a plurality of terminal devices, including, but not limited to: the terminal equipment stores the captured pictures in the electronic equipment or a database communicated with the electronic equipment.
In a preferred embodiment of the present invention, the attribute data of the picture to be stored includes, but is not limited to: the type of the object, the software version corresponding to the picture to be stored, and the like. The object types include, but are not limited to: residents, police and comprehensive staff and key staff. The software version corresponding to the picture to be stored comprises an algorithm version used for capturing the picture to be stored.
The number of the pictures to be stored may be one or more. Therefore, the types of the objects in the picture to be stored may be various, and the software version corresponding to the picture to be stored may include a plurality of software versions.
S11, the electronic device determines at least one partition type according to the attribute data of the picture to be stored.
In a preferred embodiment of the present invention, one storage partition corresponds to one partition type, and each partition type is obtained by combining according to the attribute data of the picture to be stored. For example, the first storage partition is used for storing the pictures of the ensemble personnel and the software version V1.0, the second storage partition is used for storing the pictures of the ensemble personnel and the software version V2.0, and the like. Wherein the attribute data includes, but is not limited to: object type and software version.
Preferably, the determining at least one partition type according to the attribute data of the picture to be stored includes:
(a1) and acquiring the object type in the picture to be stored.
(a2) And acquiring a software version corresponding to the picture to be stored.
(a3) And combining the object type in the picture to be stored and the software version corresponding to the picture to be stored, and determining the at least one partition type.
The number of the at least one partition type is multiple because there may be multiple types of objects in the picture to be stored, and the software version corresponding to the picture to be stored may include multiple software versions. For example, if there are 6 types of object types in the picture to be stored and there are 2 types of software versions corresponding to the picture to be stored, the number of the at least one partition type is 12.
And S12, the electronic device calculates the number of the pictures to be stored corresponding to each partition type in the at least one partition type according to the attribute data of the pictures to be stored.
In a preferred embodiment of the present invention, since the number of pictures to be stored corresponding to a possible partition type in the at least one partition type is 0, the number of pictures to be stored corresponding to each partition type needs to be counted, so as to exclude the partition type with the number of pictures to be stored being 0.
And S13, the electronic equipment generates a storage partition according to the number of the pictures to be stored corresponding to each partition type.
In a preferred embodiment of the present invention, the generating a storage partition according to the number of pictures to be stored corresponding to each partition type includes:
(b1) and screening the partition types with the number of the pictures to be stored larger than a number threshold value according to the number of the pictures to be stored corresponding to each partition type.
Preferably, the number threshold is 0.
(b2) And generating a storage partition corresponding to the screened partition type.
And each screened partition type corresponds to one storage partition, and the picture to be stored is stored in the corresponding storage partition according to the attribute data of the picture to be stored. For example, if a certain partition type is a combination of the ensemble personnel and the software version V1.0, the certain partition type corresponds to the storage partition for storing the pictures of the ensemble personnel and the software version V1.0. Each storage partition generated in this way stores pictures, and a storage partition with the number of pictures of 0 does not need to be generated, so that storage resources are saved. In addition, in the query process, because the storage partitions with the picture number of 0 are not generated, the storage partitions with the picture number of 0 are not queried, so that the time is saved.
Preferably, when the storage partition is not generated and new picture data is received, the method further includes:
(c1) and storing the new picture data in a cache.
(c2) And acquiring target attribute data of the new picture data after the storage partition is established.
(c3) And storing the new picture data according to the target attribute data.
Preferably, the storing the new picture data according to the target attribute data includes:
(c31) determining whether a target partition matching the target attribute data is stored in the storage partition.
And matching the partition type of the target partition with the partition type of each storage partition in the storage partitions, and determining that the target partition exists in the storage partitions when one partition type in the storage partitions is the same as the partition type of the target partition. Determining that the target partition does not exist in the storage partition when none of the partition types in the storage partition is the same as the partition type of the target partition.
(c32) When the target partition exists in the storage partition, storing the new picture data in the target partition.
(c33) Generating the target partition when the target partition does not exist in the storage partition.
Through the embodiment, the partition can be dynamically established according to the object type of the data and the software version corresponding to the data, so that the partition can be dynamically established.
The method includes the steps that attribute data of a picture to be stored are obtained; determining at least one partition type according to the attribute data of the picture to be stored; calculating the number of the pictures to be stored corresponding to each partition type in the at least one partition type according to the attribute data of the pictures to be stored; and generating a storage partition according to the number of the pictures to be stored corresponding to each partition type. The invention can save storage resources, reduce query time and realize dynamic partition creation.
Referring to FIG. 3, a functional block diagram of a preferred embodiment of the data storage device of the present invention is shown. Thedata storage device 11 includes an obtainingmodule 100, a determiningmodule 101, a calculatingmodule 102, agenerating module 103, and astoring module 104. The unit referred to in the present invention refers to a series of computer program segments, stored in a memory, that can be executed by a processor of thedata storage device 11 and that can perform a fixed function. In the present embodiment, the functions of the units will be described in detail in the following embodiments.
The obtainingmodule 100 obtains attribute data of a picture to be stored.
In the present invention, the electronic device communicates with a plurality of terminal devices, including, but not limited to: the terminal equipment stores the captured pictures in the electronic equipment or a database communicated with the electronic equipment.
In a preferred embodiment of the present invention, the attribute data of the picture to be stored includes, but is not limited to: the type of the object, the software version corresponding to the picture to be stored, and the like. The object types include, but are not limited to: residents, police and comprehensive staff and key staff. The software version corresponding to the picture to be stored comprises an algorithm version used for capturing the picture to be stored.
The number of the pictures to be stored may be one or more. Therefore, the types of the objects in the picture to be stored may be various, and the software version corresponding to the picture to be stored may include a plurality of software versions.
And the electronic equipment determines at least one partition type according to the attribute data of the picture to be stored.
In a preferred embodiment of the present invention, one storage partition corresponds to one partition type, and each partition type is obtained by combining according to the attribute data of the picture to be stored. For example, the first storage partition is used for storing the pictures of the ensemble personnel and the software version V1.0, the second storage partition is used for storing the pictures of the ensemble personnel and the software version V2.0, and the like. Wherein the attribute data includes, but is not limited to: object type and software version.
Preferably, the determiningmodule 101 determines at least one partition type according to the attribute data of the picture to be stored, including:
(a1) and acquiring the object type in the picture to be stored.
(a2) And acquiring a software version corresponding to the picture to be stored.
(a3) And combining the object type in the picture to be stored and the software version corresponding to the picture to be stored, and determining the at least one partition type.
The number of the at least one partition type is multiple because there may be multiple types of objects in the picture to be stored, and the software version corresponding to the picture to be stored may include multiple software versions. For example, if there are 6 types of object types in the picture to be stored and there are 2 types of software versions corresponding to the picture to be stored, the number of the at least one partition type is 12.
The calculatingmodule 102 calculates the number of the pictures to be stored corresponding to each partition type in the at least one partition type according to the attribute data of the pictures to be stored.
In a preferred embodiment of the present invention, since the number of pictures to be stored corresponding to a possible partition type in the at least one partition type is 0, the number of pictures to be stored corresponding to each partition type needs to be counted, so as to exclude the partition type with the number of pictures to be stored being 0.
Thegenerating module 103 generates storage partitions according to the number of pictures to be stored corresponding to each partition type.
In a preferred embodiment of the present invention, thegenerating module 103 generates the storage partition according to the number of the pictures to be stored corresponding to each partition type, including:
(b1) and screening the partition types with the number of the pictures to be stored larger than a number threshold value according to the number of the pictures to be stored corresponding to each partition type.
Preferably, the number threshold is 0.
(b2) And generating a storage partition corresponding to the screened partition type.
And each screened partition type corresponds to one storage partition, and the picture to be stored is stored in the corresponding storage partition according to the attribute data of the picture to be stored. For example, if a certain partition type is a combination of the ensemble personnel and the software version V1.0, the certain partition type corresponds to the storage partition for storing the pictures of the ensemble personnel and the software version V1.0. Each storage partition generated in this way stores pictures, and a storage partition with the number of pictures of 0 does not need to be generated, so that storage resources are saved. In addition, in the query process, because the storage partitions with the picture number of 0 are not generated, the storage partitions with the picture number of 0 are not queried, so that the time is saved.
Preferably, when the storage partition is not generated and new picture data is received, the apparatus further includes:
thestorage module 104 stores the new picture data in a cache.
The obtainingmodule 100 obtains the target attribute data of the new picture data after the storage partition is established.
Thestorage module 104 stores the new picture data according to the target attribute data.
Preferably, thestoring module 104 stores the new picture data according to the target attribute data, including:
(c31) determining whether a target partition matching the target attribute data is stored in the storage partition.
And matching the partition type of the target partition with the partition type of each storage partition in the storage partitions, and determining that the target partition exists in the storage partitions when one partition type in the storage partitions is the same as the partition type of the target partition. Determining that the target partition does not exist in the storage partition when none of the partition types in the storage partition is the same as the partition type of the target partition.
(c32) When the target partition exists in the storage partition, storing the new picture data in the target partition.
(c33) Generating the target partition when the target partition does not exist in the storage partition.
Through the embodiment, the partition can be dynamically established according to the object type of the data and the software version corresponding to the data, so that the partition can be dynamically established.
The method includes the steps that attribute data of a picture to be stored are obtained; determining at least one partition type according to the attribute data of the picture to be stored; calculating the number of the pictures to be stored corresponding to each partition type in the at least one partition type according to the attribute data of the pictures to be stored; and generating a storage partition according to the number of the pictures to be stored corresponding to each partition type. The invention can save storage resources, reduce query time and realize dynamic partition creation.
The integrated unit implemented in the form of a software functional module may be stored in a computer-readable storage medium. The software functional module is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to execute some steps of the method according to each embodiment of the present invention.
As shown in fig. 3, theelectronic device 3 comprises at least one transmitting means 31, at least onememory 32, at least one processor 33, at least one receiving means 34 and at least one communication bus. Wherein the communication bus is used for realizing connection communication among the components.
Theelectronic device 3 is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and its hardware includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like. Theelectronic device 3 may also comprise a network device and/or a user device. Wherein the network device includes, but is not limited to, a single network server, a server group consisting of a plurality of network servers, or a Cloud Computing (Cloud Computing) based Cloud consisting of a large number of hosts or network servers, wherein Cloud Computing is one of distributed Computing, a super virtual computer consisting of a collection of loosely coupled computers.
Theelectronic device 3 may be, but is not limited to, any electronic product that can perform human-computer interaction with a user through a keyboard, a touch pad, a voice control device, or the like, for example, a tablet computer, a smart phone, a Personal Digital Assistant (PDA), an intelligent wearable device, an image pickup device, a monitoring device, or other terminals.
The Network where theelectronic device 3 is located includes, but is not limited to, the internet, a wide area Network, a metropolitan area Network, a local area Network, a Virtual Private Network (VPN), and the like.
The receivingdevice 34 and the transmittingdevice 31 may be wired transmitting ports, or may be wireless devices, for example, including antenna devices, for performing data communication with other devices.
Thememory 32 is used to store program code. TheMemory 32 may be a circuit having a storage function, such as a RAM (Random-Access Memory), a FIFO (First In First Out), or the like, which is not In a physical form In the integrated circuit. Alternatively, thememory 32 may be a memory in a physical form, such as a memory bank, a TF Card (Trans-flash Card), a smart media Card (smart media Card), a secure digital Card (secure digital Card), a flash memory Card (flash Card), and so on.
The processor 33 may comprise one or more microprocessors, digital processors. The processor 33 may call program code stored in thememory 32 to perform the associated functions. For example, the units illustrated in fig. 2 are program codes stored in thememory 32 and executed by the processor 33 to implement a data storage method. The processor 33 is also called a Central Processing Unit (CPU), and is an ultra-large scale integrated circuit, which is an operation Core (Core) and a Control Core (Control Unit).
Embodiments of the present invention also provide a computer-readable storage medium having stored thereon computer instructions, which, when executed by an electronic device comprising one or more processors, cause the electronic device to perform a data storage method as described above for the method embodiments.
As described in connection with fig. 1, thememory 32 in the electronic device 1 stores a plurality of instructions to implement a data storage method, and the processor 33 can execute the plurality of instructions to implement:
acquiring attribute data of a picture to be stored; determining at least one partition type according to the attribute data of the picture to be stored; calculating the number of the pictures to be stored corresponding to each partition type in the at least one partition type according to the attribute data of the pictures to be stored; and generating a storage partition according to the number of the pictures to be stored corresponding to each partition type.
In any embodiment, a plurality of instructions corresponding to the data storage method are stored in thememory 32 and executed by the processor 33, which will not be described in detail herein.
The above-described characteristic means of the present invention may be realized by an integrated circuit and control functions of realizing the data storage method described in any of the above-described embodiments. That is, the integrated circuit according to the present invention is mounted on the electronic device, and causes the electronic device to function as:
acquiring attribute data of a picture to be stored; determining at least one partition type according to the attribute data of the picture to be stored; calculating the number of the pictures to be stored corresponding to each partition type in the at least one partition type according to the attribute data of the pictures to be stored; and generating a storage partition according to the number of the pictures to be stored corresponding to each partition type.
The functions that can be realized by the data storage method in any embodiment can be installed in the electronic device through the integrated circuit of the present invention, so that the electronic device can perform the functions that can be realized by the data storage method in any embodiment, and therefore, the detailed description is omitted here.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus may be implemented in other manners. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implementing, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of some interfaces, devices or units, and may be an electric or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.