Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
ECCV2020_Dynamic/e2_main.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
48 lines (37 sloc)
2.67 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse, os | |
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '1' | |
from e2_model import model | |
parser = argparse.ArgumentParser(description='') | |
parser.add_argument('--phase', dest='phase', default='test', help='train or test') | |
parser.add_argument('--patches', dest='num_patch', type=int, default=4, help='number of patches extracted from an image') | |
parser.add_argument('--patchsize', dest='patch_sz', type=int, default=64, help='patch size, height/width of frames in each burst') | |
parser.add_argument('--burstsize', dest='burst_sz', type=int, default=8, help='burst size, number of frames in each burst') | |
parser.add_argument('--batchsize', dest='batch_sz', type=int, default=4, help='batch size, number of bursts in each batch') | |
parser.add_argument('--epochs', dest='epochs', type=int, default=200, help='number of epoch') | |
parser.add_argument('--lr', dest='lr', type=float, default=0.001, help='learning rate') | |
parser.add_argument('--jit', dest='jit', type=int, default=2, help='jit') | |
parser.add_argument('--J', dest='J', type=int, default=2, help='downsample ratio J') | |
parser.add_argument('--alpha', dest='alpha', type=float, default=4.0, help='alpha') | |
parser.add_argument('--ckpt_dir', dest='ckpt_dir', default='./e2_ckpt', help='the directory that models are saved') | |
parser.add_argument('--train_dir', dest='train_dir', default='./Datasets/VOC2008/train', help='the directory that training images are saved') | |
parser.add_argument('--valid_dir', dest='valid_dir', default='./Datasets/VOC2008/val', help='the directory that validation images are saved') | |
parser.add_argument('--test_dir', dest='test_dir', default='./Datasets/VOC2008/test', help='the directory that test images are saved') | |
parser.add_argument('--output_dir', dest='output_dir', default='./Results/VOC2008/e2_out', help='the directory to save processed test images') | |
parser.add_argument('--ckpt_file', dest='ckpt_file', default='model.h5', help='the file that models are saved') | |
parser.add_argument('--shift_ckpt', dest='shift_ckpt', default='./shift_ckpt/model.h5', help='the file of shift model') | |
parser.add_argument('--noisy_ckpt', dest='noisy_ckpt', default='./noisy_ckpt/model.h5', help='the file of noisy model') | |
parser.add_argument('--seed', dest='seed', type=int, default=42, help='random seed number') | |
args = parser.parse_args() | |
#70 | |
def main(): | |
if not os.path.exists(args.ckpt_dir): | |
os.makedirs(args.ckpt_dir) | |
model_ = model(args) | |
if args.phase == 'train': | |
model_.train() | |
else: | |
if not os.path.exists(args.output_dir): | |
os.makedirs(args.output_dir) | |
model_.test() | |
if __name__ == "__main__": | |
main() |