Device, method and apparatus for adaptively checking the bit width of data

By adaptively checking and filling the bit widths of each dimension of data in the neural network processor, the problem of high communication costs and difficult design inheritance caused by diverse bit width requirements is solved, and software and hardware alignment and project inheritance are improved.

CN118396992BActive Publication Date: 2024-10-11AXERA SEMICON (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410830987.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-26
Publication Date
2024-10-11
Estimated Expiration
2044-06-26

AI Technical Summary

Technical Problem

In neural network processors, due to the diversified bit width requirements of data in each dimension, the cost of software and hardware communication is high and the design is not easy to inherit, which reduces work efficiency.

Method used

Provide a device and method for adaptively checking the bit width of data, by obtaining the initial bit width of each dimension of the image to be processed, filling it to the target bit width according to preset rules, generating a filled image, and storing and processing the target image , reduce software and hardware communication costs and improve project inheritance.

Benefits of technology

Alignment of software and hardware is achieved, communication costs are reduced, work efficiency is improved, and project continuity is enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118396992B_ABST
    Figure CN118396992B_ABST
Patent Text Reader

Abstract

The present application relates to the field of data processing technology, and provides a device, method and equipment for adaptively checking the bit width of data, the device comprising: an acquisition module, a filling module, a storage module and a reader electrically connected in sequence; the acquisition module is used to acquire the image to be processed and the initial bit width of each dimension of the image to be processed; the filling module is used to fill the initial bit width of each dimension to obtain the target bit width of each dimension; according to the target bit width of each dimension and the image to be processed, a filled image is generated; the storage module is used to store the filled image and the initial bit width of each dimension; the reader is used to read the filled image from the storage module, determine the image to be processed according to the initial bit width of each dimension and the filled image, process the image to be processed, and obtain the target image. The technical solution of the present application can reduce the communication cost of software and hardware staff.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a device, method and equipment for adaptively checking the bit width of data. Background Art

[0002] NPU (Natural Processing Unit) processes data (i.e. input data or output data) in multiple dimensions. Generally, hardware processing or software processing has certain requirements for the bit width corresponding to each dimension in order to improve operating efficiency or reduce code difficulty. In particular, in hardware processing, if all bit widths corresponding to data in each dimension can be processed, the chip area and power consumption will be greatly increased.

[0003] In order to solve the above technical problems, in related technologies, software and hardware personnel need to frequently communicate on the bit width requirements for data in each dimension.

[0004] However, due to the large number of operator types and the various bit widths of data in each dimension in the above method, the communication cost of software and hardware staff will increase dramatically. In addition, since there is no fixed mechanism to constrain the bit width of data in each dimension, different projects have different design requirements, resulting in less existing work that can be inherited to the next project, reducing work efficiency. Summary of the invention

[0005] The embodiment of the present application provides a device, method and apparatus for adaptively checking the bit width of data, which can reduce the communication cost of software and hardware staff, and provide preset rules for constraining the bit width of data in each dimension, thereby increasing the inheritance of the project and improving work efficiency. The technical solution is as follows:

[0006] According to a first aspect of an embodiment of the present application, a device for adaptively checking a bit width of data is provided, the device comprising:

[0007] An acquisition module, a filling module, a storage module and a reader electrically connected in sequence;

[0008] The acquisition module is used to acquire the image to be processed and the initial bit width of each dimension of the image to be processed;

[0009] The filling module is used to fill the initial bit width of each dimension to obtain the target bit width of each dimension; generate a filled image according to the target bit width of each dimension and the image to be processed; the filled image is the image to be processed with the edge area filled; the target bit width is greater than or equal to the first preset threshold, less than the second preset threshold, and is a power of the third preset threshold, or the target bit width is greater than the second preset threshold, and is an integer multiple of the second preset threshold, or is equal to the second preset threshold;

[0010] The storage module is used to store the padded image and the initial bit width of each dimension;

[0011] The reader is used to read the padded image from the storage module, determine the image to be processed according to the initial bit width of each dimension and the padded image, and process the image to be processed to obtain the target image;

[0012] The storage module is also used to store the target image.

[0013] In some possible implementations, the dimension includes the number of channels of the image to be processed, the width of the image to be processed, the height of the image to be processed, and the number of images to be processed.

[0014] In some possible implementations, the filling module is used to obtain a channel bit width of each channel, and obtain the initial bit width of the number of channels based on the product of the channel bit width and the number of channels;

[0015] Fill the initial bit width of the number of channels to the target bit width of the number of channels;

[0016] The product of the target bit width of the number of channels and the width is used as the initial bit width of the width;

[0017] Filling the initial bit width of the width to the target bit width of the width;

[0018] Using the product of the target bit width of the width and the height as the initial bit width of the height;

[0019] Fill the initial bit width of the height to the target bit width of the height;

[0020] Using the product of the target bit width of the height and the number as the initial bit width of the number;

[0021] Fill the initial bit width with the number to the target bit width with the number.

[0022] In some possible implementations, the filling module is further used to: if the initial bit width of the number of channels is less than the first preset threshold, fill the initial bit width of the number of channels to the target bit width of the number of channels, and the target bit width of the number of channels is equal to the first preset threshold; or

[0023] If the initial bit width of the number of channels is greater than the first preset threshold, less than the second preset threshold and not a power of the third preset threshold, then fill the initial bit width of the number of channels to the target bit width of the number of channels, and the target bit width of the number of channels is a power of the third preset threshold; or

[0024] If the initial bit width of the number of channels is greater than the second preset threshold and is not an integer multiple of the second preset threshold, the initial bit width of the number of channels is filled to the target bit width of the number of channels, and the target bit width of the number of channels is an integer multiple of the second preset threshold;

[0025] If the initial bit width of the width is less than the first preset threshold, fill the initial bit width of the width to the target bit width of the width, and the target bit width of the width is equal to the first preset threshold; or

[0026] If the initial bit width of the width is greater than the first preset threshold, less than the second preset threshold and not a power of the third preset threshold, then fill the initial bit width of the width to the target bit width of the width, and the target bit width of the width is a power of the third preset threshold; or

[0027] If the initial bit width of the width is greater than the second preset threshold and is not an integer multiple of the second preset threshold, the initial bit width of the width is filled to the target bit width of the width, and the target bit width of the width is an integer multiple of the second preset threshold;

[0028] If the initial bit width of the height is less than the first preset threshold, fill the initial bit width of the height to the target bit width of the height, and the target bit width of the height is equal to the first preset threshold; or

[0029] If the initial bit width of the height is greater than the first preset threshold, less than the second preset threshold, and not a power of the third preset threshold, then fill the initial bit width of the height to the target bit width of the height, and the target bit width of the height is a power of the third preset threshold; or

[0030] If the initial bit width of the height is greater than the second preset threshold and is not an integer multiple of the second preset threshold, the initial bit width of the height is filled to the target bit width of the height, and the target bit width of the height is an integer multiple of the second preset threshold;

[0031] If the initial bit width of the number is less than the first preset threshold, fill the initial bit width of the number to the target bit width of the number, and the target bit width of the number is equal to the first preset threshold; or

[0032] If the initial bit width of the number is greater than the first preset threshold, less than the second preset threshold and is not a power of the third preset threshold, fill the initial bit width of the number to the target bit width of the number, and the target bit width of the number is a power of the third preset threshold; or

[0033] If the initial bit width of the number is greater than the second preset threshold and is not an integer multiple of the second preset threshold, the initial bit width of the number is filled to the target bit width of the number, and the target bit width of the number is an integer multiple of the second preset threshold.

[0034] In some possible implementations, the device further includes:

[0035] If the initial bit width of the channel quantity is equal to the first preset threshold, the initial bit width of the channel quantity is used as the target bit width of the channel quantity.

[0036] In some possible implementations, the device further includes:

[0037] If the initial bit width of the channel quantity is greater than the first preset threshold, less than the second preset threshold, and is a power of the third preset threshold, the initial bit width of the channel quantity is used as the target bit width of the channel quantity.

[0038] In some possible implementations, the device further includes:

[0039] If the initial bit width of the channel quantity is greater than the second preset threshold, is an integer multiple of the second preset threshold, or is equal to the second preset threshold, the initial bit width of the channel quantity is used as the target bit width of the channel quantity.

[0040] In some possible implementations, the device further includes:

[0041] If the initial bit width of the width is equal to the first preset threshold, the initial bit width of the width is used as the target bit width of the width.

[0042] In some possible implementations, the device further includes:

[0043] If the initial bit width of the width is greater than the first preset threshold, less than the second preset threshold, and is a power of the third preset threshold, the initial bit width of the width is used as the target bit width of the width.

[0044] In some possible implementations, the device further includes:

[0045] If the initial bit width of the width is greater than the second preset threshold, is an integer multiple of the second preset threshold, or is equal to the second preset threshold, the initial bit width of the width is used as the target bit width of the width.

[0046] In some possible implementations, the device further includes:

[0047] If the initial bit width of the height is equal to the first preset threshold, the initial bit width of the height is used as the target bit width of the height.

[0048] In some possible implementations, the device further includes:

[0049] If the initial bit width of the height is greater than the first preset threshold, less than the second preset threshold, and is a power of the third preset threshold, the initial bit width of the height is used as the target bit width of the height.

[0050] In some possible implementations, the device further includes:

[0051] If the initial bit width of the height is greater than the second preset threshold, and is an integer multiple of the second preset threshold, or is equal to the second preset threshold, the initial bit width of the height is used as the target bit width of the height.

[0052] In some possible implementations, the device further includes:

[0053] If the number of the initial bit widths is equal to the first preset threshold, the number of the initial bit widths is used as the number of the target bit widths.

[0054] In some possible implementations, the device further includes:

[0055] If the initial bit width of the number is greater than the first preset threshold, less than the second preset threshold, and is a power of the third preset threshold, the initial bit width of the number is used as the target bit width of the number.

[0056] In some possible implementations, the device further includes:

[0057] If the initial bit width of the number is greater than the second preset threshold, is an integer multiple of the second preset threshold, or is equal to the second preset threshold, the initial bit width of the number is used as the target bit width of the number.

[0058] In some possible implementations, the reader is further used to fill the target image after obtaining the target image to obtain the image to be stored, and the bit width of each dimension of the image to be stored is the target bit width of each dimension.

[0059] In some possible implementations, the first preset threshold is 8 bits, the second preset threshold is 256 bits, and the third preset threshold is 2.

[0060] According to a second aspect of an embodiment of the present application, a method for adaptively checking the bit width of data is provided, which is applied to the above-mentioned device for adaptively checking the bit width of data, and the method includes:

[0061] Obtaining an image to be processed and an initial bit width of each dimension of the image to be processed;

[0062] Get the initial bit width of each dimension;

[0063] Fill the initial bit width of each dimension to obtain a target bit width of each dimension; the target bit width is greater than or equal to the first preset threshold, less than the second preset threshold, and is a power of a third preset threshold, or the target bit width is greater than the second preset threshold, and is an integer multiple of the second preset threshold, or is equal to the second preset threshold;

[0064] Generate a filling image according to the target bit width of each dimension and the image to be processed, where the filling image is the image to be processed with the edge area filled;

[0065] Storing the padded image and the initial bit width of each dimension;

[0066] Read the filled image;

[0067] Determine the image to be processed according to the initial bit width of each dimension and the padded image, process the image to be processed, and obtain the target image;

[0068] The target image is stored.

[0069] According to a third aspect of an embodiment of the present application, a computer device is provided, which includes a processor and a memory, wherein the memory is used to store at least one program, and the at least one program is loaded by the processor and executes the above-mentioned method for adaptively checking the bit width of data.

[0070] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, in which at least one program is stored. The at least one program is loaded and executed by a processor to implement the above-mentioned method of adaptively checking the bit width of data.

[0071] In an embodiment of the present application, an embodiment of the present application provides a device for adaptively checking the bit width of data, and a preset rule is set. The preset rule is used to constrain the bit width of each dimensional data of the image to be processed, and the bit width of each dimensional data of the image to be processed is adaptively checked based on the preset rule. If the bit width of the dimensional data does not meet the preset rule, the bit width of the dimensional data is adjusted to meet the preset rule, and the dimensional data that meets the preset rule is stored, and the stored dimensional data that meets the preset rule is read. Through the above analysis, the embodiment of the present application can reduce the communication cost of software and hardware staff and realize the alignment requirements between software and hardware. In addition, the bit width of each dimensional data is constrained based on the preset rules, thereby increasing the inheritance of the project and improving work efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0072] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0073] Figure 1 is a schematic diagram of an implementation environment provided according to an embodiment of the present application;

