Example #1
0
                                      latent_size,
                                      kl_scale=10.,
                                      opt=opt)
    vae.summary()
    encoder.summary()
    decoder.summary()

    start_nodes([
        #RandomNode(12399, shape=[2]),
        #CameraNode(12400, resize=32),
        #CameraNode(12400, fovea_url="12399", fovea_size=1./4, resize=input_shape[0]),
        CameraNode(12400, resize=input_shape[0]),
        #CameraNode(12400, fovea_url="12399", fovea_size=1./2, resize=input_shape[0]),
        #ImshowNode(12401, input_url="12400", title="source"),
        GaussianLerp(12402, shape=[latent_size], steps=10),
        VAENode(12403,
                vae,
                encoder,
                decoder,
                input_url="12400",
                generator_url="12402").set_niceness(0.5),
        #PrintNode(12404, input_url="12403/train_loss", prefix="train loss"),
        #ImshowNode(12405, input_url="12403/reconstruction", title="reconstruction"),
        #ImshowNode(12406, input_url="12403/generator", title="generation"),
        GraphNode(12407,
                  input_url="12403/train_loss",
                  size=1000,
                  title="train_loss"),
        TemporalHistogram(12408, input_url="12403/encoder", title="histogram")
    ])
Example #2
0
  return " ".join(args)

if __name__ == '__main__':
  import argparse
  from aegis_core.utils import start_nodes

  parser = argparse.ArgumentParser()
  parser.add_argument("--port", "-p", type=int)
  parser.add_argument("--device", "-d", type=int, default=0)
  parser.add_argument("--fovea-url", "-f", type=str, default=None)
  parser.add_argument("--fovea-size", "-F", type=float, default=1./4)
  parser.add_argument("--resize", "-r", type=int, default=None) #TODO: support 2d resize
  parser.add_argument("--color", "-c", type=str, default="rgb")
  parser.add_argument("--color-scale", "-s", type=float, default=1./255)

  parser.add_argument("--niceness", "-N", type=float, default=1.)
  parser.add_argument("--delay", "-D", type=float, default=1./100)

  args = parser.parse_args()

  node = CameraNode(
    port=args.port,
    device=args.device,
    fovea_url=args.fovea_url,
    fovea_size=args.fovea_size,
    resize=args.resize,
    color=args.color,
  ).set_niceness(args.niceness).set_delay(args.delay)

  start_nodes([node])
Example #3
0
    vae, encoder, decoder = build_vae(encoder, decoder, input_shape,
                                      latent_size)
    vae.summary()
    encoder.summary()
    decoder.summary()

    start_nodes([
        #RandomNode(12399, shape=[2]),
        #CameraNode(12400, resize=32),
        #CameraNode(12400, fovea_url="12399", fovea_size=1./4, resize=32),
        KerasDataset(12400, dataset="mnist", steps=10),
        ImshowNode(12401, input_url="12400", title="source"),
        GaussianLerp(12402, shape=[latent_size], steps=10),
        VAENode(12403,
                vae,
                encoder,
                decoder,
                input_url="12400",
                generator_url="12402"),
        PrintNode(12404, input_url="12403/train_loss", prefix="train loss"),
        ImshowNode(12405,
                   input_url="12403/reconstruction",
                   title="reconstruction"),
        ImshowNode(12406, input_url="12403/generator", title="generation"),
        GraphNode(12407,
                  input_url="12403/train_loss",
                  size=1000,
                  title="train_loss")
    ])
Example #4
0
from aegis_core.camera_node import CameraNode
from aegis_core.imshow_node import ImshowNode
from aegis_core.utils import start_node, start_nodes

start_nodes([
  CameraNode(12400, resize=64),
  ImshowNode(12401, input_url="12400")
])
Example #5
0
from aegis_core.utils import start_nodes, build_vae
from aegis_core.vae import VAENode

input_shape = [28, 28, 1]
latent_size = 2
acti = "tanh"

encoder = Sequential([
    Flatten(input_shape=input_shape),
    Dense(64, activation=acti),
    Dense(32, activation=acti),
])

decoder = Sequential([
    Dense(32, input_shape=[latent_size], activation=acti),
    Dense(64, activation=acti),
    Dense(np.prod(input_shape), activation="sigmoid"),
    Reshape(input_shape)
])

vae, encoder, decoder = build_vae(encoder, decoder, input_shape, latent_size)
vae.summary()
encoder.summary()
decoder.summary()

start_nodes([
    KerasDataset(12400, dataset="mnist", steps=100),
    VAENode(12401, vae, encoder, decoder, input_url="12400").set_niceness(0),
    PrintNode(12402, input_url="12401/train_loss")
])