Home - ryanxingql/pythonutils GitHub Wiki

1. Data-set/sampler/loader

1.1. Select some images from the source directory

We glob the source directory, sort image and cut off images (by setting max_num and start_idx) when defining data-set. Don't worry about the shuffling; it is done in data-loader.

1.2. Test all images

Set max_num=-1 and start=0.

1.3. Data-loader for test

We set the batch_size of test data-loader to be one.

As a result, the input test data is with (B=1, C, H, W) in default.

2. Algorithm

This section is strongly associated with PowerQE. If you want to know how to use it, check it.

2.1. Multi-stage training

Each stage is independent of other stages. Thus, the loss functions, optimizers and schedulers should be assigned for each stage, respectively.

Note that the network is the same for all stages.

2.2. Multi-optimizer

You can assign different optimizers for different loss functions.

For example, at the second stage of training GANs, the generator and the discriminator possess their own optimizers. We say we have two groups of losses named dis and gen.

Note that in default, all optimizers possess all parameters. If you want each optimizer to possess different parameters, edit your own algorithm, especially create_optimizer function.

2.3. Deep supervision & dynamic structure

Edit your own algorithm, especially update_params function. Check RBQE algorithm in PowerQE for an example.