Addresses Issue: #30
Merged Phase 1 and Phase 2 trainer.
Tn this PR the two functions from those different files(phase_1.py and phase_2.py) are merged into one file called train.py. Since these are two independent functions, some of the same variables are being reused and reloaded in each of the cases, which is not one of the finest solution, provided it may take some time, onloading and offloading the dataset from the memory.
Proposed Design Suggestion
Instead of using different functions and using similar variables in two different functions,
It would be better to use this design, saving memory and time wasted in on loading and off loading data, (especially, reloading the entire dataset) to and from the memory.
class Trainer(object):
@classmethod
def setup_training(cls, Generator, Discriminator, summary_writer, data_dir=None):
cls.G = Generator
cls.D = Discriminator
cls.summary_writer = summary_writer
cls.dataset = utils.load_dataset(data_dir=data_dir, ...)
@classmethod
def train_psnr(cls):
# use class params:
# cls.G, cls.D, cls.summary_writer, cls.dataset
# to train the psnr model
pass
@classmethod
def train_gan(cls):
# use class params:
# cls.G, cls.D, cls.summary_writer, cls.dataset
# to train ESRGAN model
pass
Addresses Issue: #30 Merged Phase 1 and Phase 2 trainer. Tn this PR the two functions from those different files(phase_1.py and phase_2.py) are merged into one file called
train.py
. Since these are two independent functions, some of the same variables are being reused and reloaded in each of the cases, which is not one of the finest solution, provided it may take some time, onloading and offloading the dataset from the memory.Proposed Design Suggestion
Instead of using different functions and using similar variables in two different functions, It would be better to use this design, saving memory and time wasted in on loading and off loading data, (especially, reloading the entire dataset) to and from the memory.
@srjoglekar246 what do you think?