forked from dribnet/plat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.py
executable file
·49 lines (40 loc) · 1.36 KB
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
### This is a documented example of a model interface compatible with plat.
class ExampleModel:
def __init__(self, filename=None, model=None):
"""
Initializate class give either a filename or a model
Usually this method will load a model from disk and store internally,
but model can also be provided directly instead (useful when training)
"""
pass
def encode_images(self, images):
"""
Encode images x => z
images is an n x 3 x s x s numpy array where:
n = number of images
3 = R G B channels
s = size of image (eg: 64, 128, etc)
pixels values for each channel are encoded [0,1]
returns an n x z numpy array where:
n = len(images)
z = dimension of latent space
"""
pass
def get_zdim(self):
"""
Returns the integer dimension of the latent z space
"""
pass
def sample_at(self, z):
"""
Decode images z => x
z is an n x z numpy array where:
n = len(images)
z = dimension of latent space
return images as an n x 3 x s x s numpy array where:
n = number of images
3 = R G B channels
s = size of image (eg: 64, 128, etc)
pixels values for each channel are encoded [0,1]
"""
pass