Model training method, device, electronic device and computer-readable storage medium

By generating randomly arranged training sample sets and utilizing distributed computing platforms and queue systems, the problem of long AI model training time is solved and training efficiency and effectiveness are improved.

CN113569884BActive Publication Date: 2024-09-06BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010357153.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-04-29
Publication Date
2024-09-06
Estimated Expiration
2040-04-29

AI Technical Summary

Technical Problem

In the existing technology, the training process based on the AI ​​model requires multiple random readings of training samples, which results in a long model training time and reduces the training efficiency.

Method used

By generating multiple training sample sets, each set contains multiple training samples, and randomly arranging their order during the generation process, the distributed computing platform and queue system are used to optimize the processing and use of training samples and reduce the number of readings of training samples. .

Benefits of technology

It shortens the model training time, improves the training efficiency, and reduces the storage space and processing cost occupied by the training sample set.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113569884B
    Figure CN113569884B
Patent Text Reader

Abstract

The embodiment of the present application provides a model training method, device, electronic device and computer-readable storage medium, which can obtain multiple training samples; based on the multiple training samples, generate multiple training sample sets, wherein each training sample set contains multiple training samples, and the order of the multiple training samples in each training sample set is random; in the process of generating multiple training sample sets, train the preset model according to the generated training sample sets; and output the trained preset model. Based on the above processing, the duration of model training can be shortened and the efficiency of model training can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a model training method, device, electronic device and computer-readable storage medium. Background Art

[0002] With the rapid development of AI (Artificial Intelligence) technology, the application scope of models based on AI algorithms is becoming more and more extensive. In related technologies, in order to obtain a model with higher accuracy, it is usually necessary to train the model of the initial structure multiple times based on multiple training samples.

[0003] In addition, in order to avoid overfitting, the order of training samples needs to be disrupted during the training of the model. For example, the number of training samples is 100, and the training samples are stored in a preset storage device. When the model needs to be trained, it can be randomly read from the storage device to obtain the above 100 training samples, and the model is trained based on the order of the read training samples. After the module training is completed based on the 100th training sample, it can be randomly read from the storage device again to obtain the above 100 training samples, and the model is trained based on the order of the read training samples, and so on, until the model reaches the convergence condition.

[0004] It can be seen that in the related technology, it is necessary to randomly read multiple training samples to complete the training of the model, which will result in a longer model training time and reduce the efficiency of model training. Summary of the invention

[0005] The purpose of the embodiments of the present application is to provide a model training method, device, electronic device and computer-readable storage medium, which can shorten the time of model training and improve the efficiency of model training. The specific technical solution is as follows:

[0006] In the first aspect, in order to achieve the above-mentioned purpose, the embodiment of the present application discloses a model training method, the method comprising:

[0007] Obtain multiple training samples;

[0008] Based on the multiple training samples, generate multiple training sample sets, wherein each of the training sample sets contains the multiple training samples, and the order of the multiple training samples in each training sample set is random;

[0009] In the process of generating the plurality of training sample sets, training a preset model according to the generated training sample sets;

[0010] Output the trained preset model.

[0011] Optionally, generating multiple training sample sets based on the multiple training samples includes:

[0012] Based on the preset distributed computing platform and the plurality of training samples, a plurality of training sample sets are generated in sequence.

[0013] Optionally, the method further includes:

[0014] Publish the generated training sample set to the preset queue;

[0015] The step of training the preset model according to the generated training sample set includes:

[0016] The training sample sets in the preset queue are extracted in sequence, and when each training sample set is extracted, the preset model is trained according to the training sample set.

[0017] Optionally, the method further includes:

[0018] When there is no consumable training sample set in the preset queue, the operation of training the preset model according to the training sample set is suspended until the number of times the preset model is trained reaches a preset number of times.

[0019] Optionally, publishing the generated training sample set to a preset queue includes:

[0020] Build multiple connection pools connected to preset queues;

[0021] The generated training sample set is sent to the preset queue through the multiple connection pools.

[0022] Optionally, the training of a preset model according to the generated training sample set includes:

