Lightweight model training method and device based on flash framework

The built-in training solution of the API service of the Flask framework solves the problem of high threshold and high hardware requirements for deep learning model training tasks, achieves fast and flexible model training, reduces development costs, and is suitable for non-professional operations.

CN118569406APending Publication Date: 2024-08-30FREESENSE IMAGE TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410712161.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-04
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

Existing deep learning model training tasks have high thresholds, require professional and technical personnel to operate, have long development cycles and require high hardware conditions, making it difficult to popularize them among non-professionals.

Method used

Using a lightweight model training method based on the Flask framework, by building a training solution with pre-built-in support for the API service, the client can pass pictures and parameters to achieve model training. It supports single interface and multi-interface access, and is suitable for local or remote training. Hardware requirements are low.

Benefits of technology

It realizes fast model training tasks, supports cross-language calls, reduces equipment hardware requirements, improves flexibility and scalability, reduces development costs, and is suitable for non-professional operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118569406A
    Figure CN118569406A
Patent Text Reader

Abstract

The invention discloses a lightweight model training method based on a flash framework, and the method comprises the following steps: S1, a preprocessing stage: defining related configuration information at a flash server; s2, selecting an access mode, wherein the access mode comprises a single-interface access mode and a multi-interface access mode; and S3, an execution stage: acquiring an image by an image acquisition module, processing the acquired image by an image preprocessing module to a standard requirement required by model training, starting a model service by a flash server, printing supported training scheme information, and performing model training. And the flash client transmits the processed image and the training parameter information through the API interface, calls the corresponding model training scheme and waits for the response of the flash server, and the technology can quickly realize the training task of the model and supports cross-language calling, and meanwhile, the requirement for equipment hardware is low.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field related to model training of deep learning, and specifically to a model training scheme based on a lightweight flask framework, which greatly reduces the knowledge reserve requirements for non-professionals. Background Art

[0002] Deep learning training tasks generally rely on professional technicians to complete operations in the form of underlying code. This method raises the threshold for model training. For some simple training task requirements, the training solutions can be integrated to make them popular among non-professionals.

[0003] Currently, the most common method is in the form of software, which has a long and cumbersome development cycle and also needs to take hardware conditions into consideration. Summary of the invention

[0004] In view of the shortcomings of the prior art, the present invention provides a lightweight model training method based on the flask framework. As a lightweight method, the present invention can pre-build all supported training schemes by building an API service and act as a server, waiting for the client to pass the image and the relevant parameters required for training to realize local or remote model training. This technology can quickly realize the model training task and support cross-language calls, and has low requirements for device hardware.

[0005] To achieve the above object, the present invention provides the following technical solutions: The lightweight model training method based on the flask framework includes the following steps: Step S1: In the preprocessing stage, define relevant configuration information on the flask server; Step S2: Select an access mode, including supporting single-interface access and multi-interface access; Step S3: In the execution phase, the image acquisition module acquires the image, and the acquired image is processed by the image preprocessing module to meet the standard requirements for model training. The flask server starts the model service and prints the supported training scheme information. The flask client passes the processed image and training parameter information through the API interface to call the corresponding model training scheme and wait for the response of the flask server.

[0006] As a further solution of the present invention, in step S1, the configuration information includes an IP address, a port number, an API interface, and default model training parameters.

[0007] As a further solution of the present invention, in step S2, the single-interface mode represents that only a single model training task is performed in the current server, and the multi-interface mode represents that multiple models training tasks are performed in the server.

[0008] As a further solution of the present invention, the single interface mode is set as follows: Pre-configure all model training schemes involved on the flask server and print relevant configuration information; The flask client calls the corresponding model training plan according to different API interfaces; when the flask client successfully calls the server, the flask server will receive the passed training parameters and apply them to the built-in training plan and perform training operations. After the training is completed, the model and log files are saved locally and the relevant information is responded to the flask client.

[0009] As a further solution of the present invention, the multi-interface mode is set as follows: Pre-configure all model training schemes involved on the flask server and print the configuration information to the port; The flask client calls multiple corresponding model training schemes according to different API interfaces; if the flask client successfully calls the server, the flask server will perform model training operations based on the received parameter information. After the training is completed, the model and log files will be saved to the relevant path, and the relevant prompt parameters for the end of training will be returned to the flask client.

[0010] The present invention also provides a lightweight model training device based on the flask framework, including a flask server, a flask client, an image acquisition module, and an image preprocessing module. The image acquisition module is used to acquire images, and the acquired images are processed by the image preprocessing module to meet the standard requirements required for model training. The flask server starts the model service and prints the supported training scheme information. The flask client transfers the processed image and training parameter information through an API interface to call the corresponding model training scheme and wait for the response of the flask server.