[0074] Figure 2 It is a structural schematic diagram of a device for adaptively checking the bit width of data provided according to an embodiment of the present application;

[0075] Figure 3 This is the first data arrangement method that satisfies the preset rules in the storage module provided in the embodiment of the present application;

[0076] Figure 4 This is a second data arrangement method that satisfies a preset rule in a storage module provided in an embodiment of the present application;

[0077] Figure 5It is a flowchart of a method for adaptively checking the bit width of data provided in accordance with an embodiment of the present application;

[0078] Figure 6 is a schematic diagram of the structure of a terminal provided according to an embodiment of the present application;

[0079] Figure 7 It is a structural diagram of a server provided according to an embodiment of the present application. DETAILED DESCRIPTION

[0080] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0081] Here, exemplary embodiments are described in detail, and examples thereof are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application.

[0082] In this application, the terms "first", "second", etc. are used to distinguish between identical or similar items with substantially the same effects and functions. It should be understood that there is no logical or temporal dependency between "first", "second", and "nth", nor is there a limitation on the quantity and execution order. It should also be understood that although the following description uses the terms first, second, etc. to describe various elements, these elements should not be limited by the terms.

[0083] These terms are only used to distinguish one element from another element. For example, without departing from the scope of various examples, a first action can be referred to as a second action, and similarly, a second action can also be referred to as a first action. Both the first action and the second action can be actions, and in some cases, can be separate and different actions.

[0084] Here, at least one means one or more than one, for example, at least one action can be one action, two actions, three actions, or any other action that is an integer greater than or equal to one. And multiple means two or more than two, for example, multiple actions can be two actions, three actions, or any other action that is an integer greater than or equal to two.

[0085] Figure 1 It is a schematic diagram of an implementation environment provided according to an embodiment of the present application, and the implementation environment may include a terminal 101 and a server 102.