[0023] According to the generation time sequence of the generated training sample sets, starting from the earliest generated training sample set, the generated training sample sets are used in sequence to train the preset model.

[0024] Optionally, obtaining a plurality of training samples includes:

[0025] Receiving a training sample screening instruction, wherein the training sample screening instruction carries a preset screening condition;

[0026] Extract a plurality of training samples that meet the preset screening conditions from a preset training sample database.

[0027] Optionally, the preset training sample database is a MongoDB database, and the training samples in the preset training sample database are stored in JSON format.

[0028] Optionally, the method further includes:

[0029] Storing the obtained multiple training samples in a preset archiving database;

[0030] and / or

[0031] While outputting the trained preset model, the output preset model and the association data between the preset model and the corresponding training samples are stored in a preset archiving database.

[0032] In a second aspect, in order to achieve the above-mentioned purpose, the embodiment of the present application discloses a model training device, the device comprising:

[0033] An acquisition module, used for acquiring multiple training samples;

[0034] A generating module, configured to generate a plurality of training sample sets based on the plurality of training samples, wherein each of the training sample sets includes the plurality of training samples, and the order of the plurality of training samples in each of the training sample sets is random;

[0035] A training module, used for training a preset model according to the generated training sample sets in the process of generating the multiple training sample sets;

[0036] The output module is used to output the trained preset model.

[0037] Optionally, the generating module is specifically configured to sequentially generate a plurality of training sample sets based on a preset distributed computing platform and the plurality of training samples.

[0038] Optionally, the device further comprises:

[0039] A sending module is used to publish the generated training sample set to a preset queue;

[0040] The training module is specifically used to extract the training sample sets in the preset queue in sequence, and when each training sample set is extracted, train the preset model according to the training sample set.

[0041] Optionally, the training module is specifically used to suspend the operation of training the preset model according to the training sample set when there is no consumable training sample set in the preset queue, until the number of times the preset model is trained reaches a preset number.

[0042] Optionally, the sending module is specifically used to build multiple connection pools connected to the preset queues;

[0043] The generated training sample set is sent to the preset queue through the multiple connection pools.

[0044] Optionally, the training module is specifically used to train the preset model using the generated training sample sets in sequence according to the generation time sequence of the generated training sample sets, starting from the earliest generated training sample set.

[0045] Optionally, the acquisition module is specifically used to receive a training sample screening instruction, wherein the training sample screening instruction carries a preset screening condition;

[0046] Extract a plurality of training samples that meet the preset screening conditions from a preset training sample database.

[0047] Optionally, the preset training sample database is a MongoDB database, and the training samples in the preset training sample database are stored in JSON format.

[0048] Optionally, the device further comprises:

[0049] A first storage module, used for storing the obtained multiple training samples in a preset archiving database;

[0050] and / or

[0051] The second storage module is used to store the output preset model and the association data between the preset model and the corresponding training samples in a preset archiving database while outputting the trained preset model.

[0052] On the other hand, in order to achieve the above-mentioned purpose, an embodiment of the present application further discloses an electronic device, the electronic device comprising a memory and a processor;

[0053] The memory is used to store computer programs;

[0054] The processor is used to implement the model training method described in the first aspect when executing the program stored in the memory.

[0055] On the other hand, in order to achieve the above-mentioned purpose, an embodiment of the present application also discloses a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the model training method described in the first aspect above is implemented.

[0056] On the other hand, in order to achieve the above-mentioned purpose, an embodiment of the present application also discloses a computer program product containing instructions, which, when running on a computer, enables the computer to execute the model training method described in the first aspect above.

[0057] An embodiment of the present application provides a model training method, which can obtain multiple training samples; based on the multiple training samples, generate multiple training sample sets, wherein each training sample set contains multiple training samples, and the order of the multiple training samples in each training sample set is random; in the process of generating multiple training sample sets, train a preset model according to the generated training sample sets; and output the trained preset model.

[0058] Based on the above processing, multiple training sample sets can be generated by reading the training sample only once. Under the premise of ensuring that the order of training samples in each training sample set is random, the number of times the training samples are read is reduced, thereby shortening the model training time and improving the efficiency of model training.

