summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2019-12-18 23:52:41 +0100
committerJules Laplace <julescarbon@gmail.com>2019-12-18 23:52:41 +0100
commit20b9de678860a20ba7eae69b2b7843456fc08e32 (patch)
tree123a83316d12a478f01f8bca155f41fd80e331ec
parent937c7d6431d6a990b959aabb5fb2e65824fcd4c0 (diff)
self opts
-rw-r--r--inversion/live.py20
1 files changed, 9 insertions, 11 deletions
diff --git a/inversion/live.py b/inversion/live.py
index 0fdad7c..3ca7717 100644
--- a/inversion/live.py
+++ b/inversion/live.py
@@ -13,7 +13,6 @@ tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../live-cortex/rpc/'))
from rpc import CortexRPC
-from listener import Listener
from params import Params
params = Params('params_dense.json')
@@ -85,22 +84,21 @@ class InterpolatorParam:
class Interpolator:
def __init__(self):
- self.opts = {}
- self.t = time.time()
-
- def build(self):
- opts = {
+ self.opts = {
'global': {
'time': InterpolatorParam(name='t', value=time.time())
},
}
- lerp_z = lerp(opts, 'latent', [BATCH_SIZE, Z_DIM])
- sin_z = sin(opts, 'sin_z', [BATCH_SIZE, Z_DIM])
- lerp_label = lerp(opts, 'label', [BATCH_SIZE, N_CLASS])
- opts['threshold'] = InterpolatorParam('threshold', value=1.0)
+ self.t = time.time()
+
+ def build(self):
+ lerp_z = lerp(self.opts, 'latent', [BATCH_SIZE, Z_DIM])
+ sin_z = sin(self.opts, 'sin_z', [BATCH_SIZE, Z_DIM])
+ lerp_label = lerp(self.opts, 'label', [BATCH_SIZE, N_CLASS])
+ self.opts['threshold'] = InterpolatorParam('threshold', value=1.0)
gen_in = {}
- gen_in['threshold'] = opts['threshold'].variable
+ gen_in['threshold'] = self.opts['threshold'].variable
gen_in['z'] = lerp_z + sin_z
gen_in['y'] = lerp_label
gen_img = generator(gen_in, signature=gen_signature)