[0011] The present invention has the following beneficial effects: By building an API service, the present invention can pre-install all supported training schemes and act as a server, waiting for the client to pass the image and the relevant parameters required for training to achieve local or remote model training. This technology can quickly achieve model training tasks and support cross-language calls, while having low requirements for device hardware.

[0012] The present invention adopts a lightweight training method based on the flask framework, and can implement the model training task through a predefined API interface. Through different API interfaces, the client is supported to call multiple model solutions to complete different tasks. It has strong scalability, and developers can quickly use existing model training solutions by building API interfaces. It has strong flexibility, allowing developers to make custom adjustments or customize training solutions according to their needs.

[0013] In order to more clearly illustrate the structural features and effects of the present invention, the present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] Figure 1 This is an overview diagram of the flask framework call mentioned in the embodiment of the present invention.

[0015] Figure 2 This is a configuration file sample mentioned in the embodiment of the present invention.

[0016] Figure 3 This is an overview diagram of model calls within the flask framework server mentioned in an embodiment of the present invention.

[0017] Figure 4 This is a single interface mode calling flow chart mentioned in an embodiment of the present invention.

[0018] Figure 5 This is a multi-interface mode calling flow chart mentioned in an embodiment of the present invention. DETAILED DESCRIPTION

[0019] The present invention will be further explained below in conjunction with the accompanying drawings and related knowledge, and described clearly and completely. Obviously, the described application is only a part of the embodiments of the present invention, rather than all the embodiments.

[0020] In view of the high professional and technical threshold of existing training programs and the long and troublesome software development cycle, the purpose of the present invention is to effectively solve the problem by proposing a lightweight model training program based on the flask framework. First, the flask server pre-sets the API interface and pre-loads all built-in model training programs. For example, if the detection model needs to be trained at present, the detection model training program will be called inside the server through the set API interface. If the segmentation model needs to be trained at present, the segmentation model training program will be called inside the server through the set API interface. Secondly, the client transmits the relevant data required for training, such as image data, training parameters, etc. according to specific needs. Finally, the client will receive the results transmitted by the server.

[0021] Reference Figure 1-Figure 5As shown, the present invention provides a lightweight model training method based on the flask framework, comprising the following steps: Step S1: In the preprocessing stage, relevant configuration information is defined on the flask server, where the relevant configuration information includes IP address, port number, API interface, default model training parameters, etc. Step S2: Select the access mode, including supporting single-interface access and multi-interface access. The single-interface mode means that only a single model training task is performed in the current server. The multi-interface mode means that multiple models are trained in the server. Step S3: In the execution phase, the image acquisition module acquires the image, and the acquired image is processed by the image preprocessing module to meet the standard requirements for model training. The flask server starts the model service and prints the supported training scheme information, etc. The flask client passes the processed image and training parameters and other information through the API interface to call the corresponding model training scheme and wait for the response of the server.

[0022] In a preferred embodiment of the present invention, referring to Figure 2 As shown in the figure, a lightweight model training solution based on the flask framework is used to define the default training configuration file for the current model, including global configurations such as the IP address and port number, model repository (model weight path, training data, number of training rounds, training batch size, etc.), and API interface (including classification, detection, segmentation, and anomaly detection).

[0023] Reference Figure 3 As shown in the figure, different training schemes are accessed according to different API interfaces. The model training scheme can be divided into two modes: single interface and multi-interface according to the actual needs of the project.

[0024] The present invention supports single-interface and multi-interface dual modes in the server. Figure 4 As shown, the settings for single interface mode are as follows: Pre-configure all model training schemes involved on the flask server and print relevant configuration information, such as API interface information, current IP address and port number, and all supported model training schemes.

[0025] The flask client calls the corresponding model training scheme according to different API interfaces. For example, if the current training classification model is a classification model, the classification API interface is called and the parameters defined in the model repository in the configuration file are passed. The specific parameters include (model weight path, training data, number of training rounds, training batch size, etc.). Such parameters have default values ​​in the server and can be configured selectively. When the client successfully calls the server, the server will receive the passed training parameters and apply them to the built-in training scheme and perform the training operation. After the training is completed, the model and log files are saved locally and the relevant information is responded to the client.

[0026] The advantage of the single interface mode is that when only a single training model is needed, the training requirements can be quickly met through the relevant training scheme. Figure 4 As shown, it includes classification model training scheme, detection model training scheme, segmentation model training scheme, and anomaly detection model training scheme.

[0027] Reference Figure 5 As shown, the settings for multi-interface mode are as follows: The configuration of the multi-interface mode is similar to that of the single-interface mode. All model training schemes involved are configured in advance on the flask server, and the configuration information is printed to the port, including the supported API interfaces, IP addresses, port numbers, and default training parameters involved in the training scheme.

[0028] The flask client calls multiple corresponding model training schemes according to different API interfaces. For example, if you want to train both classification and detection models at the same time, you can configure the parameters required for the two model training in the classification and detection API interfaces respectively, including the training data file, the number of rounds used for training, the batch size used for training, the path for saving the training model, etc. If the client successfully calls the server, the server will perform model training operations based on the received parameters and other information. After the training is completed, the model and log files will be saved to the relevant path, and the training completion and other related prompt parameters will be returned to the client.

[0029] The advantage of the multi-interface mode is that it can train multiple models at the same time and maximize the use of hardware resources.

[0030] Reference Figure 1As shown, the present invention also provides a lightweight model training device based on the flask framework, including a flask server, a flask client, an image acquisition module, and an image preprocessing module. The image acquisition module is used to acquire images, and the acquired images are processed by the image preprocessing module to meet the standard requirements required for model training. The flask server starts the model service and prints the supported training scheme information. The flask client transfers the processed image and training parameter information through the API interface to call the corresponding model training scheme and wait for the response of the flask server.

[0031] In some embodiments, the image data is obtained by an image module, and the image acquisition module specifically refers to an industrial camera or other similar tool with a camera function. The image obtained by the image acquisition module is passed to the image preprocessing module, and the image preprocessing module refers to an algorithm module that combines common preprocessing methods such as image scaling and image cropping, and is processed to the standard requirements required for model training. The server is started and waits for the client to send a processed data request, and finally responds to the client with relevant results.

[0032] In summary, in view of the high development cost of existing training programs and the high requirements for non-professionals, the present invention proposes a lightweight model training program based on the flask framework to effectively solve the problem. The program executes the relevant training program by presetting the API, and supports both single interface and multi-interface modes. In the preprocessing stage, the required training program and the corresponding API interface are configured in the flask server. After the server is successfully started, relevant information including supported training program information, IP address, port number, etc. will be displayed. The flask client passes the interface defined in the configuration file, including the API interface and the training parameter interface, to the server for calling, and waits for relevant feedback after the server training is completed.

[0033] This solution can quickly implement training operations through API interfaces, and has strong scalability and flexibility, reducing certain development costs and providing more friendly support for non-professionals.

[0034] The technical principle of the present invention is described above in combination with the specific embodiments, which are only preferred implementations of the present invention. The protection scope of the present invention is not limited to the above embodiments, and all technical solutions under the idea of ​​the present invention belong to the protection scope of the present invention. Those skilled in the art can think of other specific implementations of the present invention without creative work, and these methods will fall within the protection scope of the present invention.

Claims

1. A lightweight model training method based on the flask framework, characterized in that: The following steps are involved: Step S1: In the preprocessing stage, define relevant configuration information on the flask server; Step S2: Select an access mode, including supporting single-interface access and multi-interface access; Step S3: In the execution phase, the image acquisition module acquires the image, and the acquired image is processed by the image preprocessing module to meet the standard requirements for model training. The flask server starts the model service and prints the supported training scheme information. The flask client passes the processed image and training parameter information through the API interface to call the corresponding model training scheme and wait for the response of the flask server.

2. The lightweight model training method based on the flask framework as claimed in claim 1, characterized in that: In step S1, the configuration information includes IP address, port number, API interface, and default model training parameters.

3. The lightweight model training method based on the flask framework as claimed in claim 2, characterized in that: In step S2, the single-interface mode represents that only a single model training task is performed in the current server, and the multi-interface mode represents that multiple models training tasks are performed in the server.

4. The lightweight model training method based on the flask framework as claimed in claim 3, characterized in that: The single interface mode is set as follows: Pre-configure all model training schemes involved on the flask server and print relevant configuration information; The flask client calls the corresponding model training scheme according to different API interfaces; When the flask client successfully calls the server, the flask server will receive the passed training parameters and apply them to the built-in training plan and perform the training operation. After the training is completed, the model and log files will be saved locally and the relevant information will be responded to the flask client.

5. The lightweight model training method based on the flask framework as claimed in claim 4, characterized in that: The multi-interface mode is set as follows: Pre-configure all model training schemes involved on the flask server and print the configuration information to the port; The flask client calls multiple corresponding model training schemes according to different API interfaces; If the flask client successfully calls the server, the flask server will perform model training operations based on the received parameter information. After the training is completed, the model and log files will be saved to the relevant path, and the relevant prompt parameters for the end of training will be returned to the flask client.

6. A lightweight model training device based on the flask framework, characterized in that: It includes a flask server, a flask client, an image acquisition module, and an image preprocessing module. The image acquisition module is used to acquire images. The acquired images are processed by the image preprocessing module to meet the standard requirements required for model training. The flask server starts the model service and prints the supported training program information. The flask client transfers the processed images and training parameter information through the API interface to call the corresponding model training program and wait for the response of the flask server.

Citation Information

Patent Citations

  • GIS ultrahigh frequency discharge signal detection device and method based on Faster-RCNN

    CN115184744A

  • Algorithm model calling method and device based on machine learning and medium

    CN117076084A