[0059] Of course, implementing any product or method of the present application does not necessarily require achieving all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0061] Figure 1 A flow chart of a model training method provided in an embodiment of the present application;

[0062] Figure 2 Another flow chart of the model training method provided in the embodiment of the present application;

[0063] Figure 3 Another flow chart of the model training method provided in the embodiment of the present application;

[0064] Figure 4 Another flow chart of the model training method provided in the embodiment of the present application;

[0065] Figure 5 A workflow diagram of a model training system provided in an embodiment of the present application;

[0066] Figure 6 A structural diagram of a model training device provided in an embodiment of the present application;

[0067] Figure 7 A structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0068] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0069] In the related art, it is necessary to randomly read multiple training samples to complete the model training, which will result in a longer model training time and reduce the efficiency of model training.

[0070] In order to solve the above problems, the embodiment of the present application provides a model training method, which can be applied to an electronic device, and the electronic device is used to train a preset model. Figure 1 , the method may include the following steps:

[0071] S101: Acquire multiple training samples.

[0072] S102: Generate multiple training sample sets based on multiple training samples.

[0073] Each training sample set includes multiple training samples, and the order of the multiple training samples in each training sample set is random.

[0074] S103: In the process of generating multiple training sample sets, the preset model is trained according to the generated training sample sets.

[0075] S104: Output the trained preset model.

[0076] It can be seen that the model training method provided in the embodiment of the present application can generate multiple training sample sets by reading multiple training samples only once. Under the premise of ensuring that the order of training samples in each training sample set is random, the number of times training samples are read is reduced, thereby shortening the time of model training and improving the efficiency of model training.

[0077] In step S101, in one implementation, the electronic device may store training samples locally, and when a preset model needs to be trained, the electronic device may directly read the samples locally to obtain multiple training samples.

[0078] Alternatively, the training samples may be stored in a preset storage device, and when the preset model needs to be trained, the electronic device may read from the storage device to obtain a plurality of training samples.

[0079] In one embodiment, the preset storage device may be a high-performance SSD (Solid State Disk). Reading training samples from the SSD can further improve the speed of reading training samples, shorten the duration of model training, and improve the efficiency of model training.

[0080] In addition, in order to further improve the efficiency of model training, a training sample database can be pre-constructed, and the electronic device can extract training samples from the training sample database according to user needs.

[0081] In one embodiment, S101 may include the following steps: receiving a training sample screening instruction, and extracting a plurality of training samples that meet preset screening conditions from a preset training sample database.

[0082] The training sample screening instruction carries preset screening conditions.

[0083] The preset screening conditions may include labels of training samples, time for storing training samples, and types of training samples.

[0084] In one implementation, a database (ie, a preset training sample database) may be established to store pre-acquired training samples. The preset training sample database may be a MongoDB database, Mysql, Hive, or other types of databases.

[0085] When the preset model needs to be trained, the user can input a training sample filtering instruction carrying preset filtering conditions into the electronic device. Accordingly, the electronic device can extract the preset filtering conditions, and then, can obtain training samples that meet the preset filtering conditions from the preset training sample database for training the preset model.

[0086] For example, you can obtain labeled training samples generated by the annotation system, training samples collected by technicians through offline channels, and other publicly available data sets. The data sets may include ImageNet, MNIST, CIFAR-10, etc. The above-mentioned annotation system can be built based on MySQL or other types of databases.

[0087] Then, the acquired data may be stored in a preset training sample database. Subsequently, according to the user's training sample screening instruction, training samples meeting the preset screening conditions may be extracted from the preset training sample database.

[0088] Based on the above processing, the user can select the required training samples to train the preset model, which can meet the user's personalized needs.

[0089] In one embodiment, the preset training sample database may be a MongoDB database, and the training samples in the preset training sample database may be stored in a JSON format.

[0090] In an embodiment of the present application, a MongoDB database can be used to store training samples. Compared with a relational database (for example, Mysql), the table structure and field type of the MongoDB database are flexible and variable, and the mode is free. Compared with Hive based on HDFS (Hadoop Distributed File System), the MongoDB database has better flexibility and low-latency query characteristics for large amounts of data.

