- DCGAN model implementation with fine-tuning.
- Image pre-processing and dataset creating scripts.
- CNN Classifier to test the generated images.
- Change the working directory to
DCGAN/DCGAN_to_train_on_source_data/
. - Install the dependencies with
requirements.txt
$ pip install -r requirements.txt
- Place the dataset in the
data/severstal_steel_defect/train/
(as done in the repo). - To train from the scratch:
$ python3 train.py --dataroot data/source_data/ --num_epochs 10 --batch_size 25 --lr 0.0001
One can define their arguments.
6. To continue training, place the saved model in the checkpoints
directory (or begin with the saved model from the last training session) and run:
$ python3 train.py --dataroot data/source_data/ --num_epochs 10 --batch_size 25 --lr 0.0001 --netG checkpoints/netG.pth --netD checkpoints/netD.pth
- After training one can test the images by generating images with the trained model.
- Change the working directory to
DCGAN/DCGAN_to_train_on_target_data_with_fine-tuning
- Place the image dataset for each class in the relevant directory.
(eg:
data/ifpt/with_defects
forwith defects
class) - To start training (or continue training), place the saved model in the
checkpoints
directory and run (arguments can be changed):
$ python3 train_transfer_learn_finetune_D_finetune_G.p --dataroot data/source_data/ --num_epochs 10 --batch_size 25 --lr 0.0001 --netG checkpoints/netG.pth --netD checkpoints/netD.pth
Fine-tuning and training on the target dataset should be done for both classes.
- Image splitting to create the source dataset from the original images.
- Resizing images for both source and target datasets.
- Renaming images to annotate the images to create an image dataset.
CNN Classifier to test the generated images after Fine-tuning and training on the target (IFPT) dataset. The classifier is first trained only on generated images and then tested on original images from the target dataset.