def postprocess(args): # whether to set all objects same color args.monochrome = bool(args.monochrome) args.dscale = handle_random_transform_args(args.dscale) # args.tscale = handle_random_transform_args(args.tscale) args.drot = handle_random_transform_args(args.drot) # args.trot = handle_random_transform_args(args.trot) # choose a valid room assert args.room in ['box', 'tdw', 'house'], args.room if args.drop is not None: drop_list = args.drop.split(',') assert all([d in MODEL_NAMES for d in drop_list]), \ "All drop object names must be elements of %s" % MODEL_NAMES args.drop = drop_list else: args.drop = MODEL_NAMES # if args.target is not None: # targ_list = args.target.split(',') # assert all([t in MODEL_NAMES for t in targ_list]), \ # "All target object names must be elements of %s" % MODEL_NAMES # args.target = targ_list # else: # args.target = MODEL_NAMES # if args.color is not None: # rgb = [float(c) for c in args.color.split(',')] # assert len(rgb) == 3, rgb # args.color = rgb return args
def postprocess(args): args.fupforce = handle_random_transform_args(args.fupforce) args.size_min = handle_random_transform_args(args.size_min) args.size_max = handle_random_transform_args(args.size_max) ## don't let background objects move args.no_moving_distractors = True return args
def postprocess(args): args.relation = [ r for r in Relation if r.name in args.relation.split(',') ] args.container = [ nm for nm in args.container.split(',') if nm in ALL_NAMES ] args.target = [nm for nm in args.target.split(',') if nm in ALL_NAMES] args.distractor = [ nm for nm in args.distractor.split(',') if nm in ALL_NAMES ] args.zscale = handle_random_transform_args(args.zscale) args.cscale = handle_random_transform_args(args.cscale) args.tscale = handle_random_transform_args(args.tscale) args.dscale = handle_random_transform_args(args.dscale) args.cposition = handle_random_transform_args(args.cposition) args.cposition["y"] = 0.0 args.tposition = handle_random_transform_args(args.tposition) args.trotation = handle_random_transform_args(args.trotation) args.tangle = handle_random_transform_args(args.tangle) args.camera_distance = handle_random_transform_args( args.camera_distance) return args
def postprocess(args): if args.toys: if args.probe is None: args.probe = ','.join(FULL_NAMES) if args.middle is None: args.middle = ','.join(FULL_NAMES) if args.target is None: args.tower = ','.join(FULL_NAMES) args.tower_cap = args.target # parent postprocess args = domino_postproc(args) # ramp height args.rheight = handle_random_transform_args(args.rheight) # whether to use a cap object on the tower if args.tower_cap is not None: cap_list = args.tower_cap.split(',') assert all([t in MODEL_NAMES for t in cap_list]), \ "All target object names must be elements of %s" % MODEL_NAMES args.tower_cap = cap_list else: args.tower_cap = [] return args
def postprocess(args): # parent postprocess args = tower_postproc(args) # ramp args.rheight = handle_random_transform_args(args.rheight) # num links args.num_middle_range = handle_random_transform_args(args.num_middle_range) # target args.target_link_range = handle_random_transform_args(args.target_link_range) # attachment args.ascale = handle_random_transform_args(args.ascale) args.amass = handle_random_transform_args(args.amass) if args.acolor is not None: args.acolor = [float(c) for c in args.acolor.split(',')] if args.attachment is not None: args.attachment = args.attachment.split(',') # base args.bscale = handle_random_transform_args(args.bscale) args.bmass = handle_random_transform_args(args.bmass) if args.bcolor is not None: args.bcolor = [float(c) for c in args.bcolor.split(',')] if args.base is not None: args.base = args.base.split(',') return args
def postprocess(args): args.fupforce = handle_random_transform_args(args.fupforce) args.ramp_scale = handle_random_transform_args(args.ramp_scale) ### ledge args.use_ledge = bool(args.use_ledge) if args.ledge is not None: targ_list = args.ledge.split(',') assert all([t in MODEL_NAMES for t in targ_list]), \ "All ledge object names must be elements of %s" % MODEL_NAMES args.ledge = targ_list else: args.ledge = MODEL_NAMES args.ledge_scale = handle_random_transform_args(args.ledge_scale) return args
def get_args(dataset_dir: str): """ Combine Drop-specific arguments with controller-common arguments """ common = get_parser(dataset_dir, get_help=False) parser = ArgumentParser(parents=[common]) parser.add_argument("--drop", type=str, default=None, help="comma-separated list of possible drop objects") parser.add_argument("--target", type=str, default=None, help="comma-separated list of possible target objects") parser.add_argument("--ymin", type=float, default=0.75, help="min height to drop object from") parser.add_argument("--ymax", type=float, default=1.25, help="max height to drop object from") parser.add_argument("--dscale", type=str, default="[0.2,0.3]", help="scale of drop objects") parser.add_argument("--tscale", type=str, default="[0.2,0.3]", help="scale of target objects") parser.add_argument( "--drot", type=str, default=None, help="comma separated list of initial drop rotation values") parser.add_argument( "--trot", type=str, default=None, help="comma separated list of initial target rotation values") parser.add_argument( "--jitter", type=float, default=0.2, help= "amount to jitter initial drop object horizontal position across trials" ) parser.add_argument( "--color", type=str, default=None, help= "comma-separated R,G,B values for the target object color. Defaults to random." ) parser.add_argument( "--camera_distance", type=float, default=1.25, help="radial distance from camera to drop/target object pair") parser.add_argument( "--camera_min_angle", type=float, default=0, help="minimum angle of camera rotation around centerpoint") parser.add_argument( "--camera_max_angle", type=float, default=0, help="maximum angle of camera rotation around centerpoint") parser.add_argument( "--camera_min_height", type=float, default=1. / 3, help="min height of camera as a fraction of drop height") parser.add_argument( "--camera_max_height", type=float, default=2. / 3, help="max height of camera as a fraction of drop height") args = parser.parse_args() # whether to set all objects same color args.monochrome = bool(args.monochrome) args.dscale = handle_random_transform_args(args.dscale) args.tscale = handle_random_transform_args(args.tscale) args.drot = handle_random_transform_args(args.drot) args.trot = handle_random_transform_args(args.trot) if args.drop is not None: drop_list = args.drop.split(',') assert all([d in MODEL_NAMES for d in drop_list]), \ "All drop object names must be elements of %s" % MODEL_NAMES args.drop = drop_list else: args.drop = MODEL_NAMES if args.target is not None: targ_list = args.target.split(',') assert all([t in MODEL_NAMES for t in targ_list]), \ "All target object names must be elements of %s" % MODEL_NAMES args.target = targ_list else: args.target = MODEL_NAMES if args.color is not None: rgb = [float(c) for c in args.color.split(',')] assert len(rgb) == 3, rgb args.color = rgb return args
def postprocess(args): args = domino_postproc(args) args.rheight = handle_random_transform_args(args.rheight) return args
def postprocess(args): args.fupforce = handle_random_transform_args(args.fupforce) return args