[0091] In addition, storing training samples in JSON format can improve the efficiency of data generation and data analysis, effectively improve the efficiency of data transmission, and further improve the efficiency of model training.

[0092] In step S102, the number of generated training sample sets may be determined according to the number of training times when the preset model reaches convergence.

[0093] For example, the number of training sample sets may be the epochs required for training the preset model. One epoch is equal to training the preset model once using all training samples.

[0094] In one embodiment, in order to further improve the efficiency of model training, see Figure 2 , S102 may include the following steps:

[0095] S1021: Based on a preset distributed computing platform and multiple training samples, generate multiple training sample sets in sequence.

[0096] The preset distributed computing platform may be a Spark distributed computing platform or other distributed computing platforms.

[0097] In an embodiment of the present application, after obtaining multiple training samples, the electronic device can call an API (Application Programming Interface) corresponding to a preset distributed computing platform, and then process the multiple training samples based on the preset distributed computing platform. With the help of the distributed computing capabilities of the preset distributed computing platform, multiple training sample sets can be quickly generated in sequence, and each generated training sample set contains the above-mentioned multiple training samples. The order of training samples in each generated training sample set is random, which can increase the speed of generating training sample sets, shorten the duration of model training, and improve the efficiency of model training.

[0098] In one embodiment, Figure 2Based on Figure 3 , the method may further include the following steps:

[0099] S105: Publish the generated training sample set to a preset queue.

[0100] Accordingly, S103 may include the following steps: S1031: extracting training sample sets in a preset queue in sequence, and when each training sample set is extracted, training the preset model according to the training sample set.

[0101] In one implementation, after each training sample set is generated based on a preset distributed computing platform, the preset model can be trained based on a message system, which can be a Kafka system or an MQ (MessageQueue) system.

[0102] For example, the preset distributed computing platform may serve as a publishing end of the message system. After each training sample set is generated, the preset distributed computing platform may publish the training sample set to a preset queue of the message system.

[0103] Correspondingly, a model training module may be configured in the electronic device, and the model training module may serve as the consumer end of the message system.

[0104] Based on the point-to-point transmission mode of the message system, when the preset distributed computing platform publishes a training sample set to the preset queue, the model training module can extract the training sample set from the preset queue and train the preset model based on the training sample set. That is, the model training module can consume the training sample set after the preset distributed computing platform publishes the training sample set to the preset queue, and then delete the training sample set from the preset queue.

[0105] Based on the above processing, it is possible to generate a training sample set and at the same time train the preset model based on the generated training sample set, thereby shortening the model training time and reducing the storage space occupied by the training sample set.

[0106] In one embodiment, S105 may include the following steps:

[0107] Construct multiple connection pools connected to the preset queues; send the generated training sample sets to the preset queues through the multiple connection pools.

[0108] In an embodiment of the present application, in order to further shorten the duration of model training and improve the efficiency of model training, a training sample set can be sent to a preset queue through multiple connection pools.

[0109] The number of connection pools constructed can be set by technicians based on experience. For example, the number of connection pools can be 3, or 5, but is not limited thereto. Exemplarily, the Spark distributed computing platform and the Kafka system can be combined to send the training sample set to a preset queue.

[0110] Based on the Spark distributed computing platform, multiple training sample sets can be generated in sequence, and the generated training sample sets can be stored in Spark partitions. In addition, multiple Kafka connection pools can be built, KafkaProducer can be encapsulated based on the connection pool, and the encapsulated Kafka Producer can be broadcast to multiple SparkExecutors. Then, after multiple Spark Executors obtain the encapsulated Kafka Producer, they can obtain the connection pool and send the training sample sets in Spark partitions to the preset queue through each connection pool.

[0111] Based on the above processing, through multiple connection pools, the speed of sending training sample sets to the preset queue can be increased, so as to further shorten the duration of model training and improve the efficiency of model training.

[0112] In one embodiment, Figure 3 Based on Figure 4 , the method may further include the following steps:

[0113] S106: When there is no consumable training sample set in the preset queue, suspend the operation of training the preset model according to the training sample set until the number of times the preset model is trained reaches a preset number of times.

[0114] In an embodiment of the present application, when there are training sample sets in the preset queue, the model training module can extract the training sample sets from the preset queue in sequence for consumption. When there are no consumable training sample sets in the preset queue, the model training module can suspend the training of the preset model until the preset model is trained according to all the generated training sample sets, at which point the preset model reaches a convergence state, and a trained preset model is obtained.

[0115] Based on the above processing, the preset model is trained according to each generated training sample set in turn, which can shorten the time of model training and improve the efficiency of model training.

[0116] In one embodiment, step S103 may include the following steps: training the preset model using the generated training sample sets in sequence, starting from the earliest generated training sample set, according to the generation time sequence of the generated training sample sets.

[0117] In an embodiment of the present application, the preset model may be trained according to each training sample set in sequence according to the chronological order of generation time of the training sample sets.

[0118] For example, after each training sample set is generated, the training sample set can be sent to a preset queue. That is to say, the training sample sets in the preset queue are arranged in the order of generation time. Correspondingly, when extracting training sample sets from the preset queue, the first extracted training sample sets are generated earlier, and the later extracted training sample sets are generated later. Then, based on the order in which the training sample sets are extracted from the preset queue, the preset model is trained, which can ensure that the preset model is trained in the order of generation time of the training sample sets.

[0119] In one embodiment, the method may further include the following steps: storing the acquired multiple training samples to a preset archive database; and / or, while outputting the trained preset model, storing the output preset model and the association data between the preset model and the corresponding training samples to a preset archive database.

[0120] In the embodiment of the present application, a preset archiving database may be set, and accordingly, the acquired multiple training samples may be stored in the preset archiving database.

[0121] In addition, after the preset model is trained, the trained preset model and the used training samples may be correspondingly stored in a preset archive database.

[0122] Subsequently, when the user modifies the training samples in the above-mentioned preset training sample database, based on the method provided in the embodiment of the present application, the preset model can be trained according to the modified training samples, and then the new model obtained by training and the corresponding modified training samples can be stored in the preset archive database. Based on the preset training sample database and the preset archive database, the model and training samples can be traced back.

[0123] See also Figure 5 , Figure 5 A workflow diagram of a model training system provided in an embodiment of the present application, the model training system may include an ETL (Extract Transform Load) module, a data generation module, a lifecycle management module, a distributed Shuffle module, and a model training module.

[0124] Figure 5In the ETL module, the ETL module can obtain multiple training samples from the annotation database, external data sources and public data sets. The annotation database can store labeled training samples generated by the annotation system. The external data source can include training samples collected by technicians through offline channels. The public data sets can include ImageNet, MNIST, CIFAR-10, etc. The above data can be used to train the preset model.

[0125] The training data warehouse may represent the preset training sample database in the above embodiment, and the ETL module may store the acquired training samples in the training data warehouse in JSON format.

[0126] The data generation module is responsible for generating training samples for training the preset model. For example, it can obtain the filtering conditions input by the user and extract multiple training samples that meet the filtering conditions from the training data warehouse for training the preset model and send them to the distributed Shuffle module.

[0127] The distributed Shuffle module can be implemented based on the Spark distributed computing platform and the Kafka system. The distributed Shuffle module can be used as the publishing end of the message system. After receiving multiple training samples sent by the data generation module, based on the powerful distributed computing capabilities of Spark, multiple training sample sets are generated according to the preset epoch, and written into Kafka (i.e., the preset queue in the above embodiment) in real time.

[0128] In the process of training the model, in order to avoid overfitting of the model, it is necessary to perform a shuffle operation on the training samples. In the related technology, the shuffle operation on the training samples often leads to high time cost and hardware cost. Based on the above-mentioned distributed shuffle module, with the help of the Spark computing framework and the Kafka system, it is only necessary to read multiple training samples at a time, which can reduce the time cost and hardware cost, and then improve the training efficiency of the model and reduce the cost.

