- Install conda.
- Create an environment
conda create --name virtual python=3.7
conda activate virtual
- Install dependencies
pip install numpy pandas matplotlib scikit-image
pip install opencv-python==3.4.11.41 opencv-contrib-python==3.4.11.41
conda install -c anaconda cudatoolkit==10.1 cudnn
pip install tensorflow-gpu scikit-learn
- Clone this repo:
git clone https://github.com/r444li/SYDE671-final_project-image_colorization.git
- Download dataset (~18GB).
- Download files of bounding boxes.
- Create 4 directories for training images and annotations, validating images and annotations
- Create 1 directory for checkpoints
- Update paths in file_paths.py
- Put all the images downloaded in the directory of training images
- Put all the files of bounding boxes downloaded in the direcotry of train annotations
- Run clean_images.py
- Set batch_size, epochs, img_size in Train_Full_ImageColorizationNetwork_reduced.py(Line 17-19)
- Run Train_Full_ImageColorizationNetwork_reduced.py
- Set batch_size, epochs, img_size in Train_Instance_ImageColorizationNetwork_reduced.py(Line 17-19)
- Run Train_Instance_ImageColorizationNetwork_reduced.py
- Before train fusion model, there must be at least one file of weights for each of full and instance models in the directory of checkpoints
- Choose one weights file for each of full and instance models in the directory of checkpoints.
- Update full_imagecolorization_weights and instance_imagecolorization_weights in file_paths.py
- Set epochs, img_size in fusion_train_reduced.py(Line 22-23)
- Run fusion_train_reduced.py
View the results of models
- Choose one weights file in the directory of checkpoints.
- Create 1 directory for outputs
- Update recent_weights and output_path in file_paths.py to the chosed file.
- Update train_generator and valid_generator in test.py(start at Line 30) to the definition in the training program of chosed model.
- Run test.py