CN117930958A - Server optimization method and device - Google Patents
Server optimization method and device Download PDFInfo
- Publication number
- CN117930958A CN117930958A CN202410090602.4A CN202410090602A CN117930958A CN 117930958 A CN117930958 A CN 117930958A CN 202410090602 A CN202410090602 A CN 202410090602A CN 117930958 A CN117930958 A CN 117930958A
- Authority
- CN
- China
- Prior art keywords
- image
- data
- sample
- layer
- features
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F1/00—Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
- G06F1/26—Power supply means, e.g. regulation thereof
- G06F1/32—Means for saving power
- G06F1/3203—Power management, i.e. event-based initiation of a power-saving mode
- G06F1/3234—Power saving characterised by the action undertaken
- G06F1/3243—Power saving in microcontroller unit
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
- G06N3/0455—Auto-encoder networks; Encoder-decoder networks
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/764—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/82—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/94—Hardware or software architectures specially adapted for image or video understanding
- G06V10/955—Hardware or software architectures specially adapted for image or video understanding using specific electronic processors
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Evolutionary Computation (AREA)
- Software Systems (AREA)
- Artificial Intelligence (AREA)
- General Health & Medical Sciences (AREA)
- Multimedia (AREA)
- Computing Systems (AREA)
- Health & Medical Sciences (AREA)
- Medical Informatics (AREA)
- Databases & Information Systems (AREA)
- Computer Vision & Pattern Recognition (AREA)
- General Engineering & Computer Science (AREA)
- Biomedical Technology (AREA)
- Mathematical Physics (AREA)
- Molecular Biology (AREA)
- Data Mining & Analysis (AREA)
- Computational Linguistics (AREA)
- Biophysics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Image Analysis (AREA)
Abstract
The invention also provides a server optimization method and device, which are used for carrying out parameter analysis on the image data by receiving the image data uploaded by the client to obtain image parameter data; respectively inputting the image data and the image parameter data into a pre-trained image processing model so that the image processing model adjusts the image data based on the image parameter data to obtain image adjustment data, and performing image classification processing on the image adjustment data to obtain an image prediction type; responding to an image data transmission request initiated by a client, and sending image adjustment data and image prediction categories to the client; compared with the prior art, the technical scheme of the invention can reduce the consumption of the computing resources of the server and improve the response speed to the client request.
Description
Technical Field
The present invention relates to the technical field of server optimization, and in particular, to a method and an apparatus for server optimization.
Background
In the prior art, in order to send image data to be processed to a server for processing, a client initiates an image data processing request to the server, so that the server executes corresponding image processing according to the client initiation request; if the client needs to perform image adjustment and classification on the image, a request for image adjustment and image classification is sent to the server, and when a large number of image requests are faced, the server needs to reprocess the image for each request, which easily results in an excessive load on the server.
Traditional servers must consume a significant amount of computing resources and time to process images, and when multiple requests arrive at the same time, the server may not be able to process all requests in time, resulting in an extended response time; this can lead to a poor user experience, especially in applications requiring real-time responses, such as online games, video streaming media, etc.
In addition, conventional servers reprocess images for each request, potentially making the same image potentially repetitive in multiple requests, occupying computing resources of the server and increasing power consumption.
Disclosure of Invention
The invention aims to solve the technical problems that: the server optimizing method and device can reduce the consumption of computing resources of the server and improve the response speed to the client request.
In order to solve the technical problems, the present invention provides a server optimization method, including:
receiving image data uploaded by a client, and carrying out parameter analysis on the image data to obtain image parameter data;
respectively inputting the image data and the image parameter data into a pre-trained image processing model so that the image processing model adjusts the image data based on the image parameter data to obtain image adjustment data, and performing image classification processing on the image adjustment data to obtain an image prediction type;
and responding to the image data transmission request initiated by the client, and sending the image adjustment data and the image prediction category to the client.
In a possible implementation manner, before the inputting the image data and the image parameter data into the pre-trained image processing model, the method further includes:
acquiring sample image data, and sample tag class true values and sample image parameter data corresponding to the sample image data;
Inputting the sample image data and the sample image parameter data into an image processing model, so that the image processing model adjusts the sample image data based on the sample image parameter data to obtain sample image adjustment data, and performs image classification processing on the sample image adjustment data to obtain a sample label class predicted value corresponding to each preset sample label class;
And inputting the sample label type true value and the sample label type predicted value into a preset cross entropy loss function, calculating to obtain a model loss value, and adjusting model parameters of the image processing model based on the model loss value until the image processing model converges.
Further, by calculating the cross entropy loss function and taking the real tag class value and the predicted tag class value as inputs, the accuracy of model prediction can be evaluated, and the loss value of the model can be calculated; based on the model loss value, parameters of the model can be adjusted through a back propagation algorithm, so that the model is gradually optimized and converged, training data can be better fitted by the model in the process, and generalization capability on unknown data is improved.
In one possible implementation manner, the adjusting the sample image data based on the sample image parameter data to obtain sample image adjustment data specifically includes:
Decoding the sample image parameter data based on a preset encoder in the image processing model to obtain decoded image parameters, extracting features of the sample image parameter data based on the decoded image parameters to obtain image parameter features, obtaining a target image in the sample image data, performing image adjustment on the target image based on the image parameter features to obtain a target adjustment image, and taking the target adjustment image as sample image adjustment data.
Further, the sample image data is adjusted based on the sample image parameter data, so that a subsequent model can better understand image content and improve accuracy of subsequent classification prediction.
In a possible implementation manner, the performing image classification processing on the sample image adjustment data to obtain a sample tag class predicted value corresponding to each sample tag class specifically includes:
Dividing the target adjustment image into a plurality of sub-images, acquiring a vector sequence corresponding to each sub-image, performing stitching processing on the vector sequence to generate stitching vector features, inputting the stitching vector features into a preset encoder to enable the encoder to output the target adjustment image features, performing linear transformation processing on the target adjustment image features to obtain linear target adjustment image features, and converting the linear target adjustment image features into probability distribution values of preset sample label categories to obtain sample label category predicted values corresponding to each sample label category.
Further, by dividing the target adjustment image into a plurality of sub-images and acquiring a vector sequence corresponding to each sub-image, more distinguishable features can be extracted; the combination of the sub-images can capture richer and more global image information, so that the representation and understanding capability of the model on the image data are improved, meanwhile, the high-dimensional input data are converted into the characteristic representation with lower dimensionality and more distinguishing property based on the encoder, the data dimensionality can be reduced, the calculation efficiency of the model is improved, and the classification accuracy of the image is improved.
In one possible implementation manner, the performing a stitching process on the vector sequence to generate a stitched vector feature specifically includes:
And adding position codes and category information to each vector sequence to obtain a corresponding preprocessing vector sequence, and performing splicing processing on all the preprocessing vector sequences to obtain spliced vector features.
Further, weighting features are used in a preset splicing formula, importance degrees are distributed to different sub-images according to the influence importance degrees of data on results, so that important image blocks are focused, influence of unimportant image blocks is reduced, and follow-up prediction accuracy is improved.
In one possible implementation manner, the encoder comprises a multi-head attention mechanism layer, a splicing layer, a layer normalization layer, a multi-layer perceptron and a random inactivation layer, and the splicing vector features are input into a preset encoder so that the encoder outputs target adjustment image features, and specifically comprises;
the multi-head attention mechanism layer is used for carrying out self-attention calculation on the spliced vector features to obtain a plurality of self-attention vector features, and inputting the plurality of self-attention vector features into the spliced layer;
The splicing layer is used for carrying out splicing processing on the plurality of self-attention vector features to obtain spliced self-attention vector features, and inputting the spliced self-attention vector features into the layer normalization layer;
The layer normalization layer is used for carrying out layer normalization calculation on the spliced self-attention vector features to obtain layer normalization vector features, and inputting the layer normalization vector features into the multi-layer perceptron;
The multi-layer perceptron is used for carrying out nonlinear transformation processing on the layer normalized vector characteristics to obtain a plurality of nonlinear characteristics;
and the random inactivation layer is used for carrying out random discarding processing on the nonlinear characteristics and outputting target adjustment image characteristics.
Further, the spliced vector features are processed through a multi-head attention mechanism, a splicing layer, a layer normalization layer, a multi-layer sensor and a random inactivation layer, so that the feature expression capacity, generalization capacity and stability of the model are improved; the method is beneficial to the image processing model to more accurately output target adjustment image characteristics, and improves the performance and the prediction effect of the model.
The invention provides a server optimization method, which further comprises the following steps:
Monitoring the running time of an image processing process on a central processing unit in real time, and the memory occupancy rate and the video memory utilization rate of the image processing process;
Determining the resource occupancy rate of the image processing process based on the running time, the memory occupancy rate and the video memory utilization rate;
And comparing the resource occupancy rate with a preset resource occupancy threshold value, triggering a resource alarm if the resource occupancy rate is larger than the resource occupancy threshold value, and automatically sending an alarm notification.
Further, by setting such as real-time monitoring, resource occupancy rate determination and triggering resource alarm, system performance monitoring and exception handling can be effectively performed, and stability and response capability of the server can be improved.
The invention also provides a server optimizing device, which comprises: the system comprises an image parameter analysis module, a model prediction module and an image data transmission module;
The image parameter analysis module is used for receiving the image data uploaded by the client and carrying out parameter analysis on the image data to obtain image parameter data;
The model prediction module is used for respectively inputting the image data and the image parameter data into a pre-trained image processing model so that the image processing model adjusts the image data based on the image parameter data to obtain image adjustment data, and performs image classification processing on the image adjustment data to obtain an image prediction category;
the image data transmission module is used for responding to an image data transmission request initiated by the client and sending the image adjustment data and the image prediction type to the client.
The invention provides a server optimizing device, which further comprises: a model training module;
the model training module is configured to perform model pre-training on the image processing model, where the pre-training process of the image processing model specifically includes:
acquiring sample image data, and sample tag class true values and sample image parameter data corresponding to the sample image data;
Inputting the sample image data and the sample image parameter data into an image processing model, so that the image processing model adjusts the sample image data based on the sample image parameter data to obtain sample image adjustment data, and performs image classification processing on the sample image adjustment data to obtain a sample label class predicted value corresponding to each preset sample label class;
And inputting the sample label type true value and the sample label type predicted value into a preset cross entropy loss function, calculating to obtain a model loss value, and adjusting model parameters of the image processing model based on the model loss value until the image processing model converges.
In one possible implementation manner, the model training module is configured to adjust the sample image data based on the sample image parameter data to obtain sample image adjustment data, and specifically includes:
Decoding the sample image parameter data based on a preset encoder in the image processing model to obtain decoded image parameters, extracting features of the sample image parameter data based on the decoded image parameters to obtain image parameter features, obtaining a target image in the sample image data, performing image adjustment on the target image based on the image parameter features to obtain a target adjustment image, and taking the target adjustment image as sample image adjustment data.
In a possible implementation manner, the model training module performs image classification processing on the sample image adjustment data to obtain a sample label class prediction value corresponding to each sample label class, and specifically includes:
Dividing the target adjustment image into a plurality of sub-images, acquiring a vector sequence corresponding to each sub-image, performing splicing processing on the vector sequence to generate spliced vector features, inputting the spliced vector features into a preset encoder to enable the encoder to output the target adjustment image features, performing linear transformation processing on the target adjustment image features to obtain linear target adjustment image features, and converting the linear target adjustment image features into probability distribution values of preset sample label categories to obtain sample label category predicted values corresponding to each sample label category.
In one possible implementation manner, the model training module performs a stitching process on the vector sequence to generate a stitched vector feature, which specifically includes:
And adding position codes and category information to each vector sequence to obtain a corresponding preprocessing vector sequence, and performing splicing processing on all the preprocessing vector sequences to obtain spliced vector features.
In one possible implementation manner, the encoder comprises a multi-head attention mechanism layer, a splicing layer, a layer normalization layer, a multi-layer perceptron and a random inactivation layer, and the model training module is used for inputting the splicing vector features into a preset encoder so that the encoder outputs target adjustment image features, and specifically comprises the following steps of;
the multi-head attention mechanism layer is used for carrying out self-attention calculation on the spliced vector features to obtain a plurality of self-attention vector features, and inputting the plurality of self-attention vector features into the spliced layer;
The splicing layer is used for carrying out splicing processing on the plurality of self-attention vector features to obtain spliced self-attention vector features, and inputting the spliced self-attention vector features into the layer normalization layer;
The layer normalization layer is used for carrying out layer normalization calculation on the spliced self-attention vector features to obtain layer normalization vector features, and inputting the layer normalization vector features into the multi-layer perceptron;
The multi-layer perceptron is used for carrying out nonlinear transformation processing on the layer normalized vector characteristics to obtain a plurality of nonlinear characteristics;
and the random inactivation layer is used for carrying out random discarding processing on the nonlinear characteristics and outputting target adjustment image characteristics.
The invention provides a server optimizing device, which further comprises: a server monitoring module;
the server monitoring module is used for monitoring the running time of the image processing process on the central processing unit in real time, and the memory occupancy rate and the video memory utilization rate of the image processing process; determining the resource occupancy rate of the image processing process based on the running time, the memory occupancy rate and the video memory utilization rate; and comparing the resource occupancy rate with a preset resource occupancy threshold value, triggering a resource alarm if the resource occupancy rate is larger than the resource occupancy threshold value, and automatically sending an alarm notification.
The invention also provides a terminal device comprising a processor, a memory and a computer program stored in the memory and configured to be executed by the processor, the processor implementing the server optimization method according to any one of the preceding claims when executing the computer program.
The invention also provides a computer readable storage medium comprising a stored computer program, wherein the computer program when run controls a device in which the computer readable storage medium is located to perform the server optimization method according to any one of the above.
Compared with the prior art, the server optimization method and device provided by the embodiment of the invention have the following beneficial effects:
The image data uploaded by the client is subjected to parameter analysis, the obtained image parameter data and the image data are transmitted to the image processing model, so that the image processing model can carry out adjustment and classification operations on the image data, the output image adjustment data and image prediction types can be used for avoiding the direct adjustment and classification operations on the image data by the server, reducing the consumption of computing resources of the server, and the image adjustment data and the image prediction types can be directly returned to the client when the client is subsequently responded, thereby realizing quick response to the client request and improving the response speed.
Drawings
FIG. 1 is a flow diagram of one embodiment of a server optimization method provided by the present invention;
FIG. 2 is a schematic diagram of an encoder according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a network structure of MViT model according to one embodiment of the present invention;
FIG. 4 is a flow chart of yet another embodiment of a server optimization method provided by the present invention;
FIG. 5 is a flow chart of yet another embodiment of a server optimization method provided by the present invention;
FIG. 6 is a schematic diagram illustrating the structure of an embodiment of a server optimization device according to the present invention;
fig. 7 is a schematic structural diagram of a terminal device provided by the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Embodiment 1, referring to fig. 1, fig. 1 is a schematic flow chart of an embodiment of a server optimization method provided by the present invention, as shown in fig. 1, the method includes steps 101 to 103, specifically as follows:
Step 101: and receiving the image data uploaded by the client, and carrying out parameter analysis on the image data to obtain image parameter data.
In one embodiment, in order to send the image data to be processed to the server for processing, the client establishes a communication connection with the server, and initiates an image data transmission request to the server based on the communication connection, and uploads the image data to the server.
Specifically, the image data transmission request includes one or more combinations of a user uploading an image, requesting image processing, and other operations involving image data.
Preferably, setting the image data transmission request includes a user uploading an image, requesting image processing, and image classification.
Specifically, the image parameter data includes, but is not limited to, an image file to be processed, where the image file includes one or more images with different sizes and qualities.
In one embodiment, the server receives the image data uploaded by the client, and performs parameter analysis on the image data, where the parameter analysis includes, but is not limited to, image size analysis, image quality evaluation, color information analysis, and file format detection.
Specifically, for image size analysis: the server determines the width and the height of the image by measuring the resolution of the image; this size information can be used for subsequent image processing and adjustment operations.
Specifically, for image quality assessment: the server evaluates the quality of the image and determines the compression ratio, color depth and other quality indexes of the image; these evaluation results help to determine the sharpness and level of detail of the image and provide a reference for subsequent optimization operations.
Specifically, for color information analysis: the server analyzes the color information of the image and determines the color space, the color mode and the channel number of the image; this helps to ensure the accuracy of the color correction and the correct processing and rendering of the colors of the image during subsequent processing.
Specifically, for file format detection: the server may detect the file format of the image, such as JPEG, PNG, or other format. This helps to determine the input format of the image and to keep it consistent in subsequent processing and output.
Preferably, the server may also analyze other parameters related to image processing, such as the direction of the image (landscape or portrait), resolution units, etc., as needed; these additional parameter records may provide more information to support subsequent processing and optimization operations.
Preferably, when the server performs parameter analysis on the image data, the server may further perform data reading operation on the image data based on a file library; exemplary, e.g., image file based image.open reading; obtaining a resolution based on img.size; obtaining color distribution information based on img. Acquiring a bit depth based on img. Acquiring an image color pattern based on img.mode; the image format is acquired based on img.
In an embodiment, the server performs parameter analysis on the image data, and further performs image parameter data recording on the image parameter data after obtaining the image parameter data.
The recorded image parameter data mainly aims at providing detailed information about images for the image processing model, so that the image processing model can intelligently adjust the images in the image data according to the image parameter data to meet the requirements of a server and the requirements of a client; these recorded image parameter data will play a key guiding role in the subsequent image processing model training and image processing steps, ensuring that the image processing is efficient, accurate and adaptable.
Step 102: and respectively inputting the image data and the image parameter data into a pre-trained image processing model so that the image processing model adjusts the image data based on the image parameter data to obtain image adjustment data, and performing image classification processing on the image adjustment data to obtain an image prediction type.
In one embodiment, after the server finishes analyzing the image data, the image data and the image parameter data are input into a pre-trained image processing model, so that the image processing model can automatically adjust and process the received image data to meet the processing requirement of the server and reduce the data processing pressure of the server.
In particular, the image processing model is a visual transformation model (Vision Transformer, MViT).
Preferably, the image processing model may also be set as other image processing models, such as convolutional neural networks (Convolutional Neural Network, CNN) or generating countermeasure networks (GENERATIVE ADVERSARIAL networks, GAN), to extend support for different image processing tasks; therefore, by integrating a plurality of different image processing models, the server can select a proper model for image processing according to specific tasks, and the processing flexibility and accuracy are improved.
In an embodiment, after the image processing model receives the image parameter data and the image data input by the server, the image parameter data is first used for adjusting the image data to obtain image adjustment data, so as to realize self-adaptive adjustment of the image, facilitate the subsequent understanding of the image content and improve the accuracy of the subsequent classification prediction.
When the image processing model is pre-trained, sample image data, a sample tag type true value corresponding to the sample image data and sample image parameter data are acquired, and the sample image data and the sample image parameter data are input into the image processing model, so that the image processing model adjusts the sample image data based on the sample image parameter data, and sample image adjustment data are obtained.
In an embodiment, when the sample image data is adjusted by the sample image parameter data, decoding the sample image parameter data based on a preset encoder in the image processing model to obtain decoded image parameters, extracting features of the image parameter data based on the decoded image parameters to obtain image parameter features, obtaining a target image in the sample image data, performing image adjustment on the target image based on the image parameter features to obtain a target adjustment image, and taking the target adjustment image as sample image adjustment data.
Specifically, the recorded sample image parameter data is decoded by using an encoder in the image processing model, so that the encoder converts the sample image parameter data into an internal representation form which can be understood by the model, and the decoded image parameter is obtained, wherein the internal representation form which can be understood by the model includes but is not limited to a vector form.
Specifically, the decoded image parameters obtained after decoding and sample image data are input into a feature extractor of an image processing model, so that the feature extractor performs feature extraction on the sample image parameter data based on the decoded image parameters to obtain image parameter features, wherein the feature extraction is performed on the sample image parameter data based on the decoded image parameters, and mainly, features related to the decoded image parameters are extracted from the image data.
Specifically, based on the extracted image parameter characteristics, performing a series of self-adaptive adjustment on the target image in the sample image data; and e.g. transforming and enhancing the target image based on the image parameter characteristics such as the size and color information of the image, and completing the self-adaptive adjustment of the image data.
In an embodiment, when the image processing model is trained, the classification performance of the image processing model is trained, specifically, the sample image adjustment data is subjected to image classification processing, so as to obtain a sample label class predicted value corresponding to each preset sample label class.
In an embodiment, when the image processing model is trained to perform image classification processing on the sample image adjustment data, the target adjustment image is divided into a plurality of sub-images, a vector sequence corresponding to each sub-image is obtained, the vector sequence is subjected to splicing processing to generate spliced vector features, the spliced vector features are input into a preset encoder, so that the encoder outputs the target adjustment image features, linear transformation processing is performed on the target adjustment image features to obtain linear target adjustment image features, and the linear target adjustment image features are converted into probability distribution values of each preset category to obtain image prediction categories corresponding to the image adjustment data.
Specifically, an image segmentation algorithm is used to segment the target adjustment image into a plurality of sub-images, and for each sub-image obtained by segmentation, a vector sequence corresponding to each sub-image is extracted through an image recognition algorithm.
Specifically, position codes and category information are added to each vector sequence to obtain corresponding preprocessed vector sequences, and all the preprocessed vector sequences are spliced to obtain spliced vector features.
For example, a position code is added to the vector sequence of each sub-image, the position code is used for marking the position of each image small block, the class information class token is spliced before the vector sequence of each sub-image and used for classification, and finally, the split sub-images are subjected to splicing processing.
Specifically, all the preprocessing vector sequences are spliced based on a preset splicing formula, wherein the preset splicing formula is as follows:
merge=concat(α1Image block1+α2Image block2+α3Image block3+…αnImage blockn);
In the formula, concat represents stitching, alpha 1、α2、α3……αn is a preset weight coefficient, image block 1 represents a pre-processing vector sequence corresponding to the 1 st sub-Image, image block 2 represents a pre-processing vector sequence corresponding to the 2 nd sub-Image, image block 3 represents a pre-processing vector sequence corresponding to the 3 rd sub-Image, image block n represents a pre-processing vector sequence corresponding to the nth sub-Image, and merge represents stitching vector features.
By using the weight coefficients in a preset splicing formula, the weight coefficients distributed to different sub-images are distributed according to the influence importance degree of the data on the result, so that important sub-images are focused, influence of unimportant sub-images is reduced, and the accuracy of subsequent prediction is improved.
Specifically, the encoder structure includes a Multi-Head Attention mechanism layer Multi-Head Attention, a splicing layer concat, a layer normalization layer LayerNorm, a Multi-layer perceptron MLP and a random inactivation layer dropout; wherein, the Multi-Head Attention mechanism layer Multi-Head Attention consists of a plurality of N self-Attention units self-Attention.
Preferably, the encoder is repeatedly stacked 6 layers, as shown in fig. 2, and fig. 2 is a schematic structural view of the encoder.
Specifically, the Multi-Head Attention mechanism layer Multi-Head Attention is configured to perform self-Attention computation on the spliced vector features to obtain a plurality of self-Attention vector features, and input the plurality of self-Attention vector features to the spliced layer; global self-attention computation is performed on the spliced vector features through a multi-head attention mechanism to capture important relationships between the vector features.
Specifically, the splicing layer concat is configured to perform splicing processing on the multiple self-attention vector features to obtain a spliced self-attention vector feature, and input the spliced self-attention vector feature into the layer normalization layer. The concat structure can connect the feature graphs with different scales along the channel dimension so as to realize the fusion of the multi-scale features, and the model can capture the visual information with different scales at the same time, so that the image content is better understood.
Specifically, the layer normalization layer LayerNorm is configured to perform layer normalization calculation on the spliced self-attention vector feature to obtain a layer normalization vector feature, and input the layer normalization vector feature into the multi-layer perceptron; and carrying out layer normalization operation on the spliced self-attention vector characteristics obtained after splicing, so that the model has better numerical stability among characteristic representations of different layers.
Preferably, the layer normalization layer LayerNorm performs layer normalization calculation on the spliced self-attention vector feature by using a preset layer normalization calculation formula, where the preset layer normalization calculation formula is as follows:
Wherein x represents the spliced self-attention vector characteristic, gamma represents the scaling factor, beta represents the displacement factor, mu represents the mean value, sigma represents the standard deviation, e is used for preventing 0 division errors, and alpha represents the super-parameter for adjusting the displacement size.
Super parameters are added to a preset layer normalization calculation formula for adjustment control aiming at displacement factors, so that the model stability can be effectively improved, the convergence rate can be increased, and the model generalization capability can be enhanced at the model training stage.
Specifically, the multi-layer perceptron MLP is configured to perform nonlinear transformation processing on the layer normalized vector feature to obtain a plurality of nonlinear features.
Preferably, the multi-layer perceptron adopts a nonlinear activation function to carry out nonlinear transformation processing on the layer normalized vector characteristics; and applying a multi-layer perceptron MLP structure, namely a fully connected neural network, to the vector features after layer normalization so as to fully utilize nonlinear activation functions and extract more abstract and complex feature information.
Specifically, the random inactivation layer dropout is configured to perform random discarding processing on the multiple nonlinear features, and output a target adjustment image feature; in order to prevent overfitting, the output of the multi-layer perceptron is subjected to random inactivation dropout operation, and the model generalization capability of the model training stage can be improved by randomly discarding the output of a part of neurons.
In one embodiment, the image processing model is further provided with a linear layer and an exponential normalization layer softmax, wherein the linear layer performs linear transformation on the high-dimensional feature representation output by the encoder, and the purpose of the linear layer is to map the feature representation to a feature space more suitable for classification, and the linear layer generally involves multiplication operation of a weight matrix and addition operation of an offset term; the index normalization layer softmax carries out softmax function operation on the feature representation after linear transformation, and converts the obtained vector into probability distribution of each category for prediction of multi-classification tasks.
In an embodiment, since a sample label class predicted value of a sample image is obtained after image processing model prediction, the sample label class predicted value and a sample label class true value have errors, and therefore a cross entropy loss function is further set, the sample label class true value and the label class predicted value are input into a preset cross entropy loss function, a model loss value is obtained through calculation, and model parameter adjustment is performed on the image processing model based on the model loss value until the image processing model converges.
The preset cross entropy loss function is as follows:
Where α represents weight information, h s(x(i)) represents an i-th sample tag class prediction value, y (i) represents an i-th sample tag class true value, K represents learning, and L is a model loss value.
In a preset cross entropy loss function, adding weight to a sample loss value, wherein when the loss is large, the weight is reduced, and when the loss is small, the weight is increased; and regularizing the model loss value, so that on one hand, the model can learn a sample with a prediction error more easily and focus on the processing operation of the sample, and on the other hand, the model subjected to regularization reduces the complexity of the model and reduces the overfitting phenomenon.
In one embodiment, an Adam optimizer is also used to adaptively adjust the learning rate during the training of the image processing model to improve the training effect and generalization ability of the model.
Specifically, the learning rate 5e-4 of the Adam optimizer is set, and the learning rate is adjusted and reduced at a rate of 0.95, namely, in the model training process, the learning rate is adjusted and reduced at a rate of 0.95 in each step, and the adjustment can enable the model to perform parameter updating more stably in the later stage of training, so that the generalization capability of the model is improved, and the overfitting is prevented.
Taking an image processing model as MViT model as an example, the pre-training process of the MViT model is illustrated, as shown in fig. 3, and fig. 3 is a schematic diagram of a network structure of the MViT model; sample image data and corresponding sample image parameter data are input into a MViT model, so that the MViT model firstly carries out image adjustment on the sample image data to obtain sample image adjustment data, a target adjustment image in the sample image adjustment data is divided into a plurality of sub-images, vector sequences corresponding to the sub-images are spliced through a splicing layer concat, the spliced vector sequences obtained through splicing are input into an encoder formed by overlapping 6 layers of structures, the encoder inputs the output target adjustment image characteristics into a subsequent linear layer linear, a model prediction result is output based on an index normalization layer softmax, and meanwhile, model parameters are updated and iterated based on a cross entropy loss function until optimal model parameters are determined.
In one embodiment, after model training of an image processing model is completed, the server directly inputs the image data and the image parameter data into the trained image processing model, so that the image processing model adjusts the image data based on the image parameter data to obtain image adjustment data, performs image classification processing on the image adjustment data to obtain an image prediction category, and returns the image adjustment data and the image prediction category to the server.
The server processes various types and characteristics of image data through the image processing model, an advanced deep learning technology is utilized to realize automatic intelligent processing of the image, manual intervention is not needed, after the image processing model transmits image adjustment data and image prediction types, the image adjustment data and the image prediction types are directly sent to the server side, direct processing of the image by the server side is avoided, the calculation resource consumption of the server including a CPU and a memory can be reduced, and therefore the resource utilization efficiency is improved. The server can more effectively allocate resources, process more requests, reduce energy costs, and extend hardware life.
Step 103: and responding to the image data transmission request initiated by the client, and sending the image adjustment data and the image prediction category to the client.
In an embodiment, the server directly sends the image adjustment data and the image prediction type to the client in response to the image data transmission request initiated by the client, and because the image adjustment data and the image prediction type are already obtained by performing intelligent processing on the image processing model, the server does not need to perform the same image processing operation on the received image data, so that the computing resource and the response time of the server can be greatly saved, the server can better cope with large-scale request and high-load conditions, and the resource utilization rate of the server can be improved.
Taking an image processing model as MViT model as an example, an example is given to a server optimization method provided by the embodiment; FIG. 4 is a schematic flow chart of a further method of server optimization, as shown in FIG. 4; the client initiates an image data transmission request to the server so as to upload the image data to the server, so that the server performs parameter analysis on the image data after receiving the image data to obtain and record the image parameter data, and sends the recorded image parameter data and the recorded image data to the MViT model, so that the MViT model performs image processing on the image data based on the image parameter data, outputs image adjustment data and image prediction types, and returns the image adjustment data and the image prediction types to the server, so that the server directly sends the image adjustment data and the image prediction types to the client after responding to the request of the client, the server is prevented from directly performing image processing on the image data uploaded by the client, and after the subsequent client initiates the request to the server again based on the same image data, the server can directly use the image adjustment data and the image prediction types returned by the MViT model, so that the operation that the server needs to perform image processing on each request of the client in the prior art is avoided, the calculation resource consumption of the server is reduced, and the response speed to the request of the client is improved.
In one embodiment, after the server receives the image data uploaded by the client, the running time of the image processing process in the server on the central processing unit, the memory occupancy rate of the image processing process and the memory utilization rate are monitored in real time; determining the resource occupancy rate of the image processing process based on the running time, the memory occupancy rate and the video memory utilization rate; and comparing the resource occupancy rate with a preset resource occupancy threshold value, triggering a resource alarm if the resource occupancy rate is larger than the resource occupancy threshold value, and automatically sending an alarm notification.
Specifically, a monitoring system is implemented on a server, and key indexes such as server performance, cache hit rate, resource utilization rate and the like are tracked regularly; through continuous monitoring, the server can know the running state of the server in real time, identify potential problems in time and make necessary adjustment to optimize the performance of the server; the stability and the response capability of the server can be improved, and the server can be ensured to adapt to the continuously changing workload and user requirements, so that continuous high-quality service is provided.
The specific explanation is given by taking the index monitoring of the server by using Exporter plus Prometaus monitoring service: the CPU time, the memory utilization and the video memory utilization rate occupied by the appointed image processing process are collected by process exporter so as to monitor the resource condition of the server occupied by the image processing model processing image, and avoid the influence on the normal service providing of the server due to the excessive server resource occupied by the model processing image; and by configuring Prometheus AlertManager alarm rule configuration files, the alarm notification can be automatically sent when triggering resource alarms so as to remind server operation and maintenance personnel to discover and solve problems in time.
Taking the image processing model as MViT model as an example, another server optimization method provided by the embodiment is illustrated; FIG. 5 is a schematic illustration of a further flow chart of a server optimization method, as shown in FIG. 5; comprising steps S1-S5; step S1, uploading data by a client; in step S1: the client initiates an image data transmission request to the server so as to upload the image data to the server; step S2: recording parameters; in step S2, after receiving the image data, the server performs parameter analysis on the image data to obtain and record image parameter data, and sends the recorded image parameter data and image data to the MViT model; step S3, MViT, training a model; in step S3, performing model training on the MViT model, so that image processing is performed on the image data based on the image parameter data based on the trained MViT model, outputting image adjustment data and image prediction type, and returning the image adjustment data and the image prediction type to the server; step S4, responding to the client request; in step S4, after responding to the request of the client, the server directly sends the image adjustment data and the image prediction category to the client, so that the server is prevented from directly performing image processing on the image data uploaded by the client, and after the subsequent client initiates a request to the server again based on the same image data, the server can directly use the image adjustment data and the image prediction category returned by the MViT model; step S5: monitoring and adjusting; in step S5, key indexes such as server performance, cache hit rate, resource utilization rate and the like are tracked regularly by implementing a monitoring system on the server; through continuous monitoring, the server can know the running state of the server in real time, identify potential problems in time and make necessary adjustment to optimize the performance of the server; the stability and the response capability of the server can be improved, and the server can be ensured to adapt to the continuously changing workload and user requirements, so that continuous high-quality service is provided.
In an embodiment, an intelligent cache system is further introduced into the server, and is used for storing the image adjustment data and the image prediction category output by the image processing model after the data transmission request initiated by the client.
In an embodiment, the history request, and the corresponding image data, image parameter data, image adjustment data, and image prediction category are analyzed to predict the image data that may be requested again, and the history request, and the corresponding image data, image parameter data, image adjustment data, and image prediction category are respectively stored in the intelligent cache system based on the prediction result, so that repeated call of the image processing model is reduced, and server performance and response speed are improved.
In this embodiment, after receiving image data uploaded by a client, an image processing model is introduced at a server side to replace the server to perform operations such as image adjustment and image classification, so that the server is prevented from directly processing the image data uploaded by the client, and after receiving the image processing model and outputting the image adjustment data and the image prediction category, the image adjustment data and the image prediction category are directly sent to the client by responding to a request of the client, so that the computing resource consumption of the server can be reduced, the load pressure of the server is reduced, and the response speed of the server is improved.
Embodiment 2, referring to fig. 6, fig. 6 is a schematic structural diagram of an embodiment of a server optimizing apparatus provided by the present invention, as shown in fig. 6, the apparatus includes an image parameter analysis module 601, a model prediction module 602, and an image data transmission module 603, and specifically includes the following steps:
The image parameter analysis module 601 is configured to receive image data uploaded by a client, and perform parameter analysis on the image data to obtain image parameter data.
The model prediction module 602 is configured to input the image data and the image parameter data into a pre-trained image processing model, so that the image processing model adjusts the image data based on the image parameter data to obtain image adjustment data, and performs image classification processing on the image adjustment data to obtain an image prediction class.
The image data transmission module 603 is configured to send the image adjustment data and the image prediction type to the client in response to an image data transmission request initiated by the client.
The invention provides a server optimizing device, which further comprises: and a model training module.
In an embodiment, the model training module is configured to perform model pre-training on the image processing model, where a pre-training process of the image processing model specifically includes: acquiring sample image data, and sample tag class true values and sample image parameter data corresponding to the sample image data; inputting the sample image data and the sample image parameter data into an image processing model, so that the image processing model adjusts the sample image data based on the sample image parameter data to obtain sample image adjustment data, and performs image classification processing on the sample image adjustment data to obtain preset label category predicted values corresponding to each sample label category; and inputting the sample tag class true value and the tag class predicted value into a preset cross entropy loss function, calculating to obtain a model loss value, and adjusting model parameters of the image processing model based on the model loss value until the image processing model converges.
In one embodiment, the preset cross entropy loss function is as follows:
Where α represents weight information, h s(x(i)) represents an i-th sample tag class prediction value, y (i) represents an i-th sample tag class true value, K represents a learning rate, Representing constraints, m being the number of sample label categories and n being the number of sample image data.
In an embodiment, the model training module adjusts the sample image data based on the sample image parameter data to obtain sample image adjustment data, and specifically includes: decoding the sample image parameter data based on a preset encoder in the image processing model to obtain decoded image parameters, extracting features of the sample image parameter data based on the decoded image parameters to obtain image parameter features, obtaining a target image in the sample image data, performing image adjustment on the target image based on the image parameter features to obtain a target adjustment image, and taking the target adjustment image as sample image adjustment data.
In an embodiment, the model training module performs image classification processing on the sample image adjustment data to obtain a label class prediction value corresponding to each sample label class, and specifically includes: dividing the target adjustment image into a plurality of sub-images, acquiring a vector sequence corresponding to each sub-image, performing splicing processing on the vector sequence to generate spliced vector features, inputting the spliced vector features into a preset encoder to enable the encoder to output the target adjustment image features, performing linear transformation processing on the target adjustment image features to obtain linear target adjustment image features, and converting the linear target adjustment image features into probability distribution values of preset sample label categories to obtain label category predicted values corresponding to each sample label category.
In an embodiment, the model training module performs a stitching process on the vector sequence to generate a stitched vector feature, and specifically includes: and adding position codes and category information to each vector sequence to obtain a corresponding preprocessing vector sequence, and performing splicing processing on all the preprocessing vector sequences to obtain spliced vector features.
Specifically, all the preprocessing vector sequences are spliced based on a preset splicing formula; the preset splicing formula is as follows:
merge=concat(α1Image block1+α2Image block2+α3Image block3+...αnImage blockn);
In the formula, concat represents stitching, alpha 1、α2、α3……αn is a preset weight coefficient, image block 1 represents a pre-processing vector sequence corresponding to the 1 st sub-Image, image block 2 represents a pre-processing vector sequence corresponding to the 2 nd sub-Image, image block 3 represents a pre-processing vector sequence corresponding to the 3 rd sub-Image, image block n represents a pre-processing vector sequence corresponding to the nth sub-Image, and merge represents stitching vector features.
In an embodiment, the encoder includes a multi-head attention mechanism layer, a splicing layer, a layer normalization layer, a multi-layer perceptron, and a random inactivation layer, and the model training module is configured to input the spliced vector features into a preset encoder, so that the encoder outputs target adjustment image features.
In an embodiment, the multi-head attention mechanism layer is configured to perform self-attention computation on the spliced vector features to obtain a plurality of self-attention vector features, and input the plurality of self-attention vector features to the spliced layer.
In an embodiment, the stitching layer is configured to perform stitching processing on the multiple self-attention vector features to obtain stitched self-attention vector features, and input the stitched self-attention vector features into the layer normalization layer.
In an embodiment, the layer normalization layer is configured to perform layer normalization calculation on the spliced self-attention vector feature to obtain a layer normalization vector feature, and input the layer normalization vector feature into the multi-layer perceptron.
In an embodiment, the multi-layer perceptron is configured to perform nonlinear transformation processing on the layer normalized vector features to obtain a plurality of nonlinear features.
In an embodiment, the random inactivation layer is configured to perform random discarding processing on the plurality of nonlinear features, and output a target adjustment image feature.
In one embodiment, before inputting the image data and the image parameter data into the pre-trained image processing model, respectively, the method further comprises: acquiring sample image data, and obtaining a sample label category true value and a sample image parameter corresponding to the sample image data; inputting the sample image data and the sample image parameters into an image processing model, so that the image processing model adjusts the sample image data based on the sample image parameters to obtain sample image adjustment data, and performs image classification processing on the sample image adjustment data to obtain a label class prediction value corresponding to each sample label class; and inputting the sample tag class true value and the tag class predicted value into a preset cross entropy loss function, calculating to obtain a model loss value, and adjusting model parameters of the image processing model based on the model loss value until the image processing model converges.
In one embodiment, the preset cross entropy loss function is as follows:
Where α represents weight information, h s(x(i)) represents an i-th sample tag class prediction value, y (i) represents an i-th sample tag class true value, K represents a learning rate, Representing constraints, m being the number of sample label categories and n being the number of sample image data.
The server optimizing device provided in this embodiment further includes: and a server monitoring module.
In one embodiment, the server monitoring module is configured to monitor, in real time, a running time of an image processing process on the central processing unit, and a memory occupancy rate and a video memory utilization rate of the image processing process; determining the resource occupancy rate of the image processing process based on the running time, the memory occupancy rate and the video memory utilization rate; and comparing the resource occupancy rate with a preset resource occupancy threshold value, triggering a resource alarm if the resource occupancy rate is larger than the resource occupancy threshold value, and automatically sending an alarm notification.
It will be clear to those skilled in the art that, for convenience and brevity of description, the specific working process of the above-described apparatus may refer to the corresponding process in the foregoing method embodiment 2, which is not described herein in detail.
It should be noted that the foregoing embodiments of the server optimization device are merely illustrative, where the modules described as separate components may or may not be physically separated, and components shown as modules may or may not be physical units, may be located in one place, or may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
On the basis of the embodiment of the server optimization method, another embodiment of the present invention provides a server optimization terminal device, and fig. 7 is a schematic structural diagram of the terminal device. As shown in fig. 7, the terminal device 7 of this embodiment includes: at least one processor 701 (only one shown in fig. 7), a memory 702, and a computer program 703 stored in the memory 702 and executable on the at least one processor 701, the processor 701 implementing the steps in any of the method embodiments described above when the computer program 703 is executed.
The terminal device 7 may be a computing device such as a smart phone, a notebook computer, a tablet computer, and a desktop computer. The terminal device may include, but is not limited to, a processor 701, a memory 702. It will be appreciated by those skilled in the art that fig. 7 is merely an example of the terminal device 7 and is not limiting of the terminal device 7, and may include more or fewer components than shown, or may combine certain components, or different components, such as may also include input-output devices, network access devices, etc.
The Processor 701 may be a central processing unit (Central Processing Unit, CPU), and the Processor 701 may also be other general purpose processors, digital signal processors (DIGITAL SIGNAL processors, DSPs), application SPECIFIC INTEGRATED Circuits (ASICs), off-the-shelf Programmable gate arrays (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 702 may in some embodiments be an internal storage unit of the terminal device 7, such as a hard disk or a memory of the terminal device 7. The memory 702 may also be an external storage device of the terminal device 7 in other embodiments, such as a plug-in hard disk provided on the terminal device 7, a smart memory card (SMART MEDIA CARD, SMC), a Secure Digital (SD) card, a flash memory card (FLASH CARD), etc. Further, the memory 702 may also include both an internal storage unit of the terminal device 7 and an external storage device. The memory 702 is used to store an operating system, application programs, boot loader (BootLoader), data, and other programs, such as program code for computer programs. The memory 702 may also be used to temporarily store data that has been output or is to be output.
In addition, the embodiment of the application further provides a computer readable storage medium, and the computer readable storage medium stores a computer program, and the computer program realizes the steps in any of the method embodiments when being executed by a processor.
The embodiments of the present application provide a computer program product which, when run on a terminal device, causes the terminal device to perform the steps of the method embodiments described above.
In several embodiments provided by the present application, it will be understood that each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored on a computer readable storage medium. Based on this understanding, the technical solution of the present application, or the parts contributing to the prior art or the parts of the technical solution, may be embodied in the form of a software product stored in a storage medium, comprising several instructions for causing a terminal device to perform all or part of the steps of the method of the various embodiments of the application. And the aforementioned storage medium includes: a usb disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In summary, according to the server optimization method and device provided by the invention, the image data uploaded by the client is received, and the image data is subjected to parameter analysis to obtain the image parameter data; respectively inputting the image data and the image parameter data into a pre-trained image processing model so that the image processing model adjusts the image data based on the image parameter data to obtain image adjustment data, and performing image classification processing on the image adjustment data to obtain an image prediction type; responding to an image data transmission request initiated by a client, and sending image adjustment data and image prediction categories to the client; compared with the prior art, the technical scheme of the invention can reduce the consumption of the computing resources of the server and improve the response speed to the client request.
The foregoing is merely a preferred embodiment of the present invention, and it should be noted that modifications and substitutions can be made by those skilled in the art without departing from the technical principles of the present invention, and these modifications and substitutions should also be considered as being within the scope of the present invention.
Claims (10)
1. A method for optimizing a server, comprising:
receiving image data uploaded by a client, and carrying out parameter analysis on the image data to obtain image parameter data;
respectively inputting the image data and the image parameter data into a pre-trained image processing model so that the image processing model adjusts the image data based on the image parameter data to obtain image adjustment data, and performing image classification processing on the image adjustment data to obtain an image prediction type;
and responding to the image data transmission request initiated by the client, and sending the image adjustment data and the image prediction category to the client.
2. A server optimization method as claimed in claim 1, wherein before said inputting said image data and said image parameter data, respectively, into a pre-trained image processing model, said method further comprises:
acquiring sample image data, and sample tag class true values and sample image parameter data corresponding to the sample image data;
Inputting the sample image data and the sample image parameter data into an image processing model, so that the image processing model adjusts the sample image data based on the sample image parameter data to obtain sample image adjustment data, and performs image classification processing on the sample image adjustment data to obtain a sample label class predicted value corresponding to each preset sample label class;
And inputting the sample label type true value and the sample label type predicted value into a preset cross entropy loss function, calculating to obtain a model loss value, and adjusting model parameters of the image processing model based on the model loss value until the image processing model converges.
3. The server optimization method according to claim 2, wherein the adjusting the sample image data based on the sample image parameter data to obtain sample image adjustment data specifically includes:
Decoding the sample image parameter data based on a preset encoder in the image processing model to obtain decoded image parameters, extracting features of the sample image parameter data based on the decoded image parameters to obtain image parameter features, obtaining a target image in the sample image data, performing image adjustment on the target image based on the image parameter features to obtain a target adjustment image, and taking the target adjustment image as sample image adjustment data.
4. The method for optimizing a server according to claim 3, wherein the performing image classification processing on the sample image adjustment data to obtain a sample tag class prediction value corresponding to each sample tag class specifically includes:
Dividing the target adjustment image into a plurality of sub-images, acquiring a vector sequence corresponding to each sub-image, performing splicing processing on the vector sequence to generate spliced vector features, inputting the spliced vector features into a preset encoder to enable the encoder to output the target adjustment image features, performing linear transformation processing on the target adjustment image features to obtain linear target adjustment image features, and converting the linear target adjustment image features into probability distribution values of preset sample label categories to obtain sample label category predicted values corresponding to each sample label category.
5. The method for optimizing a server according to claim 4, wherein the performing a stitching process on the vector sequence generates stitching vector features, specifically includes:
And adding position codes and category information to each vector sequence to obtain a corresponding preprocessing vector sequence, and performing splicing processing on all the preprocessing vector sequences to obtain spliced vector features.
6. The server optimization method according to claim 4, wherein the encoder includes a multi-head attention mechanism layer, a splicing layer, a layer normalization layer, a multi-layer perceptron, and a random inactivation layer, and the splicing vector features are input into a preset encoder to enable the encoder to output target adjustment image features, specifically comprising:
the multi-head attention mechanism layer is used for carrying out self-attention calculation on the spliced vector features to obtain a plurality of self-attention vector features, and inputting the plurality of self-attention vector features into the spliced layer;
The splicing layer is used for carrying out splicing processing on the plurality of self-attention vector features to obtain spliced self-attention vector features, and inputting the spliced self-attention vector features into the layer normalization layer;
The layer normalization layer is used for carrying out layer normalization calculation on the spliced self-attention vector features to obtain layer normalization vector features, and inputting the layer normalization vector features into the multi-layer perceptron;
The multi-layer perceptron is used for carrying out nonlinear transformation processing on the layer normalized vector characteristics to obtain a plurality of nonlinear characteristics;
and the random inactivation layer is used for carrying out random discarding processing on the nonlinear characteristics and outputting target adjustment image characteristics.
7. The server optimization method of claim 1, further comprising:
Monitoring the running time of an image processing process on a central processing unit in real time, and the memory occupancy rate and the video memory utilization rate of the image processing process;
Determining the resource occupancy rate of the image processing process based on the running time, the memory occupancy rate and the video memory utilization rate;
And comparing the resource occupancy rate with a preset resource occupancy threshold value, triggering a resource alarm if the resource occupancy rate is larger than the resource occupancy threshold value, and automatically sending an alarm notification.
8. A server optimizing apparatus, comprising: the system comprises an image parameter analysis module, a model prediction module and an image data transmission module;
The image parameter analysis module is used for receiving the image data uploaded by the client and carrying out parameter analysis on the image data to obtain image parameter data;
The model prediction module is used for respectively inputting the image data and the image parameter data into a pre-trained image processing model so that the image processing model adjusts the image data based on the image parameter data to obtain image adjustment data, and performs image classification processing on the image adjustment data to obtain an image prediction category;
the image data transmission module is used for responding to an image data transmission request initiated by the client and sending the image adjustment data and the image prediction type to the client.
9. A terminal device comprising a processor, a memory and a computer program stored in the memory and configured to be executed by the processor, the processor implementing the server optimization method according to any one of claims 1 to 7 when executing the computer program.
10. A computer readable storage medium, characterized in that the computer readable storage medium comprises a stored computer program, wherein the computer program, when run, controls a device in which the computer readable storage medium is located to perform the server optimization method according to any one of claims 1 to 7.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410090602.4A CN117930958A (en) | 2024-01-23 | 2024-01-23 | Server optimization method and device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410090602.4A CN117930958A (en) | 2024-01-23 | 2024-01-23 | Server optimization method and device |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN117930958A true CN117930958A (en) | 2024-04-26 |
Family
ID=90751729
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202410090602.4A Pending CN117930958A (en) | 2024-01-23 | 2024-01-23 | Server optimization method and device |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN117930958A (en) |
-
2024
- 2024-01-23 CN CN202410090602.4A patent/CN117930958A/en active Pending
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN111191791B (en) | Picture classification method, device and equipment based on machine learning model | |
| CN111294646B (en) | Video processing method, device, equipment and storage medium | |
| US20230237792A1 (en) | Object detection apparatus using an image preprocessing artificial neural network model | |
| JP6844301B2 (en) | Methods and data processors to generate time series data sets for predictive analytics | |
| CN111352965A (en) | Training method of sequence mining model, and processing method and equipment of sequence data | |
| US20230021551A1 (en) | Using training images and scaled training images to train an image segmentation model | |
| WO2022022233A1 (en) | Ai model updating method and apparatus, computing device and storage medium | |
| CN110929622A (en) | Video classification method, model training method, device, equipment and storage medium | |
| WO2021238586A1 (en) | Training method and apparatus, device, and computer readable storage medium | |
| US11360927B1 (en) | Architecture for predicting network access probability of data files accessible over a computer network | |
| CN110674673A (en) | Key video frame extraction method, device and storage medium | |
| CN111104831B (en) | Visual tracking method, device, computer equipment and medium | |
| CN110598620A (en) | Model training method and device, and target detection method and device | |
| CN116452810B (en) | Multi-level semantic segmentation method and device, electronic equipment and storage medium | |
| CN117336525A (en) | Video processing method, device, computer equipment and storage medium | |
| CN117834648A (en) | A deep learning-based object storage gateway access method | |
| CN111126501A (en) | Image identification method, terminal equipment and storage medium | |
| CN118381921B (en) | Machine inspection image high-quality compression management method, system, medium and equipment | |
| CN117930958A (en) | Server optimization method and device | |
| CN117058498A (en) | Training method of segmentation map evaluation model, and segmentation map evaluation method and device | |
| CN117218467A (en) | Model training method and related device | |
| CN118898272B (en) | AI model training and calling method and system based on edge computing | |
| US12444179B2 (en) | Model training method and model training system | |
| CN117952188B (en) | Online knowledge distillation method, target detection method and system, terminal and medium | |
| US20240422369A1 (en) | Highly efficient model for video quality assessment |
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 |