[0129] The model training module can serve as the consumer end of the message system and train the preset model based on the training program and the training sample set in the preset queue. The model training module can consume the training sample set in the preset queue in real time, that is, it can extract the training sample set published by the distributed Shuffle module from the preset queue and train the preset model based on the training sample set. When there is no consumable training sample set in the preset queue, the model training module can suspend training until the number of training reaches the preset epoch, and then the trained preset model can be output.

[0130] In addition, the module training module can also store the trained preset model and the corresponding training samples in a preset archive database.

[0131] In the process of training and iterative optimization of the preset model, the labels or attributes of the training samples are often modified. At the same time, since the process of model training is cumbersome and error-prone, the relevant technology lacks a full-link flow and traceability method for data in the entire model training process, which may cause the model training cycle to become lengthy.

[0132] Based on Figure 5 In the lifecycle management module, when the data in the training data warehouse is modified, the training samples before and after the modification can be synchronized to the preset archive database in time to achieve traceability of the training samples. Figure 5 The model training system can improve the processing efficiency of the training sample set, thereby shortening the model training cycle and improving the model training efficiency.

[0133] Based on the same inventive concept, the present application embodiment also provides a model training device, see Figure 6 , Figure 6 A structural diagram of a model training device provided in an embodiment of the present application, the device comprising:

[0134] An acquisition module 601 is used to acquire multiple training samples;

[0135] A generating module 602 is configured to generate a plurality of training sample sets based on the plurality of training samples, wherein each of the training sample sets includes the plurality of training samples, and the order of the plurality of training samples in each of the training sample sets is random;

[0136] A training module 603 is used to train a preset model according to the generated training sample sets during the process of generating the multiple training sample sets;

[0137] The output module 604 is used to output the trained preset model.

[0138] Optionally, the generating module 602 is specifically configured to sequentially generate a plurality of training sample sets based on a preset distributed computing platform and the plurality of training samples.

[0139] Optionally, the device further comprises:

[0140] A sending module is used to publish the generated training sample set to a preset queue;

[0141] The training module 603 is specifically used to extract the training sample sets in the preset queue in sequence, and when each training sample set is extracted, train the preset model according to the training sample set.

[0142] Optionally, the training module 603 is specifically used to suspend the operation of training the preset model according to the training sample set when there is no consumable training sample set in the preset queue, until the number of times the preset model is trained reaches a preset number of times.

[0143] Optionally, the sending module is specifically used to build multiple connection pools connected to the preset queues;

[0144] The generated training sample set is sent to the preset queue through the multiple connection pools.

[0145] Optionally, the training module 603 is specifically configured to train a preset model using the generated training sample sets in sequence according to the generation time sequence of the generated training sample sets, starting from the earliest generated training sample set.

[0146] Optionally, the acquisition module 601 is specifically configured to receive a training sample screening instruction, wherein the training sample screening instruction carries a preset screening condition;

[0147] Extract a plurality of training samples that meet the preset screening conditions from a preset training sample database.

[0148] Optionally, the preset training sample database is a MongoDB database, and the training samples in the preset training sample database are stored in JSON format.

[0149] Optionally, the device further comprises:

[0150] A first storage module, used for storing the obtained multiple training samples in a preset archiving database;

[0151] and / or

[0152] The second storage module is used to store the output preset model and the association data between the preset model and the corresponding training samples in a preset archiving database while outputting the trained preset model.

[0153] The model training device provided in the embodiment of the present application can generate multiple training sample sets by reading the training samples only once. Under the premise of ensuring that the order of the training samples in each training sample set is random, the number of times the training samples are read is reduced, thereby shortening the time of model training and improving the efficiency of model training.

[0154] The present application also provides an electronic device, such as Figure 7 As shown, it includes a memory 701 and a processor 702;

[0155] Memory 701, used for storing computer programs;

[0156] The processor 702 is used to implement the model training method provided in the embodiment of the present application when executing the program stored in the memory 701.

[0157] Specifically, the above model training method includes:

[0158] Obtain multiple training samples;

