from .base_options import BaseOptions class DatasetOptions(BaseOptions): def initialize(self, args=None): # BaseOptions.initialize(self) # type = int, float, str OR action='store_true' # self.parser.add_argument( # '--', # type=int, # default=0, # help='' # ) required = args is None self.parser.add_argument( '--in_dir', type=str, required=required, help='input directory' ) self.parser.add_argument( '--out_dir', type=str, required=required, help='output directory' ) self.parser.add_argument( '--split', action='store_true', help='construct train/test/split for this output, as A' ) self.parser.add_argument( '--ab', action='store_true', help='construct test split into directory A and B, where B = in_dir' ) self.parser.add_argument( '--mov', action='store_true', help='generate video from output directory' ) self.parser.add_argument( '--render-frames', action='store_true', help='render the source frames only' ) self.parser.add_argument( '--tag', type=str, default="", help='another way to tag this whole thing' ) self.parser.add_argument( '--scp', action='store_true', help='scp this file somewhere' ) self.parser.add_argument( '--scp-to', type=str, default="jules@asdf.us:asdf/neural/", help='scp destination' ) ## LIVE IMAGE PROCESSING self.parser.add_argument( '--send-image', type=str, default='b', help='which image to send... a, b, recursive, sequence' ) self.parser.add_argument( '--store-a', action='store_true', help='dont remove the generated A image after processing it' ) self.parser.add_argument( '--store-b', action='store_true', help='after generating a B image, save it to disk' ) self.parser.add_argument( '--exit', action='store_true', help='exit immediately if set to true (used to interrupt)' ) ## LOAD A NEW SEQUENCE self.parser.add_argument( '--load-sequence', action='store_true', help='instruction to reload the sequence after training the next image' ) self.parser.add_argument( '--sequence-name', type=str, default='woodscaled_4', help='which sequence to load' ) self.parser.add_argument( '--sequence-offset', type=int, default=0, help='initial offset into sequence' ) ## LOAD A NEW CHECKPOINT self.parser.add_argument( '--load-checkpoint', action='store_true', help='instruction to reload the checkpoint after training the next image' ) self.parser.add_argument( '--checkpoint-name', type=str, default='messi', help='which checkpoint to load' ) self.parser.add_argument( '--epoch', type=str, default='latest', help='which epoch to load' ) ## IMAGE FILTERS ### RECURSION self.parser.add_argument( '--processing', action='store_true', help='internally stores whether or not we should be processing..' ) self.parser.add_argument( '--pause', action='store_true', help='internally tells the loop to pause..' ) self.parser.add_argument( '--transition', action='store_true', help=' sine wave transition' ) self.parser.add_argument( '--transition-period', default=3000, type=int, help='period of sine wave transition' ) self.parser.add_argument( '--transition-min', default=1e-3, type=float, help='minimum amount of stabilization to apply' ) self.parser.add_argument( '--transition-max', default=1.0, type=float, help='maximum amount of stabilization to apply' ) self.parser.add_argument( '--recursive', action='store_true', help='recurse on previous output' ) self.parser.add_argument( '--recursive-frac', default=0.3, type=float, help='amount of previous step to use in recursion' ) self.parser.add_argument( '--just-copy', action='store_true', help='dont preprocess first frame', ) self.parser.add_argument( '--sequence', action='store_true', help='recurse guided by image sequence' ) self.parser.add_argument( '--sequence-frac', default=0.2, type=float, help='amount of sequence image to use in recursion' ) self.parser.add_argument( '--recurse-roll', default=0, type=int, help='in px, roll mixed recursed image 1px to reduce vertical feedback' ) self.parser.add_argument( '--recurse-roll-axis', default=1, type=int, help='axis of roll' ) self.parser.add_argument( '--process-frac', default=0.5, type=float, help='amount of processed image (clahe, poster, etc) to use in feeder step' ) ### GRAYSCALE self.parser.add_argument( '--grayscale', action='store_true', help='convert image to grayscale first' ) ### CLAHE self.parser.add_argument( '--clahe', action='store_true', help='apply clahe contrast correction' ) self.parser.add_argument( '--clip-limit', default=2.0, type=float, help='clip limit for clahe algorithm (1.0 is subtle, 4.0 is aggressive)' ) ### POSTERIZE self.parser.add_argument( '--posterize', action='store_true', help='posterize image' ) self.parser.add_argument( '--spatial-window', default=16, type=int, help='spatial window for quantize' ) self.parser.add_argument( '--color-window', default=64, type=int, help='color window for quantize' ) ### BRIGHTNESS GRADIENT self.parser.add_argument( '--brightness-gradient', action='store_true', help='gradiate from first frame to last (done in Lab colorspace)' ) self.parser.add_argument( '--brightness-sigma', default=64, type=int, help='width of brightness gradient along L axis' ) ### BLUR self.parser.add_argument( '--blur', action='store_true', help='blur image by N' ) self.parser.add_argument( '--blur-radius', default=3, type=int, help='blur sigma' ) self.parser.add_argument( '--blur-sigma', default=0.0, type=float, help='blur sigma' ) ### CANNY EDGE DETECTION self.parser.add_argument( '--canny', action='store_true', help='do canny edge detection on image' ) self.parser.add_argument( '--canny-lo', default=100, type=int, help='canny low threshold' ) self.parser.add_argument( '--canny-hi', default=200, type=int, help='canny high threshold' ) def parse(self, args=None): if not self.initialized: self.initialize(args) if args is not None: self.opt, unknown = self.parser.parse_known_args(args) else: self.opt, unknown = self.parser.parse_known_args() argz = vars(self.opt) print('------------ Options -------------') for k, v in sorted(argz.items()): print('%s: %s' % (str(k), str(v))) print('-------------- End ----------------') return self.opt