File management method, device and storage medium
By partitioning and storing files according to the needs of artificial intelligence algorithms and setting personalized management parameters, the problem of low storage performance of smart devices is solved, achieving more efficient storage and file management and extending device life.
Patent Information
- Application Number
- CN202211017798.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-24
- Publication Date
- 2026-11-20
- Estimated Expiration
- 2042-08-24
AI Technical Summary
The storage performance of existing smart devices is low, mainly due to the mixed storage of files of different types and sizes, which leads to memory fragmentation and low data throughput, failing to meet the storage requirements of artificial intelligence algorithms.
Based on the storage requirements of artificial intelligence algorithms, files of different types and sizes are allocated to independent memory regions, and personalized management parameters are set, including memory margin thresholds, fragmentation optimization, memory allocation optimization, and file overwrite levels, to optimize memory region management.
It improves storage performance, reduces memory fragmentation, extends device lifespan, and enhances the file reading efficiency of AI algorithms and the user experience of the device.
Smart Images

Figure CN115470183B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of document management technology, and in particular to a document management method, apparatus, device, and storage medium. Background Technology
[0002] With the development of smart devices worldwide, more and more companies are researching artificial intelligence algorithms for various scenarios. These algorithms are used to extract features from large amounts of images and videos to achieve scene analysis, recognition, or decision-making.
[0003] For smart devices to extract features from large amounts of images and videos, they must first save these images and videos. Currently, smart security products require 24 / 7 photo and video recording, and the device's ability to save image and video files determines its lifespan. Existing file management methods store all files in the same area, resulting in low device storage performance. Summary of the Invention
[0004] This invention provides a file management method, apparatus, device, and storage medium to solve the problem of low storage performance in existing smart devices.
[0005] In a first aspect, the present invention provides a file management method, the method being applied to a smart device, the method comprising: In response to a creation instruction for a target file type, the target file type is created for the corresponding file to be stored, and a memory region is allocated for the file to be stored corresponding to the target file type; the creation instruction is triggered based on the storage requirements of at least one artificial intelligence algorithm in the smart device; the storage requirements include at least one of the file type, file size, and storage period of the file to be stored that the artificial intelligence algorithm wants to identify; Filter the files to be stored and store the files that meet the storage requirements into the corresponding memory area; The system receives management parameters set by the user for the target file type of each memory region, and manages the memory region according to the management parameters.
[0006] Optionally, the management parameters include: a memory remaining threshold and adjustment parameters; managing the memory region according to the management parameters includes: For each memory region, when the memory balance of the memory region is less than the corresponding memory balance threshold, the memory region is determined to be a memory region to be adjusted. The memory region to be adjusted is adjusted according to the adjustment parameters of the memory region to be adjusted and the adjustment parameters of other memory regions; The other memory regions include: memory regions other than the memory region corresponding to the first artificial intelligence algorithm; the first artificial intelligence algorithm is the artificial intelligence algorithm corresponding to the memory region to be adjusted.
[0007] Optionally, the adjustment parameters include memory fragmentation optimization parameters and memory allocation optimization parameters; adjusting the memory region based on the adjustment parameters of the memory region to be adjusted and the adjustment parameters of other memory regions includes: When the number of memory fragments in the memory region to be adjusted is greater than the memory fragmentation optimization parameter, fragmentation optimization is performed on the memory region to be adjusted. When there are multiple memory regions to be adjusted and the number of memory fragments in each memory region to be adjusted is less than the memory fragment optimization parameter, the current memory region to be adjusted is determined from the multiple memory regions to be adjusted, and the target memory region is determined from other memory regions where there is continuous idle memory for a preset time. Based on the memory allocation optimization parameters of the target memory region, a corresponding amount of memory is added to the memory region corresponding to the preset target file type; the preset target file type is the target file type corresponding to the current memory region to be adjusted.
[0008] Optionally, the current memory region to be adjusted is determined from multiple memory regions to be adjusted, including: Determine the importance level of the artificial intelligence algorithm corresponding to each memory region to be adjusted; determine the memory region to be adjusted corresponding to the artificial intelligence algorithm with the highest importance level as the current memory region to be adjusted. Accordingly, the target memory region is determined from other memory regions where there is continuous idle memory for a preset time, including: Determine the importance level of the artificial intelligence algorithm corresponding to each other memory region; determine the memory region corresponding to the artificial intelligence algorithm with the lowest importance level as the target memory region; Correspondingly, the memory allocation optimization parameters for each memory region are negatively correlated with the importance level of the corresponding artificial intelligence algorithm.
[0009] Optionally, the management parameters also include file coverage level; after allocating a corresponding amount of memory to the memory region to be adjusted according to the memory allocation optimization parameters of the other memory regions, if the memory balance of the memory region to be adjusted is less than the corresponding memory balance threshold, the method further includes: Increase the file coverage level corresponding to the memory region to be adjusted; The files within the memory area to be adjusted are erased according to the adjusted file coverage level.
[0010] Optionally, the files to be stored include files generated by smart devices. Filtering the files to be stored and storing those that meet the storage requirements in the corresponding memory area includes: Determine whether the attribute parameters of the file generated by the smart device are the same as the attribute parameters of any target file type; If they are the same, then determine whether the size of the generated file conforms to the size level corresponding to the target file type, and / or whether the security level of the generated file conforms to the security level corresponding to the target file type; If the conditions are met, the files generated by the smart device will be stored contiguously in the memory area corresponding to the target file type, so that the corresponding artificial intelligence algorithm can sequentially read and write the files in the memory area during runtime.
[0011] Optionally, the files to be stored also include external files. The files to be stored are filtered, and files that meet the storage requirements are stored in the corresponding memory area, including: Check whether the file information of the external file conforms to the file regulations of the smart device; the file information includes the file format and file content. If the conditions are met, the external files will be stored sequentially into the corresponding memory areas; If it does not meet the requirements, the received external file will be deleted.
[0012] Optionally, the method further includes: The system receives a user-triggered command to view the folder corresponding to any memory region, and displays the file information, memory usage status, and current management parameters of the memory region according to the command. The file information includes the file name and storage path. The memory usage status includes available memory information, the presence of bad blocks, and the number of erase / write cycles.
[0013] Optionally, a memory region may be allocated for the file to be stored corresponding to this target file type, including: The memory size corresponding to the target file type is determined based on at least one of the following: file size, number of files to be stored, and erase / write frequency input by the user. The memory area is divided according to the determined memory size for the file to be stored corresponding to the target file type.
[0014] Secondly, the present invention provides a file management system, the system being applied to a smart device, the system comprising: The processing module is configured to respond to a creation instruction for a target file type, create the target file type for the corresponding file to be stored, and allocate a memory area for the file to be stored corresponding to the target file type; the creation instruction is triggered based on the storage requirements of at least one artificial intelligence algorithm in the smart device; the storage requirements include at least one of the file type, file size, and storage period of the file to be stored that the artificial intelligence algorithm needs to identify; The storage module is used to filter files to be stored and store files that meet the storage requirements into the corresponding memory area. The management module is used to receive management parameters set by the user for the target file type of each memory region, and to manage the memory region according to the management parameters.
[0015] Thirdly, the present invention provides an electronic device, comprising: at least one processor and a memory; The memory stores the instructions that the computer executes; At least one processor executes computer execution instructions stored in memory, causing at least one processor to perform the method as described in any of the first aspects.
[0016] Fourthly, the present invention provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the method of any one of the first aspects.
[0017] This invention provides a file management method, apparatus, device, and storage medium. In response to a creation instruction for a target file type, the method creates the target file type for a corresponding file to be stored and allocates memory regions for the file to be stored corresponding to that target file type. The creation operation is triggered based on the storage requirements of at least one artificial intelligence algorithm in the smart device. The storage requirements include at least one of the file type, file size, and storage period of the file to be stored, which the artificial intelligence algorithm needs to identify. The method filters the files to be stored, storing files that meet the storage requirements in the corresponding memory regions. It receives management parameters set by the user for the target file type of each memory region and manages the memory regions according to the management parameters. Different target file types can be created according to the storage requirements of the artificial intelligence algorithm in the device, enabling the creation of separate memory regions for very large files such as images and videos, and setting up a unique memory management mechanism to solve the problem of low storage performance in smart devices. Attached Figure Description
[0018] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0019] Figure 1 An application scenario diagram provided by an embodiment of the present invention; Figure 2 A flowchart illustrating a file management method provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of a process for adjusting a memory region to be adjusted, provided as an embodiment of the present invention. Figure 4 A flowchart illustrating another file management method provided in an embodiment of the present invention; Figure 5 A schematic diagram of the structure of a file management system provided in an embodiment of the present invention; Figure 6 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present invention.
[0020] The accompanying drawings have illustrated specific embodiments of the invention, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the invention in any way, but rather to illustrate the concept of the invention to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0021] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention.
[0022] With the development of intelligent monitoring, facial recognition, and smart security devices, more and more scenarios require the storage of large amounts of image and video files. Furthermore, as technology advances, the number of image and video files captured by cameras is increasing dramatically. Simultaneously, intelligent devices employ one or more artificial intelligence algorithms, which need to recognize images or videos of varying sizes and resolutions. Currently, research on artificial intelligence devices focuses primarily on algorithms and computing power. However, as these algorithms develop, storage resources may become insufficient to support them. Therefore, how to store image and video files generated or received by intelligent devices on storage media and improve the storage performance of these media is a pressing issue that needs to be addressed.
[0023] In existing technologies, when storing files, image files, video files, and other built-in files generated by smart devices of different sizes are usually stored in the same memory area. This results in different types and sizes of files being stored together, which increases the randomness of data block allocation. Data blocks may be scattered in different locations on the disk, causing a large amount of memory fragmentation and wasting memory space. At the same time, storing different types of files in the same memory area results in lower data throughput and read / write operations per second, both of which contribute to lower storage performance of smart devices.
[0024] Figure 1 This invention provides an application scenario diagram where a smart device can generate files such as images. The device can filter images based on the storage requirements of an artificial intelligence algorithm. These requirements can be user-inputted information. After filtering, the target file type of the image can be determined. Furthermore, based on the storage requirements, memory regions can be allocated for different target file types, and the filtered images can be stored in the corresponding memory regions. This application, based on the storage requirements of the algorithm in the smart device, establishes dedicated target file types for files to be stored according to characteristics such as file type, file size, and storage period. This enables the creation of separate memory regions for massive image files, video files, and other extremely large files. Simultaneously, corresponding management parameters are set for each memory region based on the characteristics of each file. By storing files separately and setting different management parameters, the storage performance of the smart device is improved, and the device's lifespan is extended.
[0025] Figure 2 This is a flowchart illustrating a file management method provided in an embodiment of the present invention. The method is applied to a smart device, such as... Figure 2 As shown, the method includes: Step S201: In response to the creation instruction of the target file type, create the target file type for the corresponding file to be stored, and allocate a memory area for the file to be stored corresponding to the target file type; the creation instruction is triggered according to the storage requirements of at least one artificial intelligence algorithm in the smart device; the storage requirements include at least one of the file type, file size and storage period of the file to be stored that the artificial intelligence algorithm wants to identify.
[0026] The creation instructions are used to create target file types. For example, if the artificial intelligence algorithm needs to identify three types of files to be stored: standard definition (SD) images (size less than or equal to a first value), high definition (HD) images (size greater than the first value but less than a second value), and a one-minute video file, then three creation instructions can be generated based on these storage requirements. Each creation instruction is used to create one target file type. The first target file type is a SD image, the second is a HD image, and the third is a video file.
[0027] Creation commands can be user-triggered, where the user triggers the creation command for the corresponding file to be stored based on the storage requirements of the artificial intelligence algorithm. Alternatively, creation commands can be automatically triggered after automatically parsing the storage requirements of the artificial intelligence algorithm within the smart device.
[0028] The number of artificial intelligence algorithms in a smart device can be one or more.
[0029] The storage requirements include the file type, file size, and retention period of the files to be stored. For example, if the files to be stored include image files and video files, which are different file types, they need to be stored separately. Similarly, if all the files to be stored are images, and the image sizes are different, they also need to be stored separately. Furthermore, files with the same image size but different retention periods can also be stored separately. For example, if two images are both 3 MB in size but have different retention periods—one image is generated and saved every 30 seconds, and the other is generated and saved every minute—then storing them separately allows for the allocation of different memory spaces and separate management.
[0030] Creating a target file type for the corresponding file to be stored involves setting the attribute parameters, file size, and file name of that target file type. This information is used to filter the files to be stored. After creating the target file type, the file name will be returned, such as "10min vedio," indicating successful creation. The attribute parameters, file size, and file name can be user-defined or determined based on the storage requirements of each file to be stored. For example, if the storage requirement is for a 10-minute video file, the file name could be set to "10min vedio."
[0031] After creating a target file type, memory regions can be allocated for the files to be stored corresponding to that target file type, allowing files of the same target file type to be stored in the same memory region. For example, for three target file types, three memory regions can be set up, with each memory region storing only the files corresponding to that target file type.
[0032] Step S202: Filter the files to be stored and store the files that meet the storage requirements into the corresponding memory area.
[0033] After allocating memory regions for the files to be stored, when a smart device generates a file to be stored, it can determine whether the file needs to be stored and in which memory region it should be stored.
[0034] Specifically, in this process, it can be determined whether the file to be stored meets the storage requirements, and the file to be stored that meets the storage requirements will be stored.
[0035] When smart devices operate continuously, they need to repeatedly store and delete files. This storage and deletion process accelerates the aging of the storage media, especially when large and small files are stored in the same memory area. If a large file needs to be stored, deleting a small file in the memory area may result in insufficient memory to hold the large file. Multiple small files in the memory area need to be merged to create a larger block of memory. However, this merging process requires erasing and re-storing the small files, which is an ineffective erasure and affects the lifespan of the storage media. Storing large and small files separately avoids interference from small files, reduces unnecessary erasures, and thus extends the lifespan of the storage media.
[0036] Step S203: Receive the management parameters set by the user for the target file type of each memory region, and manage the memory region according to the management parameters.
[0037] For each memory region, management parameters can be set for the target file type to manage that region. Different management parameters can be set based on the characteristics of the files stored in each memory region, allowing for personalized, full-lifecycle management of files in different memory regions. By setting different management parameters, the memory in the storage medium can be used effectively, enabling rapid management of files of that target file type.
[0038] By leveraging algorithms from smart devices, separate memory regions are created for massive amounts of images, videos, and extremely large files. Furthermore, by combining the characteristics of different files, a unique memory management mechanism is established for each memory region, addressing the issue of storage performance keeping pace with the rapid development of computing power in artificial intelligence algorithms.
[0039] Furthermore, by storing files of different target file types separately, the artificial intelligence algorithm can quickly determine the file storage location when extracting files, and the movement distance of the disk head is also shorter, which can improve the ability of the artificial intelligence algorithm to extract data from files such as images and videos.
[0040] This invention provides a file management method that, in response to a creation instruction for a target file type, creates the target file type for a corresponding file to be stored and allocates a memory region for the file to be stored corresponding to the target file type. The creation operation is triggered based on the storage requirements of at least one artificial intelligence algorithm in the smart device. The storage requirements include at least one of the file type, file size, and storage period of the file to be stored that the artificial intelligence algorithm needs to identify. The method filters the files to be stored and stores files that meet the storage requirements into the corresponding memory regions. It receives management parameters set by the user for the target file type of each memory region and manages the memory regions according to the management parameters. Different target file types can be created according to the storage requirements of the artificial intelligence algorithm in the device, enabling the creation of separate memory regions for very large files such as images and videos, and setting up a unique memory management mechanism to solve the problem of low storage performance of smart devices.
[0041] Optionally, the management parameters include: a memory remaining threshold and adjustment parameters; managing the memory region according to the management parameters includes: For each memory region, when the memory balance of the memory region is less than the corresponding memory balance threshold, the memory region is determined to be a memory region to be adjusted. The memory region to be adjusted is adjusted according to the adjustment parameters of the memory region to be adjusted and the adjustment parameters of other memory regions; The other memory regions include: memory regions other than the memory region corresponding to the first artificial intelligence algorithm; the first artificial intelligence algorithm is the artificial intelligence algorithm corresponding to the memory region to be adjusted.
[0042] Management parameters include memory reserve thresholds, which determine whether memory in a given memory region needs adjustment. These thresholds can differ for different memory regions. For example, a higher threshold can be set for the memory region of a file to be identified and stored by a higher-level AI algorithm to ensure its proper operation, while a lower threshold can be set for the memory region of a file to be identified and stored by a lower-level AI algorithm.
[0043] During the file storage process, the memory availability of each memory region can be monitored in real time. When the memory availability is less than or equal to the corresponding memory availability threshold, it indicates that the available memory in that memory region is small and needs to be adjusted.
[0044] Management parameters also include adjustment parameters, which are used to adjust the size of memory regions. When adjusting the memory region to be adjusted, it needs to be adjusted based on the adjustment parameters of the memory region to be adjusted and the adjustment parameters of other memory regions. By adjusting based on the adjustment parameters of other memory regions, it is possible to dynamically adjust the target file type corresponding to a specific memory block.
[0045] Here, "other memory regions" refers to memory regions other than the memory region corresponding to the first artificial intelligence algorithm. For example, there are memory regions A, B, C, and D. Memory region A is the memory region to be adjusted, and both memory regions A and B correspond to the first artificial intelligence algorithm. Then, the other memory regions are memory regions C and D. This is because, when adjusting memory, priority is usually given to ensuring the normal operation of artificial intelligence algorithms with higher importance levels, and memory space is usually not allocated from memory regions belonging to the same artificial intelligence algorithm.
[0046] By automatically activating a self-adjusting mechanism based on memory availability thresholds and adjustment parameters, effective adjustment of the memory region to be adjusted is achieved, thereby improving the normal operation of artificial intelligence algorithms in smart devices.
[0047] Optionally, the adjustment parameters include memory fragmentation optimization parameters and memory allocation optimization parameters; adjusting the memory region based on the adjustment parameters of the memory region to be adjusted and the adjustment parameters of other memory regions includes: When the number of memory fragments in the memory region to be adjusted is greater than the memory fragmentation optimization parameter, fragmentation optimization is performed on the memory region to be adjusted. When there are multiple memory regions to be adjusted and the number of memory fragments in each memory region to be adjusted is less than the memory fragment optimization parameter, the current memory region to be adjusted is determined from the multiple memory regions to be adjusted, and the target memory region is determined from other memory regions where there is continuous idle memory for a preset time. Based on the memory allocation optimization parameters of the target memory region, a corresponding amount of memory is added to the memory region corresponding to the preset target file type; the preset target file type is the target file type corresponding to the current memory region to be adjusted.
[0048] When adjusting a memory region, fragmentation optimization should be performed first. Storing files of the same size in the same memory region reduces the likelihood of data blocks being scattered across different disk locations, compared to storing files of different sizes in the same region. However, memory fragmentation is still unavoidable. Therefore, fragmentation optimization should be performed before adjusting a memory region.
[0049] Therefore, when adjusting a memory region, fragmentation optimization can be performed first based on the memory fragmentation optimization parameters. When the number of memory fragments in the memory region to be adjusted exceeds the memory fragmentation optimization parameters, usable memory can be recovered after memory fragmentation optimization.
[0050] Furthermore, if the number of fragments in the memory region to be adjusted is within the normal range after fragmentation optimization, but the region still experiences memory shortages, it can be determined whether there are other memory regions that are continuously idle for a preset time period. If so, a certain amount of memory from these other memory regions can be added to the memory region corresponding to the preset target file type. Specifically, for each other memory region, it can be queried whether there are instances of long-term idle memory in that region, such as a portion of the memory in the region remaining idle for a preset time period.
[0051] When there are many memory regions to be adjusted, it is necessary to determine the current memory region to be adjusted from multiple memory regions to be adjusted. When there are other memory regions that are continuously idle for a preset time, a target memory region can be determined from other memory regions that meet the conditions.
[0052] The memory allocation optimization parameters can be different for each memory region. After determining the target memory region and the current memory region to be adjusted, the memory corresponding to the memory allocation optimization parameters in the target memory region can be added to the memory region corresponding to the preset target file type. This preset target file type is the target file type corresponding to the current memory region to be adjusted.
[0053] Figure 3 This is a schematic diagram illustrating a process for adjusting a memory region to be adjusted, provided as an embodiment of the present invention. Figure 3 As shown, when the memory margin of a memory region is less than the corresponding memory margin threshold, fragmentation optimization can be performed first, followed by memory fragmentation optimization.
[0054] By first optimizing fragmentation and then optimizing memory allocation, the memory size of the memory region to be adjusted can be effectively adjusted, enabling the artificial intelligence algorithm corresponding to the target file type to run normally.
[0055] Optionally, the current memory region to be adjusted is determined from multiple memory regions to be adjusted, including: Determine the importance level of the artificial intelligence algorithm corresponding to each memory region to be adjusted; determine the memory region to be adjusted corresponding to the artificial intelligence algorithm with the highest importance level as the current memory region to be adjusted. Accordingly, the target memory region is determined from other memory regions where there is long-term free memory, including: Determine the importance level of the artificial intelligence algorithm corresponding to each other memory region; determine the memory region corresponding to the artificial intelligence algorithm with the lowest importance level as the target memory region; Correspondingly, the memory allocation optimization parameters for each memory region are negatively correlated with the importance level of the corresponding artificial intelligence algorithm.
[0056] In determining the current memory region to be adjusted from all the memory regions to be adjusted, the artificial intelligence algorithm corresponding to each memory region to be adjusted can be determined, and then the importance level of the artificial intelligence algorithm can be determined. In order to prioritize the normal operation of the core functions in the smart device, the memory region to be adjusted corresponding to the artificial intelligence algorithm with the highest importance level can be determined as the current memory region to be adjusted.
[0057] Specifically, when allocating memory regions for files of the target file type, the corresponding AI algorithm for each memory region can be identified. This allows for rapid determination of the AI algorithm when the current memory region to be adjusted is identified. Furthermore, a table mapping AI algorithms to their importance levels can be stored. Once the AI algorithm corresponding to the memory region to be adjusted is determined, its importance level can be determined by querying the table.
[0058] Correspondingly, when determining the target memory region, another memory region corresponding to the lowest priority AI algorithm can be selected as the target memory region. That is, a portion of the free memory in the memory region of the lowest priority AI algorithm is allocated first, also to ensure the normal operation of the core functions in the smart device.
[0059] Optionally, different memory allocation optimization parameters can be set for each memory region. If the AI algorithm corresponding to the memory region has a higher level, a smaller memory allocation optimization parameter can be set, which means that a smaller portion of the memory can be allocated. If the AI algorithm corresponding to the memory region has a lower level, a larger memory allocation optimization parameter can be set, which means that a larger portion of the memory can be allocated.
[0060] The above method determines the current memory region to be adjusted and the target memory region based on the importance level of the corresponding artificial intelligence algorithm for the memory region, and determines the memory allocation optimization parameters for each memory region based on the importance level of the artificial intelligence algorithm. This can prioritize ensuring the normal use of core functions in smart devices and improve the user experience of smart devices.
[0061] Optionally, the management parameters also include file coverage level; after allocating a corresponding amount of memory to the memory region to be adjusted according to the memory allocation optimization parameters of the other memory regions, if the memory balance of the memory region to be adjusted is less than the corresponding memory balance threshold, the method further includes: Increase the file coverage level corresponding to the memory region to be adjusted; erase the files in the memory region to be adjusted according to the adjusted file coverage level.
[0062] After performing fragmentation and memory allocation optimization on the memory region to be adjusted, if memory in that region is still relatively scarce, the file coverage level of that region can be adjusted by increasing it. When the file coverage level is increased, older files stored in that memory region can be erased more promptly. This is because artificial intelligence algorithms typically focus more on newly generated or received files; therefore, the frequency of erasing older files can be appropriately increased. To increase the frequency of erasing older files, the file coverage level of the memory region to be adjusted can be increased. For example... Figure 3 As shown, if memory shortages persist after performing fragmentation and memory allocation optimizations, the file overwrite level can be adjusted.
[0063] For example, if the initial file coverage level for the memory region to be adjusted is 5 days, and the file coverage level is increased to 4 days, then the files in the memory region can be erased after 4 days of storage.
[0064] By adjusting the file coverage level of the memory region to be adjusted, further adjustments can be made to the memory region to be adjusted after fragmentation optimization and memory allocation optimization, thereby improving the lifespan of storage media in smart devices.
[0065] Optionally, the files to be stored include files generated by smart devices. Filtering the files to be stored and storing those that meet the storage requirements in the corresponding memory area includes: Determine whether the attribute parameters of the file generated by the smart device are the same as the attribute parameters of any target file type; if they are the same, determine whether the size of the generated file conforms to the size level corresponding to the target file type, and / or whether the security level of the generated file conforms to the security level corresponding to the target file type; if they conform, store the file generated by the smart device continuously in the memory area corresponding to the target file type, so that the corresponding artificial intelligence algorithm can sequentially read and write the file in the memory area during runtime.
[0066] When storing a file, it's necessary to determine if it matches any of the created target file types. Specifically, first, check if the attribute parameters of the file to be stored are the same as those of any created target file type. These attribute parameters indicate whether the file type matches the target file type. If they match, it's also necessary to check if the file size matches the size range corresponding to the target file type. For example, if the target file type is a high-definition image, and high-definition images have a size range, such as 2MB to 4MB, if the file to be stored is smaller than 2MB, it indicates the image may be corrupted. Therefore, this image does not meet the storage requirements of this target file type and needs to be filtered out.
[0067] In addition to determining the file size, it can also determine the file's security level. If the file meets the security level corresponding to the target file type, it can be stored.
[0068] After determining the file type, file size, and / or security level as described above, files that meet the criteria can be stored contiguously in the memory area corresponding to the target file type. Contiguous storage can refer to storing files according to their creation time, allowing older files to be stored first. By storing files chronologically, the corresponding artificial intelligence algorithm can read the files stored in that memory area sequentially during runtime, improving the efficiency of the AI algorithm in reading files.
[0069] Because the files are stored contiguously, such as different images that an artificial intelligence algorithm needs to recognize being stored continuously in memory, the disk head moves a shorter distance and takes less time when seeking, thus making it faster for the artificial intelligence algorithm to read the files.
[0070] Optionally, for each memory region, the files stored in the memory region are indexed and managed.
[0071] The system can be configured to manage the indexing of files stored for the same target file type. This indexing improves the efficiency of file reading for artificial intelligence algorithms. Specifically, when an AI algorithm reads a file, the disk head searches for the file and determines its starting location based on its index. When the indexing unit only manages the index of files stored within the same memory region, it avoids interference from other file types, allowing the disk head to quickly determine the index of the file to be read, thus improving file reading efficiency.
[0072] If a file does not meet any of the above criteria for file type, file size, or security level, the file will be deleted.
[0073] By filtering files, we can avoid storing files that do not meet storage requirements, which can reduce storage pressure on the storage area and prevent artificial intelligence algorithms from reading invalid files. In addition, by filtering files that do not meet the size requirements, we can avoid memory interference between files of different sizes.
[0074] Optionally, the files to be stored also include external files. The files to be stored are filtered, and files that meet the storage requirements are stored in the corresponding memory area, including: Check whether the file information of the incoming file conforms to the file regulations of the smart device; the file information includes the file format and file content; if it conforms, store the incoming file in the corresponding memory area in sequence; if it does not conform, delete the received incoming file.
[0075] In addition to files generated by smart devices, it may also be necessary to store external files received by the smart devices. Artificial intelligence algorithms can use these external files for scene analysis, recognition, or decision-making. When storing external files, file information can be obtained, and it can be determined whether the file information conforms to the smart device's file specifications. Specifically, file information includes file format and file content. File format refers to image format, text format, etc. This can be determined by the file extension. For example, if the extension is .gif, it indicates that the file is a static or animated image. Checking the file content mainly determines whether the file contains malware, viruses, external online advertisements, information, etc., to avoid small files interfering with memory areas, and to prevent files with security risks from causing security and performance damage to the file system.
[0076] When an incoming file conforms to the smart device's file specifications, it can be stored in the order of its receipt time. When an incoming file does not conform to the smart device's file specifications, it will be deleted.
[0077] By inspecting incoming files, we can prevent small files from interfering with memory areas and prevent files with security risks from causing security and performance damage to the file system, thereby improving the security of the file system.
[0078] Optionally, the method further includes: The system receives a user-triggered command to view the folder corresponding to any memory region, and displays the file information, memory usage status, and current management parameters of the memory region according to the command. The file information includes the file name and storage path. The memory usage status includes available memory information, the presence of bad blocks, and the number of erase / write cycles.
[0079] Each memory region can be assigned a folder to store relevant information. Specifically, this can include file information for the memory region, such as the storage path, filename, and file size of each file. It can also include the overall status information of the memory region, such as the total memory size, available memory, used memory, presence of bad blocks, and write / erase counts. Users can also view the current management parameters for the corresponding memory region, such as memory availability thresholds, memory fragmentation optimization parameters, memory allocation optimization parameters, and file coverage levels.
[0080] Users can trigger commands to view the folder corresponding to a specific memory region. For example, clicking on the folder will display the relevant information within that folder.
[0081] By setting up a folder for each memory region and saving file information within that region, users can understand the usage of that memory region.
[0082] Optionally, a memory region may be allocated for the file to be stored corresponding to this target file type, including: Based on at least one of the following factors input by the user: file size, number of files to be stored, and erase / write frequency, determine the memory size corresponding to the target file type; and divide the memory area for the file to be stored corresponding to the target file type based on the determined memory size.
[0083] In order to make reasonable use of the memory of the storage medium, when allocating memory regions for files to be stored corresponding to the target file type, customization can be carried out, that is, different sizes of memory regions can be set for files to be stored for different target file types.
[0084] Specifically, the memory allocation size can be determined based on factors such as file size, the number of files stored, and the frequency of write / erase operations. Larger files, a larger number of files stored, and a lower write / erase frequency require a larger memory allocation; conversely, smaller files, fewer files stored, and a higher write / erase frequency require a smaller memory allocation.
[0085] By dividing different memory regions of different sizes according to the characteristics of the files to be stored, the memory region division becomes more reasonable, which can improve the rational utilization of memory.
[0086] Figure 4 A flowchart illustrating another file management method provided in an embodiment of the present invention is shown below. Figure 4 As shown, the entire file management process is as follows: First, determine the storage requirements of the AI algorithm in the smart device for files. Second, determine whether it is necessary to create target file types for videos or images. If so, create the target file type according to the actual needs, allocate memory areas, and set management parameters according to the actual needs, including memory availability thresholds, memory fragmentation optimization parameters, memory allocation optimization parameters, and file coverage levels. Third, call the file system service interface to perform corresponding operations on the files (deletion and other operations can be performed after file filtering and security checks). Fourth, filter and perform security checks on the files. Finally, perform index management, file coverage level management, fragmentation optimization management, and memory allocation optimization management for the target file type.
[0087] In addition, various service interfaces are set up for the entire file management process to realize different file operations, such as creating files, opening files, reading files, writing files, querying file management parameters, modifying file management parameters, deleting files, generating images, deleting images, saving videos, deleting videos, capturing photos, starting or stopping recording, and starting or stopping video playback. When operating on files, a file type singleton must first be created, and then the file operation methods are called using the file type singleton. For example, assuming a file type `high_video` is created for high-definition video, `high_video->ht_create(filename, file path)` is executed. After the file type is successfully created, when a file of the corresponding type is generated, `high_video->ht_write(filename, file path)` is executed, which automatically writes the file to the allocated memory area for high-definition video.
[0088] Figure 5 A schematic diagram of the structure of a file management system provided in an embodiment of the present invention is shown below. Figure 5 As shown, the file management system 50 is applied to smart devices, and the file management system includes: The processing module 501 is configured to respond to a creation instruction for a target file type, create the target file type for the corresponding file to be stored, and allocate a memory area for the file to be stored corresponding to the target file type; the creation instruction is triggered based on the storage requirements of at least one artificial intelligence algorithm in the smart device; the storage requirements include at least one of the file type, file size, and storage period of the file to be stored that the artificial intelligence algorithm wants to identify; Storage module 502 is used to filter files to be stored and store files that meet the storage requirements into the corresponding memory area; The management module 503 is used to receive management parameters set by the user for the target file type of each memory region, and to manage the memory region according to the management parameters.
[0089] Optionally, the management module 503 manages the memory region according to the management parameters, specifically for: For each memory region, when the memory balance of the memory region is less than the corresponding memory balance threshold, the memory region is determined to be a memory region to be adjusted. The memory region to be adjusted is adjusted according to the adjustment parameters of the memory region to be adjusted and the adjustment parameters of other memory regions; The other memory regions include: memory regions other than the memory region corresponding to the first artificial intelligence algorithm; the first artificial intelligence algorithm is the artificial intelligence algorithm corresponding to the memory region to be adjusted.
[0090] Optionally, when the management module 503 adjusts the memory region according to the adjustment parameters of the memory region to be adjusted and the adjustment parameters of other memory regions, it is specifically used for: When the number of memory fragments in the memory region to be adjusted is greater than the memory fragmentation optimization parameter, fragmentation optimization is performed on the memory region to be adjusted. When there are multiple memory regions to be adjusted and the number of memory fragments in each memory region to be adjusted is less than the memory fragment optimization parameter, the current memory region to be adjusted is determined from the multiple memory regions to be adjusted, and the target memory region is determined from other memory regions where there is continuous idle memory for a preset time. Based on the memory allocation optimization parameters of the target memory region, a corresponding amount of memory is added to the memory region corresponding to the preset target file type; the preset target file type is the target file type corresponding to the current memory region to be adjusted.
[0091] Optionally, when the management module 503 determines the current memory region to be adjusted from multiple memory regions to be adjusted, it is specifically used for: Determine the importance level of the artificial intelligence algorithm corresponding to each memory region to be adjusted; determine the memory region to be adjusted corresponding to the artificial intelligence algorithm with the highest importance level as the current memory region to be adjusted. Accordingly, when the management module 503 determines the target memory region from other memory regions where there is continuously idle memory for a preset time, it is specifically used for: Determine the importance level of the artificial intelligence algorithm corresponding to each other memory region; determine the memory region corresponding to the artificial intelligence algorithm with the lowest importance level as the target memory region; Correspondingly, the memory allocation optimization parameters for each memory region are negatively correlated with the importance level of the corresponding artificial intelligence algorithm.
[0092] Optionally, the device further includes a file coverage level adjustment module, specifically used for: Increase the file coverage level corresponding to the memory region to be adjusted; The files within the memory area to be adjusted are erased according to the adjusted file coverage level.
[0093] Optionally, storage module 502 is specifically used for: Determine whether the attribute parameters of the file generated by the smart device are the same as the attribute parameters of any target file type; If they are the same, then determine whether the size of the generated file conforms to the size level corresponding to the target file type, and / or whether the security level of the generated file conforms to the security level corresponding to the target file type; If the conditions are met, the files generated by the smart device will be stored contiguously in the memory area corresponding to the target file type, so that the corresponding artificial intelligence algorithm can sequentially read and write the files in the memory area during runtime.
[0094] Optionally, the storage module 502 is specifically used to: check whether the file information of the external file conforms to the file regulations of the smart device; the file information includes file format and file content; if it conforms, store the external file in the corresponding memory area in sequence; if it does not conform, delete the received external file.
[0095] Optionally, the device further includes: a display module, specifically used for: The system receives a user-triggered command to view the folder corresponding to any memory region, and displays the file information, memory usage status, and current management parameters of the memory region according to the command. The file information includes the file name and storage path. The memory usage status includes available memory information, the presence of bad blocks, and the number of erase / write cycles.
[0096] Optionally, the processing module 501 is specifically used for: The memory size corresponding to the target file type is determined based on at least one of the following: file size, number of files to be stored, and erase / write frequency input by the user. The memory area is divided according to the determined memory size for the file to be stored corresponding to the target file type.
[0097] The file management system provided in this embodiment of the invention can achieve the above-mentioned functions. Figure 2 The file management method shown in the embodiment has a similar implementation principle and technical effect, and will not be described again here.
[0098] Figure 6 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present invention. Figure 6 As shown, the electronic device provided in this embodiment includes at least one processor 601 and a memory 602. The processor 601 and the memory 602 are connected via a bus 603.
[0099] In a specific implementation, at least one processor 601 executes computer execution instructions stored in memory 602, causing at least one processor 601 to execute the method in the above method embodiment.
[0100] The specific implementation process of processor 601 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.
[0101] In the above Figure 6 In the illustrated embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.
[0102] The memory may include high-speed RAM, and may also include non-volatile storage (NVM), such as at least one disk storage.
[0103] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0104] This invention also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the method described in the above embodiments.
[0105] The aforementioned computer-readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.
[0106] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.
[0107] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0108] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A file management method, characterized in that, The method is applied to a smart device, and the method includes: In response to a creation instruction for a target file type, the target file type is created for the corresponding file to be stored, and a memory region is allocated for the file to be stored corresponding to the target file type; the creation instruction is triggered based on the storage requirements of at least one artificial intelligence algorithm in the smart device; the storage requirements include at least one of the file type, file size, and storage period of the file to be stored that the artificial intelligence algorithm wants to identify; Filter the files to be stored and store the files that meet the storage requirements into the corresponding memory area; The system receives management parameters set by the user for the target file type of each memory region. These management parameters include: memory margin threshold and adjustment parameters, memory fragmentation optimization parameters, and memory allocation optimization parameters. The memory allocation optimization parameters for each memory region are negatively correlated with the importance level of the corresponding artificial intelligence algorithm. For each memory region, when the remaining memory in the memory region is less than the corresponding remaining memory threshold, the memory region is determined as a memory region to be adjusted; when the number of memory fragments in the memory region to be adjusted is greater than the memory fragmentation optimization parameter, fragmentation optimization is performed on the memory region to be adjusted; when there are multiple memory regions to be adjusted and the number of memory fragments in each memory region to be adjusted is less than the memory fragmentation optimization parameter, the importance level of the artificial intelligence algorithm corresponding to each memory region to be adjusted is determined; the memory region to be adjusted corresponding to the artificial intelligence algorithm with the highest importance level is determined as the current memory region to be adjusted; the importance level of the artificial intelligence algorithm corresponding to each other memory region is determined; the memory region corresponding to the artificial intelligence algorithm with the lowest importance level is determined as the target memory region; according to the memory allocation optimization parameter of the target memory region, the corresponding amount of memory is added to the memory region corresponding to the preset target file type; the preset target file type is the target file type corresponding to the current memory region to be adjusted; wherein, the other memory regions include: memory regions other than the memory region corresponding to the first artificial intelligence algorithm; the first artificial intelligence algorithm is the artificial intelligence algorithm corresponding to the memory region to be adjusted.
2. The method according to claim 1, characterized in that, The management parameters also include file coverage levels; the method further includes: After adding the corresponding amount of memory to the memory region corresponding to the preset target file type according to the memory allocation optimization parameters of the target memory region, if the memory balance of the current memory region to be adjusted is still less than the corresponding memory balance threshold, the file coverage level of the current memory region to be adjusted is increased, and the files in the current memory region to be adjusted are erased according to the adjusted file coverage level.
3. The method according to claim 1, characterized in that, The files to be stored include files generated by smart devices. The files to be stored are filtered, and files that meet the storage requirements are stored in the corresponding memory areas, including: Determine whether the attribute parameters of the file generated by the smart device are the same as the attribute parameters of any target file type; If they are the same, then determine whether the size of the generated file conforms to the size level corresponding to the target file type, and / or whether the security level of the generated file conforms to the security level corresponding to the target file type; If the conditions are met, the files generated by the smart device will be stored contiguously in the memory area corresponding to the target file type, so that the corresponding artificial intelligence algorithm can sequentially read and write the files in the memory area during runtime.
4. The method according to claim 3, characterized in that, The files to be stored also include external files. The files to be stored are filtered, and files that meet the storage requirements are stored in the corresponding memory areas, including: Check whether the file information of the external file conforms to the file regulations of the smart device; the file information includes the file format and file content; If the conditions are met, the external files will be stored sequentially into the corresponding memory areas; If it does not meet the requirements, the received external file will be deleted.
5. The method according to any one of claims 1-4, characterized in that, The method further includes: The system receives a user-triggered command to view the folder corresponding to any memory region, and displays the file information, memory usage status, and current management parameters of the memory region according to the command. The file information includes the file name and storage path. The memory usage status includes available memory information, the presence of bad blocks, and the number of erase / write cycles.
6. The method according to any one of claims 1-4, characterized in that, Allocate memory regions for the files to be stored corresponding to this target file type, including: The memory size corresponding to the target file type is determined based on at least one of the following: file size, number of files to be stored, and erase / write frequency input by the user. The memory area is divided according to the determined memory size for the file to be stored corresponding to the target file type.
7. A document management system, characterized in that, The system is applied to smart devices, and the system includes: The processing module is configured to respond to a creation instruction for a target file type, create the target file type for the corresponding file to be stored, and allocate a memory area for the file to be stored corresponding to the target file type; the creation instruction is triggered based on the storage requirements of at least one artificial intelligence algorithm in the smart device; the storage requirements include at least one of the file type, file size, and storage period of the file to be stored that the artificial intelligence algorithm needs to identify; The storage module is used to filter files to be stored and store files that meet the storage requirements into the corresponding memory area. The management module receives management parameters set by the user for the target file type of each memory region. These management parameters include: memory margin threshold and adjustment parameters, memory fragmentation optimization parameters, and memory allocation optimization parameters. The memory allocation optimization parameters for each memory region are negatively correlated with the importance level of the corresponding artificial intelligence algorithm. For each memory region, when the memory margin of the region is less than the corresponding memory margin threshold, the region is determined to be a memory region to be adjusted. When the number of memory fragments in the region to be adjusted is greater than the memory fragmentation optimization parameters, fragmentation optimization is performed on the region to be adjusted. When there are multiple regions to be adjusted and the number of memory fragments in each region is less than the memory fragmentation optimization parameters, then... The importance level of the artificial intelligence algorithm corresponding to each memory region to be adjusted is determined; the memory region corresponding to the artificial intelligence algorithm with the highest importance level is determined as the current memory region to be adjusted; the importance level of the artificial intelligence algorithm corresponding to each other memory region is determined; the memory region corresponding to the artificial intelligence algorithm with the lowest importance level is determined as the target memory region; according to the memory allocation optimization parameters of the target memory region, a corresponding amount of memory is added to the memory region corresponding to a preset target file type; the preset target file type is the target file type corresponding to the current memory region to be adjusted; wherein, the other memory regions include: memory regions other than the memory region corresponding to the first artificial intelligence algorithm; the first artificial intelligence algorithm is the artificial intelligence algorithm corresponding to the memory region to be adjusted.
8. An electronic device, characterized in that, include: At least one processor and memory; The memory stores computer-executed instructions; The at least one processor executes computer execution instructions stored in the memory, causing the at least one processor to perform the method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, implement the method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Data processing method and device
CN109656836A
File screening method and computing device
CN114880288A