[0159] Based on the multiple training samples, generate multiple training sample sets, wherein each of the training sample sets contains the multiple training samples, and the order of the multiple training samples in each training sample set is random;

[0160] In the process of generating the plurality of training sample sets, training a preset model according to the generated training sample sets;

[0161] Output the trained preset model.

[0162] It should be noted that other implementation methods of the above-mentioned model training method are the same as those of the aforementioned method embodiment and will not be repeated here.

[0163] The electronic device may be provided with a communication interface for realizing communication between the electronic device and other devices.

[0164] The processor, communication interface, and memory communicate with each other via a communication bus, and the communication bus mentioned here may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus may be divided into an address bus, a data bus, a control bus, etc.

[0165] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0166] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0167] An embodiment of the present application also provides a computer-readable storage medium, which stores instructions. When the computer-readable storage medium is run on a computer, it enables the computer to execute the model training method provided by the embodiment of the present application.

[0168] An embodiment of the present application also provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the model training method provided by the embodiment of the present application.

[0169] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.

[0170] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0171] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, electronic device, computer-readable storage medium, and computer program product embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0172] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims

1. A model training method, characterized in that: The method comprises: Acquire multiple training samples; the multiple training samples are pictures in a preset data set; Based on the multiple training samples, multiple training sample sets are generated, wherein each of the training sample sets contains the multiple training samples, and the order of the multiple training samples in each training sample set is random; the generating multiple training sample sets based on the multiple training samples includes: based on a preset distributed computing platform and the multiple training samples, sequentially generating multiple training sample sets; Publishing the generated training sample set to a preset queue; publishing the generated training sample set to the preset queue includes: building multiple connection pools connected to the preset queue; sending the generated training sample set to the preset queue through the multiple connection pools; In the process of generating the plurality of training sample sets, the preset model is trained according to the generated training sample sets; the training of the preset model according to the generated training sample sets comprises: extracting the training sample sets in the preset queue in sequence, and when each training sample set is extracted, training the preset model according to the training sample set; Output the trained preset model.

2. The method according to claim 1, characterized in that: The method further comprises: When there is no consumable training sample set in the preset queue, the operation of training the preset model according to the training sample set is suspended until the number of times the preset model is trained reaches a preset number of times.

3. The method according to claim 1, characterized in that The step of training the preset model according to the generated training sample set includes: According to the generation time sequence of the generated training sample sets, starting from the earliest generated training sample set, the generated training sample sets are used in sequence to train the preset model.

4. The method according to claim 1, characterized in that: The obtaining of multiple training samples comprises: Receiving a training sample screening instruction, wherein the training sample screening instruction carries a preset screening condition; Extract a plurality of training samples that meet the preset screening conditions from a preset training sample database.

5. The method according to claim 4, characterized in that The preset training sample database is a MongoDB database, and the training samples in the preset training sample database are stored in JSON format.

6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: Storing the obtained multiple training samples in a preset archiving database; and / or While outputting the trained preset model, the output preset model and the association data between the preset model and the corresponding training samples are stored in a preset archiving database.

7. A model training device, characterized in that: The device comprises: An acquisition module, used to acquire multiple training samples; the multiple training samples are pictures in a preset data set; A generation module, used to generate multiple training sample sets based on the multiple training samples, wherein each of the training sample sets contains the multiple training samples, and the order of the multiple training samples in each training sample set is random; the generation module is specifically used to sequentially generate multiple training sample sets based on a preset distributed computing platform and the multiple training samples; A sending module, used to publish the generated training sample set to a preset queue; the sending module is specifically used to build a plurality of connection pools connected to the preset queue; and send the generated training sample set to the preset queue through the plurality of connection pools; A training module, used to train the preset model according to the generated training sample sets in the process of generating the multiple training sample sets; the training module is specifically used to extract the training sample sets in the preset queue in sequence, and when each training sample set is extracted, train the preset model according to the training sample set; The output module is used to output the trained preset model.

8. An electronic device, characterized in that: including memory and processor; The memory is used to store computer programs; The processor is used to implement the method steps described in any one of claims 1-6 when executing the program stored in the memory.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 6 are implemented.