A storage method, device, electronic device and storage medium for image data
By converting image data into target data within the target interval and storing it in the form of symbolic bits, exponential bits and mantissa digits, the memory restriction problem in face recognition due to the large amount of data is solved, and efficient image data storage and real-time performance of face recognition services is achieved.
Patent Information
- Application Number
- CN202111555142.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-17
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2041-12-17
AI Technical Summary
During the face recognition process, if the relevant data of the face image is too large, it will lead to memory limitations of the machine, and the data needs to be read multiple times, which will reduce the comparison efficiency and affect the real-time nature of the dynamic face recognition service.
By acquiring the image data to be stored, the target interval and the specified sub-interval are determined according to the preset target storage number, the image data is converted into the target data within the target interval, and stored in the form of symbol bits, exponential bits and mantissa bits to ensure that the data is not distorted.
Without distortion, this method reduces the storage usage of image data, improves memory utilization, reduces the memory consumption of face recognition services, and improves the real-time performance of dynamic face recognition.
Smart Images

Figure CN114282026B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer data processing technologies, particularly to the fields of computer vision and computer graphics image processing, and more particularly to a method, apparatus, electronic device, and storage medium for storing images. Background Art
[0002] In recent years, with the development of technology, face recognition has been widely applied. During the process of face recognition, it is necessary to read the relevant data of the registered face images from a database, obtain face features therefrom, and then compare them with the face in a real-time photo. If the relevant data of the face image is small, it means that the face feature data is less, and the features obtained therefrom are very rough. It is difficult to obtain an accurate comparison result based on such rough features; however, if the relevant data of the face image is huge, due to the limitation of the machine memory, it is necessary to read the relevant data multiple times for comparison, which will reduce the comparison efficiency and thus affect the real-time performance of dynamic face recognition services. Summary of the Invention
[0003] The present disclosure provides a method, apparatus, electronic device, and storage medium for storing image data.
[0004] According to one aspect of the present disclosure, there is provided a method for storing image data, including:
[0005] Obtaining the image data to be stored;
[0006] Determining a target interval according to a preset target storage bit number, and determining a specified sub-interval within the target interval according to a specified value;
[0007] Converting the image data into target data whose value belongs to the target interval;
[0008] Storing the data belonging to the specified sub-interval in the target data in a first type; wherein the first type is that the data includes a first sign bit, an exponent bit, and a first mantissa bit, and the total number of the three is equal to the target storage bit number.
[0009] According to another aspect of the present disclosure, there is provided an apparatus for storing image data, including:
[0010] A data acquisition module, configured to obtain the image data to be stored;
[0011] An interval determination module, configured to determine a target interval according to a preset target storage bit number, and determine a specified sub-interval within the target interval according to a specified value;
[0012] A data conversion module, configured to convert the image data into target data whose value belongs to the target interval;
[0013] A first storage module for storing data belonging to the specified sub-interval in the target data in a first format, where the first format is that the data includes a first sign bit, an exponent bit, and a first mantissa bit, and the total number of bits of the three is equal to the target storage bit number.
[0014] According to another aspect of the present disclosure, there is provided an electronic device, including:
[0015] At least one processor; and
[0016] A memory communicatively connected to the at least one processor; wherein,
[0017] The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method in any embodiment of the present disclosure.
[0018] According to another aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute the method in any embodiment of the present disclosure.
[0019] According to another aspect of the present disclosure, there is provided a computer program product, including computer programs / instructions, characterized in that when the computer programs / instructions are executed by a processor, the method in any embodiment of the present disclosure is implemented.
[0020] The technology of the present disclosure first obtains the image data to be stored, then determines the target interval and the specified sub-interval according to the preset target storage bit number, and then adopts different storage forms for data in different intervals, and on the premise that the storage bit number can be flexibly changed according to actual needs, it maximally ensures that the image data is not distorted.
[0021] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The drawings are used to better understand the solution and do not constitute a limitation to the present disclosure. Among them:
[0023] Figure 1 is a schematic flowchart of a method for storing image data according to an embodiment of the present disclosure;
[0024] Figure 2 is a schematic diagram of the storage form of image data according to an embodiment of the present disclosure;
[0025] Figure 3 is a schematic diagram of the storage result of image data according to an embodiment of the present disclosure;
[0026] Figure 4 is a schematic flowchart of a method for storing image data according to another embodiment of the present disclosure;
[0027] Figure 5 is a schematic diagram of the storage form of image data according to another embodiment of the present disclosure;
[0028] Figure 6 is a schematic diagram of the storage result of image data according to another embodiment of the present disclosure;
[0029] Figure 7 is a schematic diagram of a storage device for image data according to an embodiment of the present disclosure;
[0030] Figure 8 is a schematic diagram of a storage device for image data according to another embodiment of the present disclosure;
[0031] Figure 9 is a block diagram of an electronic device for implementing the method for storing image data in the embodiments of the present disclosure. Detailed Embodiments
[0032] The following describes exemplary embodiments of the present disclosure with reference to the accompanying drawings. Various details of the embodiments of the present disclosure are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for clarity and conciseness, descriptions of well-known functions and structures are omitted below.
[0033] As used herein, the term "and / or" merely describes an association relationship between associated objects and indicates that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. The term "at least one" as used herein means any one of a plurality or any combination of at least two of a plurality. For example, including at least one of A, B, and C can represent including any one or more elements selected from the set composed of A, B, and C. The terms "first" and "second" as used herein represent referring to multiple similar technical terms and distinguishing them, and do not mean to limit the order or limit to only two. For example, the first feature and the second feature refer to two categories / two features. The first feature can be one or more, and the second feature can also be one or more.
[0034] In addition, to better illustrate the present disclosure, numerous specific details are provided in the following detailed implementation manners. Those skilled in the art should understand that the present disclosure can also be implemented without some specific details. In some instances, methods, means, elements, and circuits well-known to those skilled in the art are not described in detail to highlight the gist of the present disclosure.
[0035] In recent years, with the development of technology, the application of face recognition is very extensive. In face recognition technology, a face image needs to extract a floating-point type face feature vector (i.e., relevant data of the face picture) through a face recognition model, and the similarity between two faces is obtained by calculating the cosine distance between two face feature vectors. Therefore, an excellent face recognition model needs to output enough features to ensure the accuracy of face recognition.
[0036] In some specific scenarios, such as the dynamic face recognition scenario that is currently being widely studied, in order to complete non-intrusive recognition, the camera needs to collect data in real time for M:N recognition, where M represents the number of faces in the image collected by the camera in real time, and N represents the number of all registered faces in this scenario. When N is relatively large, because the registered face data needs to be downloaded to the memory first for subsequent comparison, the memory of the computer will be challenged to a certain extent. Specifically, currently, the following two schemes are generally adopted in face recognition technology to complete face similarity calculation:
[0037] (1) Read all the registered face feature vectors into the memory before the face recognition service starts.
[0038] (2) Read the registered face features from the database in batches during face recognition.
[0039] It should be noted that the face feature data in the above two schemes are all stored in floating-point type.
[0040] The application scenario of Scheme (1) can only be the scenario where the data size of all registered face feature vectors is within the machine memory range. If the data volume is too large, this scheme cannot be used.
[0041] Although Scheme (2) can be applied to scenarios with a large amount of data, due to the limitation of the machine memory, data needs to be read from the database to the memory in batches for similarity calculation, which will affect the real-time performance of the dynamic face recognition service.
[0042] In view of the fact that the existing technology cannot solve the problem of machine resources faced by a large number of registered users in large-scale scenarios, and this problem has to a certain extent hindered the widespread implementation of dynamic face recognition. Currently, most application scenarios adopt identity document-assisted recognition. In future life, with the popularization of electronic identity documents, the dynamic face recognition technology is bound to be widely applied. In such a trend, it is particularly important to propose a compression method for floating-point type image data to reduce the memory occupancy of face extraction features.
[0043] The present disclosure proposes a compression storage scheme for floating-point type image data aiming at how to reduce the memory consumption of a large number of face features. This compression storage scheme can be used for any product or project with a large amount of floating-point data calculation requirements.
[0044] According to an embodiment of the present disclosure, a storage method for image data is provided. Figure 1 FIG. is a schematic flowchart of a storage method for image data according to an embodiment of the present disclosure, specifically including:
[0045] S101: Obtain the image data to be stored;
[0046] In one example, the image data is a feature vector of floating-point data type. Of course, it can also be other forms of image data, such as data corresponding to image pixels, etc., which are not specifically limited herein.
[0047] S102: Determine a target interval according to a preset target storage bit number, and determine a specified sub-interval within the target interval according to a specified value;
[0048] In one example, the target interval is the numerical range that can be stored by this storage scheme. Specifically, the limit value that can be stored can be determined according to the preset target storage bit number; then, the target interval is determined according to the limit value. On the premise of limiting the target storage bit number and determining the storage format, the limit value that can be stored in the target storage bit number can be calculated. For example, if the target storage bit is determined to be 16 bits, and then the exponent bit is determined to be 4 bits according to the target storage bit, the maximum value that can be represented by the 4-bit exponent bit in binary is 2 8 , and the minimum value is -2 8 , thereby determining that the range of the target interval is [-2 8 , 2 8 . In this example, binary is used for illustration. In the specific use process, no matter it is hexadecimal or duodecimal, this method can be used to first determine the limit value that can be stored, and then determine the range of the target interval. Through the above scheme, first determine the numerical range that can be represented by the target storage bit number, and prepare to specially process the data exceeding this range, which can ensure that the data stored by this scheme is not distorted.
[0049] In one example, in the target interval, an interval with an absolute value not less than a specified value is determined as a specified sub-interval. In the subsequent storage step, in order to store data as faithfully as possible, according to the numerical values, they are divided into two different ranges and stored in different forms respectively. The specified value is a specific value set according to the storage requirements and is used to divide the target interval into at least two different ranges. Specifically, the specified value can be 1, that is, data with an absolute value not less than 1 is divided into the specified sub-interval. Through this division method, the target interval can be divided into at least two different sub-intervals, and then corresponding storage methods can be adopted according to the characteristics of the numerical values in each interval, which can achieve the effect of data fidelity.
[0050] S103: Convert the image data into target data whose values belong to the target interval;
[0051] In one example, for all the image data of an entire image, it is determined whether all the image data are within the target interval. If so, the image data are directly used as the target data; if not, all the image data are uniformly processed to be converted into the target data within the target interval.
[0052] In one example, the mean and standard deviation of all the image data are obtained; then normalization is performed using the mean and standard deviation to generate target data whose values belong to the target interval. It should be emphasized that the number of target data is equal to the number of all the image data before conversion. For example, if there are N pieces of all the image data before conversion, then there are also N pieces of target data after conversion. Specifically, the normalization can adopt the Z-score standardization method, which standardizes the data according to the mean and standard deviation of the original data. Its conversion function is: x* = (x - μ) / σ, where μ is the mean of all the sample data and σ is the standard deviation of all the sample data. The processed data conforms to the standard normal distribution, that is, the mean is 0 and the standard deviation is 1. By normalizing the image data into the target interval, the cosine distance or the difference in the inner product results between the image samples can be increased, and the discrimination ability is stronger, which is an inherent advantage for image recognition. And the processed image feature data conforms to the normal distribution, which not only retains the correlation between the image features but also can reduce the weights of unimportant feature data or noise data. To sum up, although there is a certain loss in data accuracy during normalization, it can play a positive role in the process of image recognition and improve the recognition accuracy.
[0053] S104: Store the data in the target data that belongs to the specified sub-interval in the first type; where the first type is that the data includes a first sign bit, an exponent bit, and a first mantissa bit, and the total number of the three is equal to the target storage bit number.
[0054] In one example, the storage bit numbers of the first type, from high to low, are the first sign bit, the exponent bit, and the first mantissa bit. The first sign bit is used to represent whether the target data is positive or negative, the exponent bit is used to store the exponent, and the sum of the bit numbers of the first sign bit, the exponent bit, and the first mantissa bit is equal to the target storage bit number;
[0055] In one example, the first sign bit is set to a specified identifier to represent whether the data is positive or negative; the value of the exponent bit is set to be obtained by adding a preset constant to the exponent value of the data in scientific notation form, and the preset constant is related to the bit number of the exponent bit; the value of the first mantissa bit is set to the binary representation of the mantissa value of the data in scientific notation form. Specifically, taking the target storage bit number as 2 bytes (16 bits) and the specified subinterval being (-2 8 , -1] ∪ [1, +2 8 ), and taking binary form storage as an example, as Figure 2 shown, the highest bit in the memory is the first sign bit set to 1 bit, 0 represents a positive number, and 1 represents a negative number; next is the exponent bit set to 4 bits, representing the exponent when expressed in scientific notation. Since scientific notation uses binary representation, with a base of 2, to solve the problem of not being able to store negative exponents, an offset of 7 needs to be added when converting the true value of the exponent to the exponent bit here and then converted to binary form; finally is the first mantissa bit of 11 bits, representing the binary form of the fractional part when using scientific notation. If using the above first type to store the image data 2.5 in 2 bytes, it is: 1010110011001100. By adopting this solution, the image data can be flexibly stored in a selected manner and the accuracy of the image data can be guaranteed to the greatest extent.
[0056] Figure 3 The comparison shows the storage of 2.5 in 4 bytes using the existing technology, i.e., single-precision floating-point, and the storage of 2.5 in 2 bytes using this solution.
[0057] In one example, the image data stored in 4 bytes using the existing technology is selected as the first sample, then the method of the present disclosure is selected, and the image data stored in 2 bytes is selected as the second sample. Then, the first sample and the second sample are compared in terms of features. The results are shown in Table 1. It can be seen that the data occupied in memory after compression according to this solution is reduced by 50%, while the recognition rate is only reduced by less than 2%. That is, on the basis of greatly saving space occupancy, the impact on the calculation result is very small and can meet the expectations.
[0058] Table 1 Comparison table of resource consumption for image data storage
[0059]
[0060] In summary, the solution of the present disclosure can design the target storage bits according to specific requirements and store the image data according to the target storage bits. In particular, when the memory is insufficient, the image data can be greatly compressed. Moreover, the compressed image data can maximize the fidelity without affecting subsequent feature extraction or recognition.
[0061] According to an embodiment of the present disclosure, there is also provided a method for storing image data. Figure 4 It is a schematic flowchart of a method for storing image data according to another embodiment of the present disclosure, specifically including:
[0062] S401: Obtain the image data to be stored;
[0063] S402: Determine the target interval according to the preset target storage bits, and determine the specified sub-interval within the target interval according to the specified value;
[0064] S403: Convert the image data into target data whose value belongs to the target interval;
[0065] S404: Store the data belonging to the specified sub-interval in the target data in a first type; wherein, the first type is that the data includes a first sign bit, an exponent bit, and a first mantissa bit, and the total number of the three is equal to the target storage bits.
[0066] The specific implementation manners of the above S401 - S404 are the same as those of S101 - S104, and will not be elaborated here.
[0067] S405: Store the data not belonging to the specified sub-interval in the target data in a second type; wherein, the second type is that the data includes a second sign bit and a second mantissa bit, and the total number of the two is equal to the target storage bits.
[0068] In an example, if the specified sub-interval is (-2 8 , -1] ∪ [1, +2 8 ), then if the target data is within the range of (-1, 1), it does not belong to the specified sub-interval, and the second type is used for storage. By partitioning, the data can be stored according to the data characteristics in different partitions, which improves both the storage efficiency and the data fidelity.
[0069] In an example, the second sign bit is set as a specified identifier to represent whether the data is positive or negative; the value of the second mantissa bit is set as the binary representation of the data. Specifically, taking the target storage bits as 2 bytes (16 bits) and the value of the target data as -0.35 as an example, first, as Figure 5 shown, the highest bit in the memory is set as the second sign bit with 1 bit, 0 represents positive, and 1 represents negative; the second mantissa bit is to convert the target decimal part into binary. Figure 6The comparison shows the storage of -0.35 in 4 bytes using the existing single-precision floating point, and the storage of -0.35 in 2 bytes using the present solution. It can be seen that with the present solution, according to actual requirements, the target storage bit number can be selected for storage. If the target storage bit number is relatively small, the byte occupancy during storage can be greatly reduced, thereby saving storage space and improving the efficiency of data transmission and use.
[0070] In one example, converting the image data into target data whose values belong to the target interval can also be: extracting features from the image data. Specifically, if the image data is pixel data, its vector features are extracted, and the vector features are floating-point data; then, the extracted feature data is converted into target data belonging to the target interval. With the above solution, vector features can be obtained from any image-related data, and then stored based on the obtained vector features.
[0071] As Figure 7 shown, an image data storage device 700 is provided in an embodiment of the present disclosure. The device includes:
[0072] A data acquisition module 701, configured to acquire image data to be stored;
[0073] An interval determination module 702, configured to determine a target interval according to a preset target storage bit number, and determine a specified sub-interval within the target interval according to a specified value;
[0074] A data conversion module 703, configured to convert the image data into target data whose values belong to the target interval;
[0075] A first storage module 704, configured to store the data belonging to the specified sub-interval in the target data in a first type, where the first type is that the data includes a first sign bit, an exponent bit, and a first mantissa bit, and the total number of the three is equal to the target storage bit number.
[0076] As Figure 8 shown, another image data storage device 800 is provided in an embodiment of the present disclosure. The device includes:
[0077] A data acquisition module 801, configured to acquire image data to be stored;
[0078] An interval determination module 802, configured to determine a target interval according to a preset target storage bit number, and determine a specified sub-interval within the target interval according to a specified value;
[0079] A data conversion module 803, configured to convert the image data into target data whose values belong to the target interval;
[0080] The first storage module 804 is used to store the data belonging to the specified sub-interval in the target data in a first type, where the first type is that the data includes a first sign bit, an exponent bit, and a first mantissa bit, and the total number of bits of the three is equal to the target storage bit number.
[0081] The second storage module 805 is used to store the data that does not belong to the specified sub-interval in the target data in a second type; where the second type is that the data includes a second sign bit and a second mantissa bit and the total number of bits of the two is equal to the target storage bit number.
[0082] In one example, the interval determination module in the above device is used to:
[0083] In the target interval, determine the interval with an absolute value not less than the specified value as the specified sub-interval.
[0084] In one example, the above device 700 further includes:
[0085] The first sign bit setting module is used to set the first sign bit to a specified identifier to represent that the data is positive or negative;
[0086] The exponent bit setting module is used to set the value of the exponent bit to be obtained by adding a preset constant to the exponent value of the data in scientific notation form, and the preset constant is related to the number of bits of the exponent bit;
[0087] The first mantissa bit setting module is used to set the value of the first mantissa bit to the binary representation of the mantissa value of the data in scientific notation form.
[0088] In one example, the above device 800 further includes:
[0089] The second sign bit setting module is used to set the second sign bit to a specified identifier to represent that the data is positive or negative;
[0090] The second mantissa bit setting module is used to set the value of the second mantissa bit to the binary representation of the data.
[0091] In one example, the interval determination module in any of the above devices is used to:
[0092] Determine the limit value that can be stored according to the preset target storage bit number;
[0093] Determine the target interval according to the limit value.
[0094] In one example, the interval determination module in any of the above devices is used to:
[0095] Obtain the mean value and standard deviation of the image data;
[0096] Normalize using the mean value and the standard deviation to generate target data whose values belong to the target interval.
[0097] In one example, the data conversion module in any of the above devices is configured to:
[0098] Extract features from the image data;
[0099] Convert the extracted feature data into target data belonging to the target interval.
[0100] For the functions of the modules in each device of the embodiments of the present disclosure, reference may be made to the corresponding descriptions in the above methods, and details are not described herein again.
[0101] In the technical solution of the present disclosure, the acquisition, storage, and application of the user's personal information involved all comply with the provisions of relevant laws and regulations and do not violate public order and good customs.
[0102] According to the embodiments of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0103] Figure 9 FIG. shows a schematic block diagram of an exemplary electronic device 800 that can be used to implement the embodiments of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as, a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, a personal digital processor, a cellular phone, a smart phone, a wearable device, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0104] As Figure 9 shown, the device 900 includes a computing unit 901, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 902 or a computer program loaded from a storage unit 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the device 900 can also be stored. The computing unit 901, the ROM 902, and the RAM 903 are connected to each other through a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0105] Multiple components in device 900 are connected to I / O interface 905, including: input unit 906, such as a keyboard, mouse, etc.; output unit 907, such as various types of displays, speakers, etc.; storage unit 908, such as a disk, optical disc, etc.; and communication unit 909, such as a network card, modem, wireless communication transceiver, etc. Communication unit 909 allows device 900 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0106] Computing unit 901 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of computing unit 901 include but are not limited to a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Computing unit 901 executes the various methods and processes described above, such as the storage of method image data. For example, in some embodiments, the storage of method image data can be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as storage unit 908. In some embodiments, part or all of the computer program can be loaded and / or installed onto device 900 via ROM 902 and / or communication unit 909. When the computer program is loaded into RAM 903 and executed by computing unit 901, one or more steps of the storage of method image data described above can be executed. Alternatively, in other embodiments, computing unit 901 can be configured to execute the storage of method image data in any other suitable manner (e.g., by means of firmware).
[0107] The various embodiments of the systems and techniques described above in this document can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGA), application-specific integrated circuits (ASIC), application-specific standard products (ASSP), system-on-chip systems (SOC), complex programmable logic devices (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special-purpose or general-purpose programmable processor, and can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit the data and instructions to the storage system, the at least one input device, and the at least one output device.
[0108] The program code for implementing the methods of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing devices, such that when executed by the processor or controller, the program codes cause the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program codes can be executed entirely on the machine, partially on the machine, as a stand-alone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0109] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0110] In order to provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and the input from the user can be received in any form (including acoustic input, speech input, or tactile input).
[0111] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected to each other by digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include: local area network (LAN), wide area network (WAN), and the Internet.
[0112] A computer system can include a client and a server. The client and the server are generally far from each other and typically interact through a communication network. The client-server relationship is created by computer programs that run on the respective computers and have a client-server relationship with each other. The server can be a cloud server, a server of a distributed system, or a server integrated with a blockchain.
[0113] It should be understood that various forms of the processes shown above can be used, steps can be reordered, added, or deleted. For example, the steps recited in this disclosure can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved. There is no limitation herein.
[0114] The above specific embodiments do not constitute a limitation on the protection scope of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the protection scope of this disclosure.
Claims
1. A method for storing image data, including: Obtaining the image data to be stored; Determining a target interval according to a preset target storage bit number, and determining a specified sub-interval within the target interval where the absolute value is not less than a specified value; Converting the image data into target data whose value belongs to the target interval; Storing the data in the target data that belongs to the specified sub-interval in a first type; wherein, the first type is data including a first sign bit, an exponent bit, and a first mantissa bit, and the total number of bits of the three is equal to the target storage bit number; Setting the first sign bit to a specified identifier to represent that the data is positive or negative; Setting the value of the exponent bit to be obtained by adding a preset constant to the exponent value of the data in scientific notation form, and the preset constant is related to the number of bits of the exponent bit; Setting the value of the first mantissa bit to the binary representation of the mantissa value of the data in scientific notation form.
2. The method according to claim 1, further including: Storing the data in the target data that does not belong to the specified sub-interval in a second type; wherein, the second type is data including a second sign bit and a second mantissa bit, and the total number of bits of the two is equal to the target storage bit number; Setting the second sign bit to a specified identifier to represent that the data is positive or negative; Setting the value of the second mantissa bit to the binary representation of the data.
3. The method according to claim 1, wherein, The determining of the target interval according to the preset target storage bit number includes: Determining the limit value that can be stored according to the preset target storage bit number; Determining the target interval according to the limit value.
4. The method according to claim 1, wherein, The converting of the image data into target data whose value belongs to the target interval includes: Obtaining the mean value and standard deviation of the image data; Performing normalization using the mean value and standard deviation to generate target data whose value belongs to the target interval.
5. The method according to claim 1, wherein, The converting of the image data into target data whose value belongs to the target interval includes: Performing feature extraction on the image data; Converting the extracted feature data into target data belonging to the target interval.
6. An image data storage device, including: A data acquisition module for acquiring the image data to be stored; An interval determination module for determining a target interval according to a preset target storage bit number, and determining a specified sub-interval within the target interval where the absolute value is not less than a specified value; A data conversion module for converting the image data into target data whose value belongs to the target interval; A first storage module for storing the data in the target data that belongs to the specified sub-interval in a first type, wherein, the first type is data including a first sign bit, an exponent bit, and a first mantissa bit, and the total number of bits of the three is equal to the target storage bit number; A first sign bit setting module for setting the first sign bit to a specified identifier to represent that the data is positive or negative; An exponent bit setting module, configured to set the value of the exponent bit to be obtained by adding a preset constant to the exponent value of the data in scientific notation, where the preset constant is related to the number of bits of the exponent bit; A first mantissa bit setting module, configured to set the value of the first mantissa bit to the binary representation of the mantissa value of the data in scientific notation.
7. The apparatus according to claim 6, further comprising: A second storage module, configured to store the data in the target data that does not belong to the specified sub-interval in a second type; wherein, the second type of data includes a second sign bit and a second mantissa bit, and the total number of bits of the two is equal to the target storage bit number; A second sign bit setting module, configured to set the second sign bit to a specified identifier to represent that the data is positive or negative; A second mantissa bit setting module, configured to set the value of the second mantissa bit to the binary representation of the data.
8. The apparatus according to claim 6, wherein, the interval determination module is configured to: Determine the limit value that can be stored according to the preset target storage bit number; Determine the target interval according to the limit value.
9. The apparatus according to claim 6, wherein, the data conversion module is configured to: Obtain the mean value and standard deviation of the image data; Perform normalization using the mean value and standard deviation to generate target data whose values belong to the target interval.
10. The apparatus according to claim 6, wherein, the data conversion module is configured to: Extract features from the image data; Convert the extracted feature data into target data belonging to the target interval.
11. An electronic device, comprising: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method according to any one of claims 1-5.
12. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to execute the method according to any one of claims 1-5.
13. A computer program product, comprising a computer program, where the computer program, when executed by a processor, implements the method according to any one of claims 1-5.
Citation Information
Patent Citations
Enhanced multi-processor waveform data exchange using compression and decompression
CN102754078A
High-efficiency and high-precision seismic exploration data compression method
CN104749633A