Upload 9 files
Browse files- options/__init__.py +1 -0
- options/__init__.pyc +0 -0
- options/__pycache__/__init__.cpython-310.pyc +0 -0
- options/__pycache__/base_options.cpython-310.pyc +0 -0
- options/__pycache__/test_options.cpython-310.pyc +0 -0
- options/base_options.py +59 -0
- options/base_options.pyc +0 -0
- options/test_options.py +11 -0
- options/test_options.pyc +0 -0
options/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
# options_init
|
options/__init__.pyc
ADDED
|
Binary file (167 Bytes). View file
|
|
|
options/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (154 Bytes). View file
|
|
|
options/__pycache__/base_options.cpython-310.pyc
ADDED
|
Binary file (3.09 kB). View file
|
|
|
options/__pycache__/test_options.cpython-310.pyc
ADDED
|
Binary file (853 Bytes). View file
|
|
|
options/base_options.py
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import argparse
|
| 2 |
+
import torch
|
| 3 |
+
|
| 4 |
+
class BaseOptions():
|
| 5 |
+
def __init__(self):
|
| 6 |
+
self.parser = argparse.ArgumentParser()
|
| 7 |
+
self.initialized = False
|
| 8 |
+
|
| 9 |
+
def initialize(self):
|
| 10 |
+
self.parser.add_argument('--name', type=str, default='demo', help='name of the experiment. It decides where to store samples and models')
|
| 11 |
+
self.parser.add_argument('--gpu_ids', type=str, default='0', help='gpu ids: e.g. 0 0,1,2, 0,2. use -1 for CPU')
|
| 12 |
+
self.parser.add_argument('--norm', type=str, default='instance', help='instance normalization or batch normalization')
|
| 13 |
+
self.parser.add_argument('--use_dropout', action='store_true', help='use dropout for the generator')
|
| 14 |
+
self.parser.add_argument('--data_type', default=32, type=int, choices=[8, 16, 32], help="Supported data type i.e. 8, 16, 32 bit")
|
| 15 |
+
self.parser.add_argument('--verbose', action='store_true', default=False, help='toggles verbose')
|
| 16 |
+
|
| 17 |
+
self.parser.add_argument('--batchSize', type=int, default=1, help='input batch size')
|
| 18 |
+
self.parser.add_argument('--loadSize', type=int, default=512, help='scale images to this size')
|
| 19 |
+
self.parser.add_argument('--fineSize', type=int, default=512, help='then crop to this size')
|
| 20 |
+
self.parser.add_argument('--input_nc', type=int, default=3, help='# of input image channels')
|
| 21 |
+
self.parser.add_argument('--output_nc', type=int, default=3, help='# of output image channels')
|
| 22 |
+
|
| 23 |
+
self.parser.add_argument('--dataroot', type=str,
|
| 24 |
+
default='dataset/')
|
| 25 |
+
self.parser.add_argument('--resize_or_crop', type=str, default='scale_width', help='scaling and cropping of images at load time [resize_and_crop|crop|scale_width|scale_width_and_crop]')
|
| 26 |
+
self.parser.add_argument('--serial_batches', action='store_true', help='if true, takes images in order to make batches, otherwise takes them randomly')
|
| 27 |
+
self.parser.add_argument('--no_flip', action='store_true', help='if specified, do not flip the images for data argumentation')
|
| 28 |
+
self.parser.add_argument('--nThreads', default=1, type=int, help='# threads for loading data')
|
| 29 |
+
self.parser.add_argument('--max_dataset_size', type=int, default=float("inf"), help='Maximum number of samples allowed per dataset. If the dataset directory contains more than max_dataset_size, only a subset is loaded.')
|
| 30 |
+
|
| 31 |
+
self.parser.add_argument('--display_winsize', type=int, default=512, help='display window size')
|
| 32 |
+
self.parser.add_argument('--tf_log', action='store_true', help='if specified, use tensorboard logging. Requires tensorflow installed')
|
| 33 |
+
|
| 34 |
+
self.initialized = True
|
| 35 |
+
|
| 36 |
+
def parse(self, save=True):
|
| 37 |
+
if not self.initialized:
|
| 38 |
+
self.initialize()
|
| 39 |
+
self.opt, unk = self.parser.parse_known_args()
|
| 40 |
+
self.opt.isTrain = self.isTrain # train or test
|
| 41 |
+
|
| 42 |
+
str_ids = self.opt.gpu_ids.split(',')
|
| 43 |
+
self.opt.gpu_ids = []
|
| 44 |
+
for str_id in str_ids:
|
| 45 |
+
id = int(str_id)
|
| 46 |
+
if id >= 0:
|
| 47 |
+
self.opt.gpu_ids.append(id)
|
| 48 |
+
|
| 49 |
+
if len(self.opt.gpu_ids) > 0:
|
| 50 |
+
torch.cuda.set_device(self.opt.gpu_ids[0])
|
| 51 |
+
|
| 52 |
+
args = vars(self.opt)
|
| 53 |
+
|
| 54 |
+
print('------------ Options -------------')
|
| 55 |
+
for k, v in sorted(args.items()):
|
| 56 |
+
print('%s: %s' % (str(k), str(v)))
|
| 57 |
+
print('-------------- End ----------------')
|
| 58 |
+
|
| 59 |
+
return self.opt
|
options/base_options.pyc
ADDED
|
Binary file (3.91 kB). View file
|
|
|
options/test_options.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .base_options import BaseOptions
|
| 2 |
+
|
| 3 |
+
class TestOptions(BaseOptions):
|
| 4 |
+
def initialize(self):
|
| 5 |
+
BaseOptions.initialize(self)
|
| 6 |
+
|
| 7 |
+
self.parser.add_argument('--warp_checkpoint', type=str, default='checkpoints/PFAFN/warp_model_final.pth', help='load the pretrained model from the specified location')
|
| 8 |
+
self.parser.add_argument('--gen_checkpoint', type=str, default='checkpoints/PFAFN/gen_model_final.pth', help='load the pretrained model from the specified location')
|
| 9 |
+
self.parser.add_argument('--phase', type=str, default='test', help='train, val, test, etc')
|
| 10 |
+
|
| 11 |
+
self.isTrain = False
|
options/test_options.pyc
ADDED
|
Binary file (1.12 kB). View file
|
|
|