Skip to content

Commit

Permalink
Re-enabled the patch-variety code, trying to get good results on 1024…
Browse files Browse the repository at this point in the history
…x1024 textures.
  • Loading branch information
alexjc committed Apr 24, 2016
1 parent 9808696 commit d6c5a10
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions doodle.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ def prepare_optimization(self):
nn_layers = [self.model.network['nn'+l] for l in self.style_layers]
self.matcher_outputs = dict(zip(self.style_layers, lasagne.layers.get_output(nn_layers, self.matcher_inputs)))

self.compute_matches = {l: theano.function([self.matcher_tensors[l]], # self.matcher_history[l]],
self.compute_matches = {l: theano.function([self.matcher_tensors[l], self.matcher_history[l]],
self.do_match_patches(l)) for l in self.style_layers}

self.tensor_matches = [T.tensor4() for l in self.style_layers]
Expand All @@ -374,8 +374,8 @@ def do_match_patches(self, layer):
dist = self.matcher_outputs[layer]
dist = dist.reshape((dist.shape[1], -1))

# offset = self.matcher_history[layer].reshape((-1, 1))
scores = dist # (dist - offset * args.variety)
offset = self.matcher_history[layer].reshape((-1, 1))
scores = (dist - offset * args.variety)
matches = scores.argmax(axis=0)

# Pick the best style patches for each patch in the current image, the result is an array of indices.
Expand Down Expand Up @@ -481,7 +481,7 @@ def evaluate(self, Xn):
if semantic_weight: weights[:,-3:] /= (bs * semantic_weight)
layer.W.set_value(weights)

cur_idx, cur_val, cur_match = self.compute_matches[l](f) #, history[idx])
cur_idx, cur_val, cur_match = self.compute_matches[l](f, history[idx])
if best_idx is None:
best_idx = cur_idx
best_val = cur_val
Expand Down

0 comments on commit d6c5a10

Please sign in to comment.