def __init__(self): train_seed, val_seed, test_seed = 0, 1, 2 train = EmnistObjectDetectionDataset( n_examples=int(cfg.n_train), example_range=cfg.train_example_range, seed=train_seed) val = EmnistObjectDetectionDataset( n_examples=int(cfg.n_val), example_range=cfg.val_example_range, seed=val_seed) test = EmnistObjectDetectionDataset( n_examples=int(cfg.n_val), example_range=cfg.test_example_range, seed=test_seed) self.datasets = dict(train=train, val=val, test=test)
from dps.datasets import EmnistObjectDetectionDataset """ The main takeaway from this is that AffineGridWarper layers an axis (-1, 1) x (-1, 1) over the input image, with y increasing downward and x increasing rightward. """ n_examples = 10 image_shape = (28, 28, 3) crop_shape = (14, 14, 3) cfg.batch_size = 10 with tf.Session().as_default(): _train = EmnistObjectDetectionDataset( n_examples=n_examples, min_chars=2, max_chars=2, patch_shape=crop_shape[:2], characters=[0], max_overlap=1000, image_shape=image_shape[:2]).sample(n_examples) images = _train["image"] """ A = [a, b, tx], [c, d, ty] """ boxes = np.array([[.5, 0, .5, 0, .5, -.5]], dtype='f') A = boxes.reshape(2, 3) # top-left, bottom-right corners = np.array([[-1, -1, 1], [1, 1, 1]], dtype='f').T corners = A @ corners
config = yolo_rl.good_config.copy( prepare_func=prepare_func, patience=10000, render_step=100000, lr_schedule=1e-4, max_overlap=40, hooks=[], n_val=16, eval_step=1000, max_steps=100000, fixed_values=dict(), curriculum=[ dict(fixed_values=dict(obj=1), max_steps=10000), dict(obj_exploration=0.2,), dict(obj_exploration=0.1,), dict(obj_exploration=0.1, lr_schedule=1e-5), dict(obj_exploration=0.1, lr_schedule=1e-6), ], ) # Create the datasets if necessary. with config: train = EmnistObjectDetectionDataset(n_examples=int(config.n_train), shuffle=True, example_range=(0.0, 0.9)) val = EmnistObjectDetectionDataset(n_examples=int(config.n_val), shuffle=True, example_range=(0.9, 1.)) from dps.hyper import build_and_submit clify.wrap_function(build_and_submit)(config=config, distributions=distributions)