CN117785471A - Picture processing method, device, equipment and storage medium - Google Patents

Picture processing method, device, equipment and storage medium Download PDF

Info

Publication number
CN117785471A
CN117785471A CN202311855982.8A CN202311855982A CN117785471A CN 117785471 A CN117785471 A CN 117785471A CN 202311855982 A CN202311855982 A CN 202311855982A CN 117785471 A CN117785471 A CN 117785471A
Authority
CN
China
Prior art keywords
picture
picture processing
memory
data
overhead
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311855982.8A
Other languages
Chinese (zh)
Inventor
黄涛
叶松杰
王镖
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Merchants Bank Co Ltd
Original Assignee
China Merchants Bank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Merchants Bank Co Ltd filed Critical China Merchants Bank Co Ltd
Priority to CN202311855982.8A priority Critical patent/CN117785471A/en
Publication of CN117785471A publication Critical patent/CN117785471A/en
Pending legal-status Critical Current

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Image Processing (AREA)

Abstract

The application discloses a picture processing method, a device, equipment and a storage medium, and belongs to the field of picture processing. The method comprises the following steps: acquiring picture characteristic information; performing memory overhead prediction according to the picture characteristic information through a preset picture task overhead prediction model to obtain picture processing memory overhead data; and distributing memory resources to execute corresponding picture processing tasks according to the picture processing memory overhead data to obtain a picture processing result. By performing memory overhead prediction according to the picture feature information, memory resources can be effectively allocated. Therefore, the method and the device realize that the memory resources are allocated according to the requirements of the picture processing task to process the picture, and solve the technical problem that the memory resources cannot be allocated according to the memory overhead required by the picture processing task in the prior art. Compared with the prior art, the method has the advantages of high memory resource utilization rate and strong stability.

Description

