train package

train.training module

class train.training.RunModel

Bases: object

Run the training of the model.

do_work(gpu_id, file_id, uuid)

Run the training of the model and record the process.

Args:

gpu_id (int): The id of the GPU used to train the individual. file_id (str): The script name of the individual to be trained. uuid (str): The identifier of the individual

log_record(_str)

Output time and record.

Args:

_str (str): The output string.

class train.training.TrainModel(file_id, logger)

Bases: object

Define the training model and the corresponding parameters.

get_learning_rate()

Get the learning rate strategy based on the configuration information filled in train.ini.

get_optimizer(epoch)

Get the optimizer based on the configuration information filled in train.ini.

Args:

epoch (int): Number of epochs trained.

log_record(_str)

Output time and record.

Args:

_str (str): The output string.

process()

Training Model.

test(epoch)

Testing the model on the test set.

Args:

epoch (int): Number of epochs trained.

train(epoch)

Train the model on the training set.

Args:

epoch (int): Number of epochs trained.

train.utils module

class train.utils.Config(config_file, section)

Bases: object

Read and write ini files.

read_ini_file(key)

Read ini files.

Args:

key (str): The name of the key to be read.

read_ini_file_all()

Read ini files all.

write_ini_file(key, value)

Write ini files.

Args:

key (str): The name of the key to be written. value (str): Value to be written.

class train.utils.DatasetConfig

Bases: train.utils.Config

Read the dataset related content in the train.ini file.

class train.utils.LRConfig

Bases: train.utils.Config

Read the LearningRate related content in the train.ini file.

class train.utils.OptimizerConfig

Bases: train.utils.Config

Read the optimizer related content in the train.ini file.

class train.utils.TrainConfig

Bases: object

Configure the parameters related to dataset, optimizer and learningrate in class TrainModel.

static ConfigTrainModel(trainModel)

Configure the training model.

Args:

trainModel (class TrainModel): The TrainModel class to get the parameters.

static get_data_input_size()

Get data input size.

static get_out_cls_num()

Get the number of categories.