Esempio n. 1
0
import matchmmd
from gen_deepart import read_lfw_attributes,attr_pairs
from gen_deepart import deepart_reconstruct

## Read P, Q, X, weights and layers

colorization=False
attr=10
source_k=2000
target_k=2000
test_indices=sorted([6005, 3659, 8499, 12217, 9982, 4322, 10449, 10969, 4245, 7028])
test_indices=[0,176]
_,_,lfwattr=read_lfw_attributes()
if attr>=0:
  target_indices,source_indices=attr_pairs(lfwattr,attr,target_k,source_k)
else:
  source_indices,target_indices=attr_pairs(lfwattr,-attr,source_k,target_k)

if colorization:
  source_indices=list(numpy.random.choice(range(len(lfwattr)),source_k,replace=False))
  target_indices=list(numpy.random.choice(range(len(lfwattr)),target_k,replace=False))

P=sorted(source_indices) # list of indices (source distribution)
Q=sorted(target_indices) # list of indices (target distribution)
X=test_indices   # list of indices (test images)
weights=[8e-8,4e-8,2e-8,1e-8]

## Form F (first N rows are P, next M rows are Q, last row is x)

prefix='data'
Esempio n. 2
0
mu=data['mu']
shape=data['shape'].item()
del data
print 'U',U.shape,U.dtype,U.min(),U.max()
print 'T',T.shape,T.dtype,T.min(),T.max()
print 'mu',mu.shape,mu.dtype,mu.min(),mu.max()

## Read attributes

from gen_deepart import read_lfw_attributes
from gen_deepart import attr_pairs

_,_,lfwattr=read_lfw_attributes()
# 8 is Youth
# 10 is Senior
target_indices,source_indices=attr_pairs(lfwattr,10,2000,2000)
print 'source',source_indices[:5]
print 'target',target_indices[:5]

weights=[5e-6]
test_indices=[0,1]
print 'feat_img[:5]',T[0,:5]
#P=T[source_indices].astype(np.float64)
#Q=T[target_indices].astype(np.float64)
P=T[source_indices]
Q=T[target_indices]
print 'P',P.shape,P.dtype
print 'Q',Q.shape,Q.dtype

## Match distributions