Picture processing method, device, equipment and storage medium
Technical Field
The present disclosure relates to the field of image processing, and in particular, to a method, an apparatus, a device, and a storage medium for processing an image.
Background
As the number of business systems that need to perform operations such as watermarking, cropping, scaling, compression, etc. increases, the traffic pressure carried by the services that provide the graphics processing is also increasing. Because the quality of the picture has uncertainty, in order to ensure the running stability of the system, a part of applications only set a certain concurrency number in a picture operation interface used by a user, and ensure the stability by a counting limitation method, so that the following problems are caused:
(1) The picture quality is uneven, the memory overhead required by decoding and operation cannot be determined, and the threshold value of the concurrency of an application interface is difficult to determine;
(2) When a large number of low-quality picture tasks occur, due to the limitation of concurrency, the overall memory overhead condition of the application is low, and the current container platform is used for carrying out elastic expansion mainly according to the CPU and memory use condition, so that the elastic condition of the container is difficult to trigger, and the task processing is slow or a large number of tasks are refused overtime;
(3) When a large number of high-quality picture tasks occur, the memory overhead condition is high, the higher memory is occupied before the interface concurrency limit is not reached, and the memory overflow condition is easy to occur.
Disclosure of Invention
The main purpose of the present application is to provide a method, an apparatus, a device and a storage medium for processing a picture, which aim to solve the problem that memory resources cannot be allocated according to memory overhead required by a picture processing task.
In order to achieve the above object, the present application provides a picture processing method, including the steps of:
acquiring picture characteristic information;
performing memory overhead prediction according to the picture characteristic information through a preset picture task overhead prediction model to obtain picture processing memory overhead data;
and distributing memory resources to execute corresponding picture processing tasks according to the picture processing memory overhead data to obtain a picture processing result.
Optionally, the step of allocating memory resources to execute corresponding picture processing tasks according to the picture processing memory overhead data to obtain a picture processing result includes:
acquiring real-time idle memory resource data through a preset memory monitoring module;
judging whether the picture processing memory overhead data is smaller than the real-time idle memory resource data or not;
if yes, processing the memory overhead data according to the picture, and generating a picture processing thread;
and according to the picture processing thread, distributing memory resources to execute the picture processing task to obtain the picture processing result.
Optionally, after the step of determining whether the picture processing memory overhead data is smaller than the real-time idle memory resource data, the method further includes:
if not, processing the memory overhead data according to the picture, sending the picture processing task to a preset message queue, and generating a picture thread to be processed;
when the memory monitoring module monitors that the real-time idle memory resource data is larger than the picture processing memory overhead data, taking out the picture processing task from the message queue, and waking up a picture waiting thread;
and according to the picture to-be-processed thread, distributing memory resources to execute the picture processing task to obtain the picture processing result.
Optionally, after the step of allocating memory resources to execute the corresponding picture processing task according to the picture processing memory overhead data to obtain the picture processing result, the method further includes:
acquiring picture processing memory overhead information according to the picture processing result;
uploading the picture characteristic information and the picture processing memory overhead information to a preset data storage engine;
establishing a training set according to the picture characteristic information and picture processing memory overhead information through the data storage engine;
Based on a preset machine learning algorithm, updating the picture task memory overhead model according to the training set.
Optionally, the step of obtaining the picture feature information includes:
receiving a picture processing request and a picture corresponding to the picture processing task;
analyzing the picture according to the picture processing request to obtain picture analysis data;
based on a preset data cleaning algorithm, performing data cleaning on the picture analysis data to obtain initial picture feature data;
and carrying out feature extraction on the initial picture feature data based on a preset feature extraction algorithm to obtain the picture feature information.
Optionally, the step of performing memory overhead prediction according to the picture feature information by using a preset picture task overhead prediction model to obtain picture processing memory overhead data includes:
preprocessing the picture characteristic information to obtain preprocessed picture characteristic information;
inputting the preprocessed picture characteristic information into the picture task overhead prediction model;
and performing memory overhead prediction according to the preprocessed picture characteristic information through the picture task overhead prediction model to obtain the picture processing memory overhead data.
Optionally, the step of obtaining the picture processing memory overhead data by performing memory overhead prediction according to the preprocessed picture feature information through the picture task overhead prediction model includes:
converting the preprocessed picture feature information into a picture feature vector based on a preset vector conversion algorithm;
performing memory overhead prediction according to the picture feature vector by using an overhead prediction method in the picture task overhead prediction model to obtain a memory overhead prediction result;
and obtaining the picture processing memory overhead data according to the memory overhead prediction result.
In addition, to achieve the above object, the present application further provides a picture processing apparatus, including:
the information acquisition module is used for acquiring the characteristic information of the picture;
the overhead prediction module is used for predicting the memory overhead according to the picture characteristic information through a preset picture task overhead prediction model to obtain picture processing memory overhead data;
and the picture processing module is used for distributing memory resources to execute corresponding picture processing tasks according to the picture processing memory overhead data to obtain a picture processing result.
The embodiment of the application also provides a terminal device, which comprises a memory, a processor and a picture processing program stored on the memory and capable of running on the processor, wherein the picture processing program realizes the steps of the picture processing method when being executed by the processor.
The embodiments of the present application also propose a computer readable storage medium, on which a picture processing program is stored, which when executed by a processor implements the steps of the picture processing method as described above.
The embodiment of the application provides a picture processing method, a device, equipment and a storage medium, wherein picture characteristic information is obtained; performing memory overhead prediction according to the picture characteristic information through a preset picture task overhead prediction model to obtain picture processing memory overhead data; and distributing memory resources to execute corresponding picture processing tasks according to the picture processing memory overhead data to obtain a picture processing result. By performing memory overhead prediction according to the picture feature information, memory resources can be effectively allocated. Therefore, the method and the device realize that the memory resources are allocated according to the requirements of the picture processing task to process the picture, and solve the technical problem that the memory resources cannot be allocated according to the memory overhead required by the picture processing task in the prior art. Compared with the prior art, the method has the advantages of high memory resource utilization rate and strong stability.
The foregoing description is only of the preferred embodiments of the present application, and is not intended to limit the scope of the claims, and all equivalent structures or equivalent processes using the descriptions and drawings of the present application, or direct or indirect application in other related technical fields are included in the scope of the claims of the present application.
Drawings
Fig. 1 is a schematic diagram of a functional module of a terminal device to which a picture processing apparatus of the present application belongs;
fig. 2 is a flowchart of a first exemplary embodiment of a picture processing method according to the present application;
FIG. 3 is a schematic flow chart of establishing a picture task overhead prediction model in the picture processing method of the present application;
fig. 4 is a flowchart of a second exemplary embodiment of a picture processing method of the present application;
FIG. 5 is a schematic flow chart of memory resource allocation in the picture processing method of the present application;
fig. 6 is an overall flowchart of another exemplary embodiment of a picture processing method according to the present application.
The achievement of the objects, functional features and advantages of the present application will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
The main solutions of the embodiments of the present application are: acquiring picture characteristic information; performing memory overhead prediction according to the picture characteristic information through a preset picture task overhead prediction model to obtain picture processing memory overhead data; and distributing memory resources to execute corresponding picture processing tasks according to the picture processing memory overhead data to obtain a picture processing result. By performing memory overhead prediction according to the picture feature information, memory resources can be effectively allocated. Therefore, the method and the device realize that the memory resources are allocated according to the requirements of the picture processing task to process the picture, and solve the technical problem that the memory resources cannot be allocated according to the memory overhead required by the picture processing task in the prior art. Compared with the prior art, the method has the advantages of high memory resource utilization rate and strong stability.
In the embodiment of the present application, when the related technical solution performs the task of processing the picture, the following problems exist: the picture operation interface concurrency limit is fuzzy; (2) when the low-overhead tasks are too many, the resources are idle too much; (3) when the high overhead tasks are excessive, the system stability is poor.
Based on the above, the embodiment of the application provides a solution, which can realize that memory resources are allocated according to the requirement of the picture processing task to process the picture, solves the technical problem that the memory resources cannot be allocated according to the memory overhead required by the picture processing task, and ensures that the picture processing is more stable and efficient.
Specifically, referring to fig. 1, fig. 1 is a schematic diagram of functional blocks of a terminal device to which a picture processing apparatus of the present application belongs. The picture processing device may be independent of the terminal device and may be capable of picture processing, and may be carried on the terminal device in the form of hardware or software. The terminal equipment can be intelligent mobile equipment with a data processing function such as a mobile phone and a tablet personal computer, and can also be fixed terminal equipment or a server with a data processing function.
In this embodiment, the terminal device to which the image processing apparatus belongs at least includes an output module 110, a processor 120, a memory 130, and a communication module 140.
The memory 130 stores an operating system and a picture processing program, and the picture processing device can obtain the picture feature information; performing memory overhead prediction according to the picture characteristic information through a preset picture task overhead prediction model to obtain picture processing memory overhead data; and distributing memory resources to execute corresponding picture processing tasks according to the picture processing memory overhead data to obtain a picture processing result. Memory resource allocation is performed by the picture processing program, and information such as executing a picture processing task is stored in the memory 130; the output module 110 may be a display screen or the like. The communication module 140 may include a WIFI module, a mobile communication module, a bluetooth module, and the like, and communicates with an external device or a server through the communication module 140.
Wherein the picture processing program in the memory 130 when executed by the processor performs the steps of:
acquiring picture characteristic information;
performing memory overhead prediction according to the picture characteristic information through a preset picture task overhead prediction model to obtain picture processing memory overhead data;
and distributing memory resources to execute corresponding picture processing tasks according to the picture processing memory overhead data to obtain a picture processing result.
Further, the picture processing program in the memory 130 when executed by the processor also implements the following steps:
acquiring real-time idle memory resource data through a preset memory monitoring module;
judging whether the picture processing memory overhead data is smaller than the real-time idle memory resource data or not;
if yes, processing the memory overhead data according to the picture, and generating a picture processing thread;
and according to the picture processing thread, distributing memory resources to execute the picture processing task to obtain the picture processing result.
Further, the picture processing program in the memory 130 when executed by the processor also implements the following steps:
if not, processing the memory overhead data according to the picture, sending the picture processing task to a preset message queue, and generating a picture thread to be processed;
When the memory monitoring module monitors that the real-time idle memory resource data is larger than the picture processing memory overhead data, taking out the picture processing task from the message queue, and waking up a picture waiting thread;
and according to the picture to-be-processed thread, distributing memory resources to execute the picture processing task to obtain the picture processing result.
Further, the picture processing program in the memory 130 when executed by the processor also implements the following steps:
acquiring picture processing memory overhead information according to the picture processing result;
uploading the picture characteristic information and the picture processing memory overhead information to a preset data storage engine;
establishing a training set according to the picture characteristic information and picture processing memory overhead information through the data storage engine;
based on a preset machine learning algorithm, updating the picture task memory overhead model according to the training set.
Further, the picture processing program in the memory 130 when executed by the processor also implements the following steps:
receiving a picture processing request and a picture corresponding to the picture processing task;
analyzing the picture according to the picture processing request to obtain picture analysis data;
Based on a preset data cleaning algorithm, performing data cleaning on the picture analysis data to obtain initial picture feature data;
and carrying out feature extraction on the initial picture feature data based on a preset feature extraction algorithm to obtain the picture feature information.
Further, the picture processing program in the memory 130 when executed by the processor also implements the following steps:
preprocessing the picture characteristic information to obtain preprocessed picture characteristic information;
inputting the preprocessed picture characteristic information into the picture task overhead prediction model;
and performing memory overhead prediction according to the preprocessed picture characteristic information through the picture task overhead prediction model to obtain the picture processing memory overhead data.
Further, the picture processing program in the memory 130 when executed by the processor also implements the following steps:
converting the preprocessed picture feature information into a picture feature vector based on a preset vector conversion algorithm;
performing memory overhead prediction according to the picture feature vector by using an overhead prediction method in the picture task overhead prediction model to obtain a memory overhead prediction result;
And obtaining the picture processing memory overhead data according to the memory overhead prediction result.
According to the embodiment, through the scheme, the picture characteristic information is obtained; performing memory overhead prediction according to the picture characteristic information through a preset picture task overhead prediction model to obtain picture processing memory overhead data; and distributing memory resources to execute corresponding picture processing tasks according to the picture processing memory overhead data to obtain a picture processing result. By performing memory overhead prediction according to the picture feature information, memory resources can be effectively allocated. Therefore, the method and the device realize that the memory resources are allocated according to the requirements of the picture processing task to process the picture, and solve the technical problem that the memory resources cannot be allocated according to the memory overhead required by the picture processing task in the prior art. Compared with the prior art, the method has the advantages of high memory resource utilization rate and strong stability.
Based on the above terminal device architecture, but not limited to the above architecture, the method embodiments of the present application are presented.
Referring to fig. 2, fig. 2 is a flowchart of a first exemplary embodiment of a picture processing method according to the present application. The picture processing method comprises the following steps:
step S101, obtaining picture characteristic information;
The main execution body of the method in this embodiment is a picture processing service system, may be a picture processing device, or may be a picture processing apparatus, and this embodiment uses a picture processing device as an example, where the picture processing device may be integrated on an apparatus having a data processing function.
In order to solve the problem that memory resources cannot be allocated according to memory overhead required by a picture processing task at present, it is important to allocate memory resources according to the memory overhead required by the picture processing task to perform picture processing, and in order to implement picture processing according to the memory overhead required by the picture processing task, the following steps are adopted:
firstly, a special picture processing device is arranged and integrated on equipment with a data processing function, and a picture processing task can be executed through the picture processing device;
finally, the image feature information is obtained through the image processing device, wherein the image feature can comprise a color histogram, texture features, shape features, edge features and the like.
Taking the picture characteristic information as EXIF information of a picture as an example, the EXIF information can comprise the following contents:
"File type": "PNG",
"File extension": "png",
"Picture width": 12652,
"Picture height": 9682,
"color format": "RGB with Alpha",
"compression method": "Deflag/Info".
Further, as an embodiment, the step of obtaining the picture feature information includes:
step S1011, receiving a picture processing request and a picture corresponding to the picture processing task;
step S1012, analyzing the picture according to the picture processing request to obtain picture analysis data;
step S1013, based on a preset data cleaning algorithm, performing data cleaning on the picture analysis data to obtain initial picture feature data;
step S1014, performing feature extraction on the initial picture feature data based on a preset feature extraction algorithm, to obtain the picture feature information.
Specifically, the picture processing device acquires picture characteristic information and is realized by adopting the following steps:
firstly, a picture processing device receives a picture processing request and a picture corresponding to the picture processing task;
secondly, the picture processing device analyzes the picture according to the picture processing request to obtain picture analysis data, wherein the picture analysis can comprise decoding an image format, reading pixel values of the image, acquiring size information of the image and the like, and the picture analysis data can be a pixel matrix, color channel data and the like;
Then, the picture processing device performs data cleaning on the picture analysis data based on a preset data cleaning algorithm to obtain initial picture feature data, the data cleaning algorithm can perform denoising by using methods such as a mean filter, a median filter and a Gaussian filter, and performs data restoration, data normalization and the like by using an interpolation algorithm;
finally, the image processing device processes the initial image feature data by using a preset feature extraction algorithm, extracts key image feature information to obtain image feature information, wherein the feature extraction algorithm can comprise methods such as histogram calculation, edge detection, texture analysis, shape description and the like, and the image feature information can comprise color features, texture features, shape features and the like.
Taking a Gaussian filter in a data cleaning algorithm as an example, performing data cleaning through the Gaussian filter comprises the following steps:
(1) Determining a convolution kernel size of the gaussian filter:
first, the size of the convolution kernel is determined, typically an odd number, e.g., 3×3, 5×5, 7×7, etc. The size of the convolution kernel determines the neighborhood range of the filter.
(2) Constructing a Gaussian weight matrix:
a two-dimensional weight matrix is constructed from the Gaussian distribution function, the matrix representing the weight value at each location. Parameters of the gaussian distribution function include mean and standard deviation.
The size of the weight matrix is the same as that of the convolution kernel, the weight of the central position of the matrix is maximum, and then the weight is gradually reduced along with the increase of the distance from the central position.
(3) Edge processing (optional) of the image:
the image edges may be processed before applying the gaussian filter to avoid the filter introducing unwanted artifacts at the edges.
Common edge processing methods include filling edge pixels, averaging edge pixels with pixels in the neighborhood, and the like.
(4) A filtering operation is performed for each pixel:
each pixel in the image is traversed and the convolution kernel is placed at the current pixel location.
And multiplying the convolution kernel with the corresponding pixel in the image and the neighborhood pixels thereof at the element level.
And adding the multiplication results and dividing the multiplication results by the total weight value in the weight matrix to obtain a weighted average value.
The value of the current pixel is replaced with a weighted average.
(5) Processing boundary pixels (optional):
during filtering, the neighborhood of boundary pixels may be out of the image. These boundary pixels may be processed using suitable boundary processing methods, such as copying boundary pixels, filling boundary values, or filling by expanding boundary pixels, etc.
(6) Outputting the filtered image:
after the filtering operation is completed, the image data cleaned by the Gaussian filter is obtained.
Taking histogram calculation in a feature extraction algorithm as an example, feature extraction of a picture by the histogram calculation includes the following steps:
(1) Converting the image into a gray scale image (if the original image is a color image): the color image is first converted to a gray scale image by a weighted average method or using the formula: y=0.299×r+0.587×g+0.114×b to calculate a gray value of each pixel, where Y represents a gray value, which represents brightness information of an image, and the gray value can be simply understood as a brightness value in a black-and-white image, and the range of the gray value is between 0 and 255, and each pixel of the image is composed of three components of red (R), green (G), and blue (B), and the range of the gray value of the three components is also typically between 0 and 255.
(2) Determining a gray level range: the range of gray levels is determined according to the application requirements or the bit depth of the image. For example, for an 8-bit gray scale image, the gray scale range is 0-255.
(3) Creating a histogram: a histogram is created having a corresponding number of gray levels based on the range of gray levels. The count for each gray level in the histogram is initialized to 0.
(4) Traversing the image pixels: each pixel of the image is traversed and its gray value is compared to the gray level of the histogram.
(5) Increasing the histogram count: if the gray value of the current pixel matches a gray level, the count of the gray level is incremented by 1. Thus, after traversing a complete image, the count corresponding to each gray level in the histogram is the number of pixels in the image that have that gray value.
(6) Normalized histogram (optional): the count for each gray level in the histogram is normalized to facilitate comparing the histogram features between different images.
(7) Obtaining a histogram feature vector: the normalized histogram count is used as a feature vector to represent the color features of the image. This feature vector may be used as an input for image classification, object detection, etc.
Step S102, performing memory overhead prediction according to the picture characteristic information through a preset picture task overhead prediction model to obtain picture processing memory overhead data;
the picture processing device predicts the memory overhead according to the picture characteristic information through a preset picture task overhead prediction model to obtain picture processing memory overhead data, and the picture processing device is realized by adopting the following steps:
Firstly, taking picture characteristic information as input data by a picture processing device, and preparing characteristic information for a prediction model;
finally, the picture processing device predicts the memory overhead according to the picture characteristic information through a preset picture task overhead prediction model to obtain picture processing memory overhead data, and a machine learning method, a deep learning method or a rule-based method and the like can be used for selecting or constructing the picture task overhead prediction model.
Referring to fig. 3, fig. 3 is a schematic flow chart of establishing a picture task overhead prediction model in the picture processing method of the present application.
The method comprises the steps of taking a large number of user tasks as a data set, establishing a picture task overhead prediction model through data cleaning, feature engineering, preprocessing, model parameter adjustment and other steps, analyzing picture information of a current user, analyzing picture feature information to realize memory overhead of a predicted picture, and finally adjusting the task concurrency number by an application and effectively distributing memory resources.
Further, as an implementation manner, the step of performing memory overhead prediction according to the picture feature information through a preset picture task overhead prediction model to obtain picture processing memory overhead data includes:
Step S1021, preprocessing the picture characteristic information to obtain preprocessed picture characteristic information;
step S1022, inputting the preprocessed picture feature information into the picture task overhead prediction model;
step S1023, performing memory overhead prediction according to the preprocessed picture characteristic information through the picture task overhead prediction model to obtain the picture processing memory overhead data.
Specifically, the picture processing device predicts the memory overhead according to the picture characteristic information through a preset picture task overhead prediction model to obtain picture processing memory overhead data, and the method is realized by adopting the following steps:
firstly, a picture processing device preprocesses picture characteristic information to obtain preprocessed picture characteristic information, wherein the preprocessing can comprise characteristic standardization, characteristic dimension reduction, characteristic selection, data enhancement and the like;
then, the picture processing device inputs the preprocessed picture characteristic information into a picture task overhead prediction model;
finally, the picture processing device predicts the memory overhead according to the preprocessed picture characteristic information through a picture task overhead prediction model to obtain picture processing memory overhead data.
Further, as an implementation manner, the step of performing memory overhead prediction according to the preprocessed picture feature information by using the picture task overhead prediction model to obtain the picture processing memory overhead data includes:
step S10231, converting the preprocessed picture feature information into a picture feature vector based on a preset vector conversion algorithm;
step S10232, performing memory overhead prediction according to the picture feature vector by using an overhead prediction method in the picture task overhead prediction model to obtain a memory overhead prediction result;
step S10233, obtaining the picture processing memory overhead data according to the memory overhead prediction result.
Specifically, the picture processing device predicts the memory overhead according to the preprocessed picture characteristic information through a picture task overhead prediction model to obtain picture processing memory overhead data, and the picture processing device is realized by adopting the following steps:
firstly, a picture processing device converts preprocessed picture Feature information into picture Feature vectors based on a preset vector conversion algorithm, wherein the vector conversion algorithm can select component analysis (PCA), linear Discriminant Analysis (LDA), feature hash (Feature hash) and the like;
Then, the picture processing device predicts the memory overhead according to the picture feature vector by an overhead prediction method in the picture task overhead prediction model to obtain a memory overhead prediction result;
finally, the picture processing device obtains picture processing memory overhead data according to the memory overhead prediction result.
Step S103, according to the picture processing memory overhead data, memory resources are allocated to execute corresponding picture processing tasks, and a picture processing result is obtained.
The picture processing device distributes memory resources to execute corresponding picture processing tasks according to picture processing memory overhead data to obtain picture processing results, and the picture processing device is realized by adopting the following steps:
firstly, a picture processing device determines a proper memory resource allocation strategy according to picture processing memory overhead data and available memory resources;
finally, the picture processing device distributes corresponding memory resources to the current picture processing task according to the memory resource distribution strategy to obtain a picture processing result.
Further, as an implementation manner, after the step of allocating memory resources to execute the corresponding picture processing task according to the picture processing memory overhead data to obtain the picture processing result, the method further includes:
Step S1041, obtaining the overhead information of the picture processing memory according to the picture processing result;
step S1042, uploading the picture feature information and the picture processing memory overhead information to a preset data storage engine;
step S1043, establishing a training set according to the picture characteristic information and the picture processing memory overhead information by the data storage engine;
step S1044, based on a preset machine learning algorithm, updates the picture task memory overhead model according to the training set.
Specifically, after the current picture processing is completed, the parsed EXIF feature information, the memory overhead of picture decoding and the memory overhead information of picture operation are pushed to an elastic search, if the picture operation is realized through third-party software, the collection of the memory overhead information of the picture operation can be realized through monitoring the state of a process PID, the picture information data stored in the elastic search is used as a training data set of a prediction model, the prediction model is trained and adjusted through continuous optimization of a machine learning algorithm, so that the accuracy and performance of prediction are improved, and the following steps are adopted to realize:
firstly, the picture processing device extracts relevant memory overhead information from a result after the picture processing task is executed, and obtains the picture processing memory overhead information, such as memory usage amount, memory leakage condition and the like;
Secondly, the picture processing device arranges the picture characteristic information and the picture processing memory overhead information into a data format and uploads the data format to a preset data storage engine, wherein the data storage engine can be a database, cloud storage service or other storage systems supporting data persistence;
then, the picture processing device acquires the uploaded picture characteristic information and picture processing memory overhead information from the data storage engine, and constructs a data set for training according to the information to obtain a training set;
finally, the picture processing device updates the picture task memory overhead model according to the training set based on a preset machine learning algorithm, wherein the machine learning algorithm can select regression analysis, decision trees or neural networks and the like.
According to the embodiment, through the scheme, the picture characteristic information is obtained; performing memory overhead prediction according to the picture characteristic information through a preset picture task overhead prediction model to obtain picture processing memory overhead data; and distributing memory resources to execute corresponding picture processing tasks according to the picture processing memory overhead data to obtain a picture processing result. By performing memory overhead prediction according to the picture feature information, memory resources can be effectively allocated. Therefore, the method and the device realize that the memory resources are allocated according to the requirements of the picture processing task to process the picture, and solve the technical problem that the memory resources cannot be allocated according to the memory overhead required by the picture processing task in the prior art. Compared with the prior art, the method has the advantages of high memory resource utilization rate and strong stability.
Referring to fig. 4, fig. 4 is a flowchart of a second exemplary embodiment of a picture processing method of the present application.
Based on the above first exemplary embodiment, step S103, according to the picture processing memory overhead data, allocating memory resources to execute corresponding picture processing tasks may include:
step S1031, acquiring real-time idle memory resource data through a preset memory monitoring module;
step S1032, judging whether the picture processing memory overhead data is smaller than the real-time idle memory resource data;
step S1033, if yes, processing the memory overhead data according to the picture, and generating a picture processing thread;
step S1034, according to the picture processing thread, allocating memory resources to execute the picture processing task, so as to obtain the picture processing result.
Specifically, the picture processing device allocates memory resources to execute corresponding picture processing tasks according to picture processing memory overhead data to obtain picture processing results, and the picture processing device is realized by adopting the following steps:
firstly, a picture processing device monitors the use condition of a memory of a system by using a preset memory monitoring module, and acquires real-time idle memory resource data, namely unused memory available for allocation in the current system;
Secondly, the picture processing device compares the acquired picture processing memory overhead data with real-time idle memory resource data, and judges whether the picture processing memory overhead data is smaller than the real-time idle memory resource data, namely whether enough memory resources are available for allocation to picture processing tasks;
then, if the picture processing memory overhead data is smaller than the real-time idle memory resource data, the picture processing device generates one or more picture processing threads according to the picture processing memory overhead data, and the picture processing threads are used for executing picture processing tasks;
and finally, the picture processing device distributes the generated picture processing thread to the idle memory resource to execute the picture processing task, and the picture processing thread uses the distributed memory resource to perform image processing operation to obtain a picture processing result.
Further, as an implementation manner, after the step of determining whether the picture processing memory overhead data is smaller than the real-time idle memory resource data, the method further includes:
step S1035, if not, sending the picture processing task to a preset message queue according to the picture processing memory overhead data, and generating a picture waiting thread;
Step S1036, when the memory monitoring module monitors that the real-time idle memory resource data is greater than the picture processing memory overhead data, taking out the picture processing task from the message queue, and waking up a picture waiting thread;
and step S1037, distributing memory resources to execute the picture processing task according to the picture waiting thread to obtain the picture processing result.
Specifically, the following steps are adopted:
firstly, if the picture processing memory overhead data is not less than the real-time idle memory resource data, the picture processing device sends a picture processing task to a preset message queue according to the picture processing memory overhead data so as to be allocated with the subsequent idle memory resources, and one or more picture processing threads are generated at the same time;
then, if the memory monitoring module monitors that the real-time idle memory resource data is larger than the picture processing memory overhead data, the picture processing device takes out a picture processing task from the message queue, wakes up a corresponding picture waiting thread to be processed, and starts to execute the picture processing task;
and finally, the picture processing device distributes the awakened picture to-be-processed thread to the idle memory resource to execute the picture processing task, and the picture to-be-processed thread uses the distributed memory resource to perform image processing operation to obtain a picture processing result.
Referring to fig. 5, fig. 5 is a schematic flow chart of applying for memory resource allocation in the picture processing method of the present application.
And judging the cost required by picture processing by predicting the cost and judging the cost and a memory monitoring module, and analyzing whether the environment where the current application is positioned has enough memory resources for the picture operation. The memory monitoring module can monitor the memory resource of the current environment by monitoring the memory_in_bytes and the memory_in_bytes files of the container in real time. If the current resources are sufficient, allowing a thread resource to be added to operate the picture; otherwise, the task is pushed to a task queue, the required resources are pre-applied to the monitoring module, a thread is started in advance, and the monitoring module waits for waking up when monitoring enough idle resources. Therefore, the picture operation can be ensured to be carried out under the condition of sufficient resources, the problem that the task fails or the system is abnormal due to insufficient resources, and the problem that the high-resource task is repeatedly queued and overtime occurs when the low-occupation task is more is avoided. Therefore, flexible adjustment of the concurrency number of the application is realized, and the system resources can be fully used.
According to the scheme, the real-time idle memory resource data is obtained through the preset memory monitoring module; judging whether the picture processing memory overhead data is smaller than the real-time idle memory resource data or not; if yes, processing the memory overhead data according to the picture, and generating a picture processing thread; and according to the picture processing thread, distributing memory resources to execute the picture processing task to obtain the picture processing result. And according to the picture processing memory overhead data, memory resource allocation is effectively carried out for the picture processing task, and a picture processing result is obtained. Therefore, the method and the device realize that the memory resources are allocated according to the requirements of the picture processing task to process the picture, and solve the technical problem that the memory resources cannot be allocated according to the memory overhead required by the picture processing task in the prior art. Compared with the prior art, the method has the advantages of high memory resource utilization rate and strong stability.
As another exemplary embodiment, the present embodiment may implement, by a picture processing apparatus, picture processing by allocating memory resources according to memory overhead required for a picture processing task, where a flow of the picture processing method is as shown in fig. 6:
firstly, a picture processing device analyzes picture source data to obtain picture characteristic information;
secondly, the picture processing device predicts the memory overhead according to the picture characteristic information through a preset picture task overhead prediction model to obtain picture processing memory overhead data;
then, the picture processing device distributes memory resources to execute corresponding picture processing tasks according to the picture processing memory overhead data to obtain a picture processing result;
finally, the picture processing device updates a picture task memory overhead model according to the picture characteristic information and the picture processing memory overhead information based on a preset machine learning algorithm.
According to the embodiment, through the scheme, the picture characteristic information is obtained; performing memory overhead prediction according to the picture characteristic information through a preset picture task overhead prediction model to obtain picture processing memory overhead data; and distributing memory resources to execute corresponding picture processing tasks according to the picture processing memory overhead data to obtain a picture processing result. By performing memory overhead prediction according to the picture feature information, memory resources can be effectively allocated. Therefore, the method and the device realize that the memory resources are allocated according to the requirements of the picture processing task to process the picture, and solve the technical problem that the memory resources cannot be allocated according to the memory overhead required by the picture processing task in the prior art. Compared with the prior art, the method has the advantages of high memory resource utilization rate and strong stability.
In addition, the present application also provides a picture processing apparatus, including:
the information acquisition module is used for acquiring the characteristic information of the picture;
the overhead prediction module is used for predicting the memory overhead according to the picture characteristic information through a preset picture task overhead prediction model to obtain picture processing memory overhead data;
and the picture processing module is used for distributing memory resources to execute corresponding picture processing tasks according to the picture processing memory overhead data to obtain a picture processing result.
The principle of implementing the image processing in this embodiment refers to the above embodiments, and is not described herein again.
In addition, the embodiment of the application also provides a terminal device, which comprises a memory, a processor and a picture processing program stored on the memory and capable of running on the processor, wherein the picture processing program realizes the steps of the picture processing method when being executed by the processor.
Because the image processing program is executed by the processor, all the technical schemes of all the embodiments are adopted, at least all the beneficial effects brought by all the technical schemes of all the embodiments are provided, and the description is omitted herein.
The embodiments of the present application also propose a computer readable storage medium, on which a picture processing program is stored, which when executed by a processor implements the steps of the picture processing method as described above.
Because the image processing program is executed by the processor and adopts all the technical schemes of all the embodiments, the image processing program at least has all the beneficial effects brought by all the technical schemes of all the embodiments and is not described in detail herein.
Compared with the prior art, the picture processing scheme provided by the embodiment of the application obtains the picture characteristic information; performing memory overhead prediction according to the picture characteristic information through a preset picture task overhead prediction model to obtain picture processing memory overhead data; and distributing memory resources to execute corresponding picture processing tasks according to the picture processing memory overhead data to obtain a picture processing result. Therefore, the problem that memory resources cannot be allocated according to memory overhead required by a picture processing task is solved. Based on the scheme, from the problem that memory resources cannot be allocated according to memory overhead required by a picture processing task in the real world, the picture processing scheme is designed, the effectiveness of the picture processing method is verified in picture processing after the memory resources are allocated, and finally the stability of a small green box for picture processing by the method is obviously improved.
Compared with the prior art, the scheme of the embodiment of the application has the following advantages:
1. fully uses the application memory resources.
2. The probability of memory overflow is reduced.
3. The problem of repeated rejection of the large-overhead task is solved.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The foregoing embodiment numbers of the present application are merely for describing, and do not represent advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) as above, including several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, a controlled terminal, or a network device, etc.) to perform the method of each embodiment of the present application.
The foregoing description is only of the preferred embodiments of the present application, and is not intended to limit the scope of the claims, and all equivalent structures or equivalent processes using the descriptions and drawings of the present application, or direct or indirect application in other related technical fields are included in the scope of the claims of the present application.