[0086] In the terminal 101, there is a device for adaptively checking the bit width of data, which is used to check the bit width of each dimensional data of the image to be processed based on preset rules. When the bit width of each dimensional data of the image to be processed does not meet the preset rules, the bit width of each dimensional data of the image to be processed is adjusted to meet the preset rules, the each dimensional data of the image to be processed that meets the preset rules is stored, and the stored each dimensional data of the image to be processed that meets the preset rules is read.

[0087] The terminal 101 may be a smart phone, a wearable device, a personal computer, a laptop computer, a tablet computer, a smart TV, a car terminal, etc., which is a device capable of adaptively checking the bit width of data.

[0088] The server 102 may be a single server, a server cluster consisting of multiple servers, or a cloud processing center.

[0089] The terminal 101 is connected to the server 102 via a wired or wireless network.

[0090] In some embodiments, the wireless network or wired network uses standard communication technology and / or protocol. The network is usually the Internet, but it can also be any network, including but not limited to any combination of local area network (LAN), metropolitan area network (MAN), wide area network (WAN), mobile, wired or wireless network, private network or virtual private network. In some embodiments, the data exchanged through the network is represented by technology and / or format including Hyper Text Mark-up Language (HTML), Extensible Markup Language (XML), etc. In addition, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), Internet Protocol Security (IPsec) can also be used to encrypt all or some links. In other embodiments, customized and / or dedicated data communication technology can also be used to replace or supplement the above data communication technology.

[0091] Figure 2 1 is a schematic diagram of a structure of a device for adaptively checking the bit width of data provided in an embodiment of the present application, the device comprising:

[0092] The acquisition module 201, the filling module 202, the storage module 203 and the reader 204 are electrically connected in sequence.

[0093] The acquisition module 201 is used to acquire the image to be processed and the initial bit width of each dimension of the image to be processed.

[0094] Optionally, the dimension can be used to describe the organization method and feature quantity of the image to be processed, wherein different division methods have different numbers of dimensions.

[0095] In some embodiments, the filling module 202 is used to fill the initial bit width of each dimension to obtain the target bit width of each dimension; generate a filled image according to the target bit width of each dimension and the image to be processed; the filled image is the image to be processed with the edge area filled; the target bit width is greater than or equal to the first preset threshold, less than the second preset threshold, and is a power of the third preset threshold, or the target bit width is greater than the second preset threshold, and is an integer multiple of the second preset threshold, or is equal to the second preset threshold.

[0096] Optionally, the target bit width of a dimension can be understood as satisfying a preset rule. The preset rule includes the following two parallel conditions.

[0097] The first condition: greater than or equal to the first preset threshold, less than the second preset threshold, and is a power of the third preset threshold.

[0098] The second condition is greater than the second preset threshold and is an integer multiple of the second preset threshold.

[0099] The third condition: equal to the second preset threshold.

[0100] That is, the initial bit width of any dimension satisfies any one of the first condition, the second condition and the third condition.

[0101] Optionally, the preset rule may be an A256 alignment rule.

[0102] Optionally, the magnitude relationship among the first preset threshold, the second preset threshold and the third preset threshold may be: the second preset threshold is greater than the first preset threshold, and the first preset threshold is greater than the third preset threshold.

[0103] Optionally, the first preset threshold may be 8 bits, the second preset threshold may be 256 bits, and the third preset threshold may be 2.

[0104] Optionally, after obtaining the initial bit width of each dimension of the image to be processed, the filling module 202 may obtain the target bit width of each dimension through the following two implementation methods.

[0105] The first implementation method: determine whether the initial bit width of each dimension meets the preset rule. If there is an initial bit width of a dimension that meets the preset rule, the initial bit width of the dimension is used as the target bit width.

[0106] The second implementation method: determine whether the initial bit width of each dimension meets the preset rules. If the initial bit width of one dimension does not meet the preset rules, fill the initial bit width of the dimension to meet the preset rules.

[0107] In some embodiments, the dimension includes the number of channels of the image to be processed, the width of the image to be processed, the height of the image to be processed, and the number of images to be processed.

[0108] It should be noted that the dimensions of the present application are only explained by taking the number of channels of the image to be processed, the width of the image to be processed, the height of the image to be processed, and the number of images to be processed as examples. In addition, the dimensions may also include other features of the processed image, which will not be described in detail in the embodiments of the present application.

[0109] In some embodiments, the filling module 202 is used to obtain the channel bit width of each channel, and obtain the initial bit width of the number of channels based on the product of the channel bit width and the number of channels.

[0110] In some embodiments, the filling module is used to obtain the channel bit width of each channel, and obtain the initial bit width of the number of channels based on the product of the channel bit width and the number of channels.

[0111] Optionally, the initial bit width of the number of channels=the number of channels×the bit width of each channel.

[0112] In some embodiments, the initial bit width of the number of channels is padded to the target bit width of the number of channels.

[0113] In some embodiments, the product of the target bit width of the number of channels and the width is used as the initial bit width of the width.

[0114] Optionally, the initial bit width of width=width×target bit width of the number of channels.

[0115] In some embodiments, the initial bit width of the width is padded to the target bit width of the width.

[0116] In some embodiments, the product of the target bit width of the width and the height is used as the initial bit width of the height.

[0117] Optionally, the initial bit width of height=height×the target bit width of width.

[0118] In some embodiments, the initial bit width of the height is padded to the target bit width of the height.

[0119] In some embodiments, the product of the target bit width of the height and the number is used as the initial bit width of the number.

[0120] Optionally, the initial bit width of quantity=the target bit width of height×quantity.

[0121] In some embodiments, the number of the initial bit widths is padded to the target bit width of the number of the images to be processed.

[0122] In some embodiments, if the initial bit width of the number of channels is less than the first preset threshold, the initial bit width of the number of channels is filled to the target bit width of the number of channels, and the target bit width of the number of channels is equal to the first preset threshold.

[0123] Optionally, when the number of channels is 1 and the bit width of the channel is 4 bits, the initial bit width of the channel is 4 bits, that is, the initial bit width of the channel is less than the first preset threshold, therefore, the bit width of the channel needs to be filled to 8 bits.

[0124] In some embodiments, if the initial bit width of the number of channels is greater than the first preset threshold, less than the second preset threshold, and not a power of the third preset threshold, the initial bit width of the number of channels is filled to the target bit width of the number of channels, and the target bit width of the number of channels is greater than the first preset threshold, less than the second preset threshold, and is a power of the third preset threshold. That is, the target bit width of the number of channels satisfies the first condition of the preset rule.

[0125] In some embodiments, if the initial bit width of the number of channels is greater than the second preset threshold and is not an integer multiple of the second preset threshold, the initial bit width of the number of channels is padded to the target bit width of the number of channels, and the target bit width of the number of channels is greater than the second preset threshold and is an integer multiple of the second preset threshold. That is, the target bit width of the number of channels satisfies the second condition of the preset rule.

[0126] Optionally, when the number of channels is 24 and the bit width of each channel is 16 bits, the initial bit width of the number of channels is 24×16 bits, that is, 3×128 bits. If the initial bit width of the number of channels is greater than the second preset threshold and is not an integer multiple of the second preset threshold, the initial bit width of the number of channels is filled to 4×128 bits.

[0127] In some embodiments, if the initial bit width of the width is smaller than the first preset threshold, the initial bit width of the width is padded to the target bit width of the width, and the target bit width of the width is equal to the first preset threshold.

[0128] In some embodiments, if the initial bit width of the width is greater than the first preset threshold, less than the second preset threshold, and not a power of the third preset threshold, the initial bit width of the width is filled to the target bit width of the width, and the target bit width of the width is greater than the first preset threshold, less than the second preset threshold, and is a power of the third preset threshold.

[0129] Optionally, when the width is 3, the initial bit width of the width is 3×8 bits, that is, the initial bit width of the width is less than the second preset threshold, and the initial bit width of the width is not a power of the third preset threshold, therefore, the initial bit width of the width can be filled to 4×8 bits.

[0130] In some embodiments, if the initial bit width of the width is greater than the second preset threshold and is not an integer multiple of the second preset threshold, the initial bit width of the width is filled to the target bit width of the width, and the target bit width of the width is greater than the second preset threshold and is an integer multiple of the second preset threshold.

[0131] Optionally, when the initial bit width of the width is 3×128 bits, that is, the initial bit width of the width is greater than the second preset threshold, and the initial bit width of the width is not an integer multiple of the second preset threshold, the initial bit width of the width can be padded to 4×128 bits.

[0132] In some embodiments, if the initial bit width of the height is less than the first preset threshold, the initial bit width of the height is padded to the target bit width of the height, and the target bit width of the height is equal to the first preset threshold.

[0133] In some embodiments, if the initial bit width of the height is greater than the first preset threshold, less than the second preset threshold, and not a power of the third preset threshold, the initial bit width of the height is filled to the target bit width of the height, and the target bit width of the height is greater than the first preset threshold, less than the second preset threshold, and is a power of the third preset threshold.

[0134] Optionally, when the height is 3, the initial bit width of the height is 3×32 bits, that is, the initial bit width of the height is less than the second preset threshold, and the initial bit width of the height is not a power of the third preset threshold, then the initial bit width of the height can be filled to 4×32 bits.

[0135] In some embodiments, if the initial bit width of the height is greater than the second preset threshold and is not an integer multiple of the second preset threshold, the initial bit width of the height is filled to the target bit width of the width, and the target bit width of the height is greater than the second preset threshold and is an integer multiple of the second preset threshold.

[0136] Optionally, when the initial bit width of the height is 5×128 bits, that is, the initial bit width of the height is greater than the second preset threshold, and the initial bit width of the height is not an integer multiple of the second preset threshold, the initial bit width of the height can be padded to 6×128 bits.

[0137] In some embodiments, if the number of the initial bit widths is less than the first preset threshold, the number of the initial bit widths is padded to the number of the target bit widths, and the number of the target bit widths is equal to the first preset threshold.

[0138] In some embodiments, if the initial bit width of the number is greater than the first preset threshold, less than the second preset threshold, and is not a power of the third preset threshold, then the initial bit width of the number is filled to the target bit width of the number, and the target bit width of the number is greater than the first preset threshold, less than the second preset threshold, and is a power of the third preset threshold.

[0139] Optionally, when the initial bit width of the number is 3×32 bits, that is, the initial bit width of the number is less than the second preset threshold, and the initial bit width of the number is not a power of the third preset threshold, the initial bit width of the number can be padded to 4×32 bits.

[0140] In some embodiments, if the initial bit width of the number is greater than the second preset threshold and is not an integer multiple of the second preset threshold, the initial bit width of the number is padded to the target bit width of the number, and the target bit width of the number is greater than the second preset threshold and is an integer multiple of the second preset threshold.

[0141] Optionally, when the initial bit width of the number is 7×128 bits, that is, the initial bit width of the number is greater than the second preset threshold, and the initial bit width of the number is not an integer multiple of the second preset threshold, the initial bit width of the number can be padded to 8×128 bits.

[0142] In some embodiments, the device further includes: if the initial bit width of the number of channels is equal to the first preset threshold, using the initial bit width of the number of channels as the target bit width of the number of channels.

[0143] In some embodiments, the device further includes: if the initial bit width of the number of channels is greater than a first preset threshold, less than a second preset threshold, and is a power of a third preset threshold, then the initial bit width of the number of channels is used as the target bit width of the number of channels.

[0144] Optionally, when the number of channels is 1 and the bit width of the channel is 16 bits, the initial bit width of the number of channels is 16 bits, that is, the initial bit width of the number of channels is greater than the first preset threshold, less than the second preset threshold, and is a power of the third preset threshold, then the initial bit width of the number of channels is used as the target bit width of the number of channels.

[0145] In some embodiments, the device further includes: if the initial bit width of the number of channels is greater than a second preset threshold, and is an integer multiple of the second preset threshold, or is equal to the second preset threshold, then the initial bit width of the number of channels is used as the target bit width of the number of channels.

[0146] Optionally, when the number of channels is 32 and the bit width of each channel is 8 bits, the initial bit width of the number of channels is 256 bits, and the initial bit width of the number of channels is equal to the second preset threshold value and is an integer multiple of the second preset threshold value, and the initial bit width of the number of channels does not need to be filled, and the initial bit width of the number of channels is used as the target bit width of the number of channels. That is, the target bit width of the number of channels satisfies the third condition of the preset rule.

[0147] In some embodiments, the device further includes: if the initial bit width of the width is equal to the first preset threshold, using the initial bit width of the width as the target bit width of the width.

[0148] In some embodiments, the apparatus further comprises:

[0149] If the initial bit width of the width is greater than the first preset threshold, less than the second preset threshold, and is a power of the third preset threshold, the initial bit width of the width is used as the target bit width of the width.

[0150] Optionally, when the width is 4, the initial bit width of the width is 4×8 bits, that is, the initial bit width of the width is less than the second preset threshold, and the initial bit width of the width is a power of the third preset threshold. Therefore, there is no need to fill the initial bit width of the width, and the initial bit width of the width is used as the target bit width of the width.

[0151] In some embodiments, the apparatus further comprises:

[0152] If the initial bit width of the width is greater than the second preset threshold, and the initial bit width of the width is an integer multiple of the second preset threshold, or is equal to the second preset threshold, the initial bit width of the width is used as the target bit width of the width.

[0153] Optionally, when the initial bit width of the width is 256 bits, that is, the initial bit width of the width is equal to the second preset threshold, and the initial bit width of the width is an integer multiple of the second preset threshold, there is no need to fill the initial bit width of the width, and the initial bit width of the width is used as the target bit width of the width.

[0154] In some embodiments, the apparatus further comprises:

[0155] If the initial bit width of the height is equal to the first preset threshold, the initial bit width of the height is used as the target bit width of the height.

[0156] In some embodiments, the apparatus further comprises:

[0157] If the initial bit width of the height is greater than the first preset threshold, less than the second preset threshold, and is a power of the third preset threshold, the initial bit width of the height is used as the target bit width of the height.

[0158] Optionally, when the height is 4, the initial bit width of the height is 4×32 bits, that is, the initial bit width of the height is less than the second preset threshold, and the initial bit width of the height is a power of the third preset threshold. Therefore, there is no need to fill the initial bit width of the height, and the initial bit width of the height is used as the target bit width of the height.

[0159] In some embodiments, the apparatus further comprises:

[0160] If the initial bit width of the height is greater than the second preset threshold, and the initial bit width of the height is an integer multiple of the second preset threshold, or is equal to the second preset threshold, the initial bit width of the height is used as the target bit width of the height.

[0161] Optionally, when the initial bit width of the height is 5×256 bits, that is, the initial bit width of the height is greater than the second preset threshold, and the initial bit width of the height is an integer multiple of the second preset threshold, there is no need to fill the initial bit width of the height, and the initial bit width of the height is used as the target bit width of the height.

[0162] In some embodiments, the apparatus further comprises:

[0163] If the number of the initial bit widths is equal to the first preset threshold, the number of the initial bit widths is used as the number of the target bit widths.

[0164] In some embodiments, the apparatus further comprises:

[0165] If the initial bit width of the quantity is greater than or equal to the first preset threshold, less than the second preset threshold, and the initial bit width of the quantity is a power of the third preset threshold, the initial bit width of the quantity is used as the target bit width of the quantity.

[0166] Optionally, when the initial bit width of the quantity is 4×32 bits, that is, the initial bit width of the quantity is greater than or equal to the first preset threshold and less than the second preset threshold, and the initial bit width of the quantity is a power of a third preset threshold, there is no need to fill the initial bit width of the quantity, and the initial bit width of the quantity is used as the target bit width of the quantity.

[0167] In some embodiments, the device further includes: if the initial bit width of the quantity is greater than a second preset threshold, and the initial bit width of the quantity is an integer multiple of the second preset threshold, or is equal to the second preset threshold, then the initial bit width of the quantity is used as the target bit width of the quantity.

[0168] Optionally, when the initial bit width of the number is 8×256 bits, that is, the initial bit width of the number is greater than the second preset threshold, and the initial bit width of the number is an integer multiple of the second preset threshold, there is no need to fill the initial bit width of the number, and the initial bit width of the number is used as the target bit width of the number.

[0169] Optionally, "b0" may be used to fill the initial bit width of the dimension. It should be noted that in practical applications, "b0" may be any value according to actual needs, and the embodiments of the present application do not specifically limit "b0".

[0170] In some embodiments, the storage module 203 is used to store the padded image and the initial bit width of each dimension.

[0171] Alternatively, if Figure 3 As shown, Figure 3 Indicates the data arrangement of the filling image corresponding to the image to be processed in the storage module 203. The number of channels of the image to be processed is 1, the width is 3, the height is 3, the number is 2, and the bit width of each channel is 4 bits. Figure 3 In the figure, from left to right, the address is from low to high.

[0172] For ease of representation, Figure 3 In the example, each box represents 8 bits, which are filled with "b0", and "4b0" means 4 bits are filled. The number of channels can be represented by C, the width can be represented by W, the height can be represented by H, and the number can be represented by N, that is, C=1, W=3, H=3, N=2, ( ) represents the storage data of the position where N is x, H is y, W is m, and C is n in the filled image corresponding to the image to be processed.

[0173] Alternatively, if Figure 4 As shown, Figure 4 Indicates the data arrangement of the image to be processed without padding in the storage module 203. Wherein, when the number of channels of the image to be processed is 32, the width is 3, the height is 3, the number is 3, and the bit width of each channel is 8 bits, the second condition is met and no padding is required. Figure 4 In , each box represents 256 bits, and the target bit width of the number of channels is 256 bits, so, Figure 4 The target bit width for the number of channels is omitted.

[0174] Optionally, the storage module 203 may be implemented based on OCM (on chip memory).

[0175] In some embodiments, the reader 204 is used to read the padded image from the storage module 203, determine the image to be processed according to the initial bit width of each dimension and the padded image, and process the image to be processed to obtain the target image.

[0176] Optionally, the reader 204 determines the padded edge region and the image to be processed according to the initial bit width of each dimension and the padded image, and then processes only the image to be processed to obtain the target image.

[0177] Optionally, the reader 204 reads the filled image of the storage module 203, thereby achieving alignment of software and hardware design requirements while reducing the communication cost between software and hardware staff.

[0178] In some embodiments, the reader 204 is further used to fill the target image after obtaining the target image to obtain the image to be stored, and the bit width of each dimension of the image to be stored is the target bit width of each dimension.

[0179] Optionally, after obtaining the target image, the reader 204 still adaptively checks whether the initial bit width of each dimension of the target image satisfies the preset rules, and adjusts the initial bit width of each dimension to satisfy the preset rules, that is, fills the edge area of ​​the target image, thereby obtaining the image to be stored corresponding to the target image.

[0180] In some embodiments, the storage module 203 is also used to store the target image.

[0181] Optionally, the storage module 203 is further configured to store an image to be stored corresponding to the target image.

[0182] In the embodiment of the present application, preset rules are set, and the preset rules are used to constrain the bit width of each dimensional data of the image to be processed, and the bit width of each dimensional data of the image to be processed is adaptively checked based on the preset rules. If the bit width of the dimensional data does not meet the preset rules, the bit width of the dimensional data is adjusted to meet the preset rules, and the dimensional data that meets the preset rules is stored, and the stored dimensional data that meets the preset rules is read. Through the above analysis, the embodiment of the present application can reduce the communication cost of software and hardware staff and realize the alignment requirements between software and hardware. In addition, the bit width of each dimensional data is constrained based on the preset rules, thereby increasing the inheritance of the project and improving work efficiency.

[0183] Figure 5 is a flow chart of a method for adaptively checking the bit width of data provided in accordance with an embodiment of the present application, such as Figure 5 As shown, in the embodiment of the present application, the method is described by taking the terminal of the device having the bit width of the adaptive inspection data as an example. The method comprises the following steps:

[0184] In step 501, the terminal obtains an image to be processed and an initial bit width of each dimension of the image to be processed;

[0185] In step 502, the terminal obtains the initial bit width of each dimension;

[0186] In step 503, the terminal fills the initial bit width of each dimension to obtain a target bit width of each dimension; the target bit width is greater than or equal to the first preset threshold, less than the second preset threshold, and is a power of the third preset threshold, or the target bit width is greater than the second preset threshold, is an integer multiple of the second preset threshold, or is equal to the second preset threshold;

[0187] In step 504, the terminal generates a filling image according to the target bit width of each dimension and the image to be processed, where the filling image is the image to be processed with the edge area filled;

[0188] In step 505, the terminal stores the padded image and the initial bit width of each dimension;

[0189] In step 506, the terminal reads the filling image;

[0190] In step 507, the terminal determines the image to be processed according to the initial bit width of each dimension and the padding image, processes the image to be processed, and obtains the target image;

[0191] In step 508, the terminal stores the target image.

[0192] In some embodiments, the dimension includes the number of channels of the image to be processed, the width of the image to be processed, the height of the image to be processed, and the number of images to be processed.

[0193] In some embodiments, the method further includes: obtaining a channel bit width of each channel, and obtaining the initial bit width of the number of channels based on the product of the channel bit width and the number of channels;

[0194] Fill the initial bit width of the number of channels to the target bit width of the number of channels;

[0195] The product of the target bit width of the number of channels and the width is used as the initial bit width of the width;

[0196] Filling the initial bit width of the width to the target bit width of the width;

[0197] Using the product of the target bit width of the width and the height as the initial bit width of the height;

[0198] Fill the initial bit width of the height to the target bit width of the height;

[0199] Using the product of the target bit width of the height and the number as the initial bit width of the number;

[0200] Fill the initial bit width with the number to the target bit width with the number.

[0201] In some embodiments, the method further includes: if the initial bit width of the number of channels is less than the first preset threshold, filling the initial bit width of the number of channels to the target bit width of the number of channels, the target bit width of the number of channels being equal to the first preset threshold; or

[0202] If the initial bit width of the number of channels is greater than the first preset threshold, less than the second preset threshold and not a power of the third preset threshold, then fill the initial bit width of the number of channels to the target bit width of the number of channels, and the target bit width of the number of channels is a power of the third preset threshold; or

[0203] If the initial bit width of the number of channels is greater than the second preset threshold and is not an integer multiple of the second preset threshold, the initial bit width of the number of channels is filled to the target bit width of the number of channels, and the target bit width of the number of channels is an integer multiple of the second preset threshold;

[0204] If the initial bit width of the width is less than the first preset threshold, fill the initial bit width of the width to the target bit width of the width, and the target bit width of the width is equal to the first preset threshold; or

[0205] If the initial bit width of the width is greater than the first preset threshold, less than the second preset threshold and not a power of the third preset threshold, then fill the initial bit width of the width to the target bit width of the width, and the target bit width of the width is a power of the third preset threshold; or

[0206] If the initial bit width of the width is greater than the second preset threshold and is not an integer multiple of the second preset threshold, the initial bit width of the width is filled to the target bit width of the width, and the target bit width of the width is an integer multiple of the second preset threshold;

[0207] If the initial bit width of the height is less than the first preset threshold, fill the initial bit width of the height to the target bit width of the height, and the target bit width of the height is equal to the first preset threshold; or

[0208] If the initial bit width of the height is greater than the first preset threshold, less than the second preset threshold, and not a power of the third preset threshold, then fill the initial bit width of the height to the target bit width of the height, and the target bit width of the height is a power of the third preset threshold; or

[0209] If the initial bit width of the height is greater than the second preset threshold and is not an integer multiple of the second preset threshold, the initial bit width of the height is filled to the target bit width of the height, and the target bit width of the height is an integer multiple of the second preset threshold;

[0210] If the initial bit width of the number is less than the first preset threshold, fill the initial bit width of the number to the target bit width of the number, and the target bit width of the number is equal to the first preset threshold; or

[0211] If the initial bit width of the number is greater than the first preset threshold, less than the second preset threshold and is not a power of the third preset threshold, fill the initial bit width of the number to the target bit width of the number, and the target bit width of the number is a power of the third preset threshold; or

[0212] If the initial bit width of the number is greater than the second preset threshold and is not an integer multiple of the second preset threshold, the initial bit width of the number is filled to the target bit width of the number, and the target bit width of the number is an integer multiple of the second preset threshold.

[0213] In some embodiments, the method further comprises:

[0214] If the initial bit width of the channel quantity is equal to the first preset threshold, the initial bit width of the channel quantity is used as the target bit width of the channel quantity.

[0215] In some embodiments, the method further comprises:

[0216] If the initial bit width of the channel quantity is greater than the first preset threshold, less than the second preset threshold, and is a power of the third preset threshold, the initial bit width of the channel quantity is used as the target bit width of the channel quantity.

[0217] In some embodiments, the method further comprises:

[0218] If the initial bit width of the channel quantity is greater than the second preset threshold, is an integer multiple of the second preset threshold, or is equal to the second preset threshold, the initial bit width of the channel quantity is used as the target bit width of the channel quantity.

[0219] In some embodiments, the method further comprises:

[0220] If the initial bit width of the width is equal to the first preset threshold, the initial bit width of the width is used as the target bit width of the width.

[0221] In some embodiments, the method further comprises:

[0222] If the initial bit width of the width is greater than the first preset threshold, less than the second preset threshold, and is a power of the third preset threshold, the initial bit width of the width is used as the target bit width of the width.

[0223] In some embodiments, the method further comprises:

[0224] If the initial bit width of the width is greater than the second preset threshold, is an integer multiple of the second preset threshold, or is equal to the second preset threshold, the initial bit width of the width is used as the target bit width of the width.

[0225] In some embodiments, the method further comprises:

[0226] If the initial bit width of the height is equal to the first preset threshold, the initial bit width of the height is used as the target bit width of the height.

[0227] In some embodiments, the method further comprises:

[0228] If the initial bit width of the height is greater than the first preset threshold, less than the second preset threshold, and is a power of the third preset threshold, the initial bit width of the height is used as the target bit width of the height.

[0229] In some embodiments, the method further comprises:

[0230] If the initial bit width of the height is greater than the second preset threshold, and is an integer multiple of the second preset threshold, or is equal to the second preset threshold, the initial bit width of the height is used as the target bit width of the height.

[0231] In some embodiments, the method further comprises:

[0232] If the number of the initial bit widths is equal to the first preset threshold, the number of the initial bit widths is used as the number of the target bit widths.

[0233] In some embodiments, the method further comprises:

[0234] If the initial bit width of the number is greater than the first preset threshold, less than the second preset threshold, and is a power of the third preset threshold, the initial bit width of the number is used as the target bit width of the number.

[0235] In some embodiments, the method further comprises:

[0236] If the initial bit width of the number is greater than the second preset threshold, is an integer multiple of the second preset threshold, or is equal to the second preset threshold, the initial bit width of the number is used as the target bit width of the number.

[0237] In some embodiments, the method further includes: after obtaining the target image, filling the target image to obtain an image to be stored, wherein the bit width of each dimension of the image to be stored is the target bit width of each dimension.

[0238] In some embodiments, the first preset threshold is 8 bits, the second preset threshold is 256 bits, and the third preset threshold is 2.

[0239] It should be noted that the device for adaptively checking the bit width of data and the method embodiment for adaptively checking the bit width of data provided in the above embodiments belong to the same concept, and the specific implementation process is detailed in the device embodiment, which will not be repeated here.

[0240] In the embodiment of the present application, preset rules are set, and the preset rules are used to constrain the bit width of each dimensional data of the image to be processed, and the bit width of each dimensional data of the image to be processed is adaptively checked based on the preset rules. If the bit width of the dimensional data does not meet the preset rules, the bit width of the dimensional data is adjusted to meet the preset rules, and the dimensional data that meets the preset rules is stored, and the stored dimensional data that meets the preset rules is read. Through the above analysis, the embodiment of the present application can reduce the communication cost of software and hardware staff and realize the alignment requirements between software and hardware. In addition, the bit width of each dimensional data is constrained based on the preset rules, thereby increasing the inheritance of the project and improving work efficiency.

[0241] An embodiment of the present application further provides a computer device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, and the processor implements the above method when executing the computer program.

[0242] Taking computer equipment as the terminal as an example, Figure 6 This is a schematic diagram of the structure of a terminal provided in an embodiment of the present application, see Figure 6 The terminal 600 may be a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 player (Moving Picture Experts Group Audio Layer IV), a laptop computer, or a desktop computer. The terminal 600 may also be called a user device, a portable terminal, a laptop terminal, a desktop terminal, or other names.

[0243] Typically, the terminal 600 includes a processor 601 and a memory 602 .

[0244] The processor 601 may include one or more processing cores, such as a 4-core processor, a 6-core processor, etc. The processor 601 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 601 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 601 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 601 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0245] The memory 602 may include one or more computer-readable storage media, which may be non-transitory. The memory 602 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 602 is used to store at least one program code, which is used to be executed by the processor 601 to implement the process of terminal execution in the method for mixed-precision floating-point multiplication and accumulation operations provided in the method embodiment of the present application.

[0246] In some embodiments, the terminal 600 may further optionally include: a peripheral device interface 603 and at least one peripheral device. The processor 601, the memory 602 and the peripheral device interface 603 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 603 via a bus, a signal line or a circuit board. Specifically, the peripheral device includes: at least one of a display screen 604, a camera assembly 605, an audio circuit 606 and a power supply 607.

[0247] The peripheral device interface 603 can be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 601 and the memory 602. In some embodiments, the processor 601, the memory 602, and the peripheral device interface 603 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 601, the memory 602, and the peripheral device interface 603 can be implemented on a separate chip or circuit board, which is not limited in the embodiments of the present application.

[0248] The display screen 604 is used to display a UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 604 is a touch display screen, the display screen 604 also has the ability to collect touch signals on the surface or above the surface of the display screen 604. The touch signal can be input as a control signal to the processor 601 for processing. At this time, the display screen 604 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 604 can be one, which is set on the front panel of the terminal 600; in other embodiments, the display screen 604 can be at least two, which are respectively set on different surfaces of the terminal 600 or are folded; in other embodiments, the display screen 604 can be a flexible display screen, which is set on the curved surface or folded surface of the terminal 600. Even, the display screen 604 can also be set as a non-rectangular irregular shape, that is, a special-shaped screen. The display screen 604 can be made of materials such as LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode, organic light-emitting diode).

[0249] The camera assembly 605 is used to capture images or videos. In some embodiments, the camera assembly 605 includes a front camera and a rear camera. Typically, the front camera is disposed on the front panel of the terminal, and the rear camera is disposed on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize the panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 605 may also include a flash. The flash can be a single-color temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.

[0250] The audio circuit 606 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals and input them into the processor 601 for processing. For the purpose of stereo acquisition or noise reduction, there may be multiple microphones, which are respectively arranged at different parts of the terminal 600. The microphone may also be an array microphone or an omnidirectional acquisition microphone. The speaker is used to convert the electrical signal from the processor 601 into sound waves. The speaker may be a traditional film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signal into sound waves audible to humans, but also convert the electrical signal into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 606 may also include a headphone jack.

[0251] The power supply 607 is used to power various components in the terminal 600. The power supply 607 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 607 includes a rechargeable battery, the rechargeable battery can support wired charging or wireless charging. The rechargeable battery can also be used to support fast charging technology.

[0252] Those skilled in the art will understand that Figure 6 The structure shown in the figure does not constitute a limitation on the terminal 600, and the terminal 600 may include more or less components than those shown in the figure, or combine some components, or adopt a different component arrangement.

[0253] Take the computer device as a server as an example. Figure 7 It is a structural diagram of a server provided by an embodiment of the present application. The server 700 may have relatively large differences due to different configurations or performances, and may include one or more processors (Central Processing Units, CPU) 701 and one or more memories 702, wherein the one or more memories 702 store at least one computer program, and the at least one computer program is loaded and executed by the one or more processors 701 to implement the above-mentioned method of adaptively checking the bit width of data. Of course, the server 700 may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output. The server 700 may also include other components for implementing device functions, which will not be repeated here.

[0254] The embodiment of the present application also provides a computer-readable storage medium, the computer-readable storage medium includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the above-mentioned method for generating an image processing model. Optionally, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.

[0255] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0256] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A device for adaptively checking the bit width of data, characterized in that: include: An acquisition module, a filling module, a storage module and a reader electrically connected in sequence; The acquisition module is used to acquire the image to be processed and the initial bit width of each dimension of the image to be processed; The filling module is used to fill the initial bit width of each dimension to obtain the target bit width of each dimension; generate a filled image according to the target bit width of each dimension and the image to be processed; the filled image is the image to be processed with the edge area filled; The target bit width is greater than or equal to the first preset threshold, less than the second preset threshold, and is a power of the third preset threshold, or the target bit width is greater than the second preset threshold, and is an integer multiple of the second preset threshold, or is equal to the second preset threshold; the dimension includes the number of channels of the image to be processed, the width of the image to be processed, the height of the image to be processed, and the number of images to be processed; the first preset threshold is 8 bits, the second preset threshold is 256 bits, and the third preset threshold is 2; The filling module is further used to obtain the channel bit width of each channel, and obtain the initial bit width of the number of channels based on the product of the channel bit width and the number of channels; Fill the initial bit width of the number of channels to the target bit width of the number of channels; use the product of the target bit width of the number of channels and the width as the initial bit width of the width; fill the initial bit width of the width to the target bit width of the width; use the product of the target bit width of the width and the height as the initial bit width of the height; fill the initial bit width of the height to the target bit width of the height; use the product of the target bit width of the height and the number as the initial bit width of the number; fill the initial bit width of the number to the target bit width of the number; The filling module is further configured to fill the initial bit width of the number of channels to the target bit width of the number of channels if the initial bit width of the number of channels is less than the first preset threshold, and the target bit width of the number of channels is equal to the first preset threshold; or If the initial bit width of the number of channels is greater than the first preset threshold, less than the second preset threshold and not a power of the third preset threshold, then fill the initial bit width of the number of channels to the target bit width of the number of channels, and the target bit width of the number of channels is a power of the third preset threshold; or If the initial bit width of the number of channels is greater than the second preset threshold and is not an integer multiple of the second preset threshold, padding the initial bit width of the number of channels to the target bit width of the number of channels, the target bit width of the number of channels being an integer multiple of the second preset threshold; If the initial bit width of the width is less than the first preset threshold, padding the initial bit width of the width to the target bit width of the width, and the target bit width of the width is equal to the first preset threshold; or If the initial bit width of the width is greater than the first preset threshold, less than the second preset threshold and is not a power of the third preset threshold, then fill the initial bit width of the width to the target bit width of the width, and the target bit width of the width is a power of the third preset threshold; or If the initial bit width of the width is greater than the second preset threshold and is not an integer multiple of the second preset threshold, padding the initial bit width of the width to the target bit width of the width, and the target bit width of the width is an integer multiple of the second preset threshold; If the initial bit width of the height is less than the first preset threshold, padding the initial bit width of the height to the target bit width of the height, and the target bit width of the height is equal to the first preset threshold; or If the initial bit width of the height is greater than the first preset threshold, less than the second preset threshold, and is not a power of the third preset threshold, then fill the initial bit width of the height to the target bit width of the height, and the target bit width of the height is a power of the third preset threshold; or If the initial bit width of the height is greater than the second preset threshold and is not an integer multiple of the second preset threshold, the initial bit width of the height is filled to the target bit width of the height, and the target bit width of the height is an integer multiple of the second preset threshold; If the initial bit width of the number is less than the first preset threshold, padding the initial bit width of the number to the target bit width of the number, and the target bit width of the number is equal to the first preset threshold; or If the initial bit width of the number is greater than the first preset threshold, less than the second preset threshold and is not a power of the third preset threshold, fill the initial bit width of the number to the target bit width of the number, and the target bit width of the number is a power of the third preset threshold; or If the initial bit width of the number is greater than the second preset threshold and is not an integer multiple of the second preset threshold, the initial bit width of the number is filled to the target bit width of the number, and the target bit width of the number is an integer multiple of the second preset threshold; The storage module is used to store the padded image and the initial bit width of each dimension; The reader is used to read the padded image from the storage module, determine the image to be processed according to the initial bit width of each dimension and the padded image, and process the image to be processed to obtain a target image; The storage module is also used to store the target image.

2. The device according to claim 1, characterized in that The device further comprises: If the initial bit width of the number of channels is equal to the first preset threshold, the initial bit width of the number of channels is used as the target bit width of the number of channels.

3. The device according to claim 1, characterized in that The device further comprises: If the initial bit width of the number of channels is greater than the first preset threshold, less than the second preset threshold, and is a power of the third preset threshold, the initial bit width of the number of channels is used as the target bit width of the number of channels.

4. The device according to claim 1, characterized in that The device further comprises: If the initial bit width of the number of channels is greater than the second preset threshold, is an integer multiple of the second preset threshold, or is equal to the second preset threshold, the initial bit width of the number of channels is used as the target bit width of the number of channels.

5. The device according to claim 1, characterized in that The device further comprises: If the initial bit width of the width is equal to the first preset threshold, the initial bit width of the width is used as the target bit width of the width.

6. The device according to claim 1, characterized in that The device further comprises: If the initial bit width of the width is greater than the first preset threshold, less than the second preset threshold, and is a power of the third preset threshold, the initial bit width of the width is used as the target bit width of the width.

7. The device according to claim 1, characterized in that The device further comprises: If the initial bit width of the width is greater than the second preset threshold, is an integer multiple of the second preset threshold, or is equal to the second preset threshold, the initial bit width of the width is used as the target bit width of the width.

8. The device according to claim 1, characterized in that The device further comprises: If the initial bit width of the height is equal to the first preset threshold, the initial bit width of the height is used as the target bit width of the height.

9. The device according to claim 1, characterized in that The device further comprises: If the initial bit width of the height is greater than the first preset threshold, less than the second preset threshold, and is a power of the third preset threshold, the initial bit width of the height is used as the target bit width of the height.

10. The device according to claim 1, characterized in that The device further comprises: If the initial bit width of the height is greater than the second preset threshold, is an integer multiple of the second preset threshold, or is equal to the second preset threshold, the initial bit width of the height is used as the target bit width of the height.

11. The device according to claim 1, characterized in that The device further comprises: If the number of the initial bit widths is equal to the first preset threshold, the number of the initial bit widths is used as the number of the target bit widths.

12. The device according to claim 1, characterized in that The device further comprises: If the initial bit width of the quantity is greater than the first preset threshold, less than the second preset threshold, and is a power of the third preset threshold, the initial bit width of the quantity is used as the target bit width of the quantity.

13. The device according to claim 1, characterized in that The device further comprises: If the initial bit width of the number is greater than the second preset threshold, is an integer multiple of the second preset threshold, or is equal to the second preset threshold, the initial bit width of the number is used as the target bit width of the number.

14. The device according to claim 1, characterized in that The reader is further used to fill the target image after obtaining the target image to obtain the image to be stored, and the bit width of each dimension of the image to be stored is the target bit width of each dimension.

15. A method for adaptively checking the bit width of data, applied to the device for adaptively checking the bit width of data as claimed in any one of claims 1 to 14, characterized in that: include: Obtaining an image to be processed and an initial bit width of each dimension of the image to be processed; Obtaining an initial bit width of each dimension; Fill the initial bit width of each dimension to obtain a target bit width of each dimension; the target bit width is greater than or equal to a first preset threshold, less than a second preset threshold, and is a power of a third preset threshold, or the target bit width is greater than the second preset threshold, and is an integer multiple of the second preset threshold, or is equal to the second preset threshold; Generate a filling image according to the target bit width of each dimension and the image to be processed, wherein the filling image is the image to be processed with the edge area filled; the dimension includes the number of channels of the image to be processed, the width of the image to be processed, the height of the image to be processed and the number of images to be processed; The first preset threshold is 8 bits, the second preset threshold is 256 bits, and the third preset threshold is 2; Obtain the channel bit width of each channel, and obtain the initial bit width of the number of channels based on the product of the channel bit width and the number of channels; fill the initial bit width of the number of channels to the target bit width of the number of channels; use the product of the target bit width of the number of channels and the width as the initial bit width of the width; fill the initial bit width of the width to the target bit width of the width; use the product of the target bit width of the width and the height as the initial bit width of the height; fill the initial bit width of the height to the target bit width of the height; use the product of the target bit width of the height and the number as the initial bit width of the number; fill the initial bit width of the number to the target bit width of the number; If the initial bit width of the number of channels is less than the first preset threshold, padding the initial bit width of the number of channels to the target bit width of the number of channels, the target bit width of the number of channels being equal to the first preset threshold; or If the initial bit width of the number of channels is greater than the first preset threshold, less than the second preset threshold and not a power of the third preset threshold, then fill the initial bit width of the number of channels to the target bit width of the number of channels, and the target bit width of the number of channels is a power of the third preset threshold; or If the initial bit width of the number of channels is greater than the second preset threshold and is not an integer multiple of the second preset threshold, padding the initial bit width of the number of channels to the target bit width of the number of channels, the target bit width of the number of channels being an integer multiple of the second preset threshold; If the initial bit width of the width is less than the first preset threshold, padding the initial bit width of the width to the target bit width of the width, and the target bit width of the width is equal to the first preset threshold; or If the initial bit width of the width is greater than the first preset threshold, less than the second preset threshold and is not a power of the third preset threshold, then fill the initial bit width of the width to the target bit width of the width, and the target bit width of the width is a power of the third preset threshold; or If the initial bit width of the width is greater than the second preset threshold and is not an integer multiple of the second preset threshold, padding the initial bit width of the width to the target bit width of the width, and the target bit width of the width is an integer multiple of the second preset threshold; If the initial bit width of the height is less than the first preset threshold, padding the initial bit width of the height to the target bit width of the height, and the target bit width of the height is equal to the first preset threshold; or If the initial bit width of the height is greater than the first preset threshold, less than the second preset threshold, and is not a power of the third preset threshold, then fill the initial bit width of the height to the target bit width of the height, and the target bit width of the height is a power of the third preset threshold; or If the initial bit width of the height is greater than the second preset threshold and is not an integer multiple of the second preset threshold, the initial bit width of the height is filled to the target bit width of the height, and the target bit width of the height is an integer multiple of the second preset threshold; If the initial bit width of the number is less than the first preset threshold, padding the initial bit width of the number to the target bit width of the number, and the target bit width of the number is equal to the first preset threshold; or If the initial bit width of the number is greater than the first preset threshold, less than the second preset threshold and is not a power of the third preset threshold, fill the initial bit width of the number to the target bit width of the number, and the target bit width of the number is a power of the third preset threshold; or If the initial bit width of the number is greater than the second preset threshold and is not an integer multiple of the second preset threshold, the initial bit width of the number is filled to the target bit width of the number, and the target bit width of the number is an integer multiple of the second preset threshold; Storing the padded image and the initial bit width of each dimension; Reading the filled image; Determine the image to be processed according to the initial bit width of each dimension and the padded image, and process the image to be processed to obtain a target image; The target image is stored.

16. A computer device, characterized in that: The computer device comprises a processor and a memory, wherein the memory is used to store at least one program, and the at least one program is loaded by the processor and executes the method for adaptively checking the bit width of data as claimed in claim 15 .

17. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one program, and the at least one program is loaded and executed by the processor to implement the method for adaptively checking the bit width of data as claimed in claim 15.