Claims (10)

1. A picture processing method, characterized in that the picture processing method comprises the steps of:
acquiring picture characteristic information;
performing memory overhead prediction according to the picture characteristic information through a preset picture task overhead prediction model to obtain picture processing memory overhead data;
and distributing memory resources to execute corresponding picture processing tasks according to the picture processing memory overhead data to obtain a picture processing result.
2. The picture processing method as claimed in claim 1, wherein the step of allocating memory resources to perform corresponding picture processing tasks according to the picture processing memory overhead data to obtain a picture processing result comprises:
acquiring real-time idle memory resource data through a preset memory monitoring module;
judging whether the picture processing memory overhead data is smaller than the real-time idle memory resource data or not;
If yes, processing the memory overhead data according to the picture, and generating a picture processing thread;
and according to the picture processing thread, distributing memory resources to execute the picture processing task to obtain the picture processing result.
3. The picture processing method as claimed in claim 2, wherein after the step of determining whether the picture processing memory overhead data is smaller than the real-time idle memory resource data, further comprising:
if not, processing the memory overhead data according to the picture, sending the picture processing task to a preset message queue, and generating a picture thread to be processed;
when the memory monitoring module monitors that the real-time idle memory resource data is larger than the picture processing memory overhead data, taking out the picture processing task from the message queue, and waking up a picture waiting thread;
and according to the picture to-be-processed thread, distributing memory resources to execute the picture processing task to obtain the picture processing result.
4. The picture processing method as claimed in claim 1, wherein after the step of allocating memory resources to perform corresponding picture processing tasks according to the picture processing memory overhead data to obtain a picture processing result, the method further comprises:
Acquiring picture processing memory overhead information according to the picture processing result;
uploading the picture characteristic information and the picture processing memory overhead information to a preset data storage engine;
establishing a training set according to the picture characteristic information and picture processing memory overhead information through the data storage engine;
based on a preset machine learning algorithm, updating the picture task memory overhead model according to the training set.
5. The picture processing method as claimed in claim 1, wherein the step of acquiring picture feature information comprises:
receiving a picture processing request and a picture corresponding to the picture processing task;
analyzing the picture according to the picture processing request to obtain picture analysis data;
based on a preset data cleaning algorithm, performing data cleaning on the picture analysis data to obtain initial picture feature data;
and carrying out feature extraction on the initial picture feature data based on a preset feature extraction algorithm to obtain the picture feature information.
6. The picture processing method as claimed in claim 1, wherein the step of performing memory overhead prediction according to the picture feature information by using a preset picture task overhead prediction model to obtain picture processing memory overhead data comprises:
Preprocessing the picture characteristic information to obtain preprocessed picture characteristic information;
inputting the preprocessed picture characteristic information into the picture task overhead prediction model;
and performing memory overhead prediction according to the preprocessed picture characteristic information through the picture task overhead prediction model to obtain the picture processing memory overhead data.
7. The picture processing method as claimed in claim 6, wherein the step of performing memory overhead prediction according to the preprocessed picture feature information by the picture task overhead prediction model to obtain the picture processing memory overhead data comprises:
converting the preprocessed picture feature information into a picture feature vector based on a preset vector conversion algorithm;
performing memory overhead prediction according to the picture feature vector by using an overhead prediction method in the picture task overhead prediction model to obtain a memory overhead prediction result;
and obtaining the picture processing memory overhead data according to the memory overhead prediction result.
8. A picture processing apparatus, characterized in that the picture processing apparatus comprises:
the information acquisition module is used for acquiring the characteristic information of the picture;
The overhead prediction module is used for predicting the memory overhead according to the picture characteristic information through a preset picture task overhead prediction model to obtain picture processing memory overhead data;
and the picture processing module is used for distributing memory resources to execute corresponding picture processing tasks according to the picture processing memory overhead data to obtain a picture processing result.
9. A terminal device comprising a memory, a processor and a picture processing program stored on the memory and executable on the processor, which picture processing program when executed by the processor implements the steps of the picture processing method according to any of claims 1-7.
10. A computer readable storage medium, wherein a picture processing program is stored on the computer readable storage medium, which when executed by a processor, implements the steps of the picture processing method according to any of claims 1-7.
CN202311855982.8A 2023-12-29 2023-12-29 Picture processing method, device, equipment and storage medium Pending CN117785471A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311855982.8A CN117785471A (en) 2023-12-29 2023-12-29 Picture processing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311855982.8A CN117785471A (en) 2023-12-29 2023-12-29 Picture processing method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117785471A true CN117785471A (en) 2024-03-29

Family

ID=90394383

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311855982.8A Pending CN117785471A (en) 2023-12-29 2023-12-29 Picture processing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117785471A (en)

Similar Documents

Publication Publication Date Title
WO2022199583A1 (en) Image processing method and apparatus, computer device, and storage medium
CN111031346B (en) Method and device for enhancing video image quality
US20140072242A1 (en) Method for increasing image resolution
US9025868B2 (en) Method and system for image processing to determine a region of interest
US8594446B2 (en) Method for enhancing a digitized document
CN108351962B (en) Object detection with adaptive channel features
CN108090885B (en) Method and apparatus for processing image
CN116188808B (en) Image feature extraction method and system, storage medium and electronic device
CN117201862B (en) Real-time interaction method based on multi-screen collaboration and related device
CN113538304B (en) Training method and device for image enhancement model, and image enhancement method and device
CN117785471A (en) Picture processing method, device, equipment and storage medium
CN110956572A (en) Image processing method, device and system
CN115471413A (en) Image processing method and device, computer readable storage medium and electronic device
CN112862073B (en) Compressed data analysis method and device, storage medium and terminal
KR20230086999A (en) A recording medium recording a virtual character content creation program
KR20230086998A (en) A computer program that creates virtual character contnet by adding noise to face segment regions
KR20230086996A (en) A computer program that performs the noise addition process
US8908986B1 (en) Systems and methods for selecting ink colors
CN111311603A (en) Method and apparatus for outputting target object number information
CN115187492A (en) Brightness adjusting method and device, computer equipment and storage medium
CN113902706A (en) Image quality evaluation method and device
WO2020166596A1 (en) Image processing system and program
KR20230086995A (en) Device for processing image restoration based on learning algorithm
KR20230086991A (en) A method and a device for generating face image of virtual person using image restoration algorithm
KR20230086997A (en) Recording medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination