Skip to content

Commit

Permalink
also save the filters to a file, for reuse (todo: make this optional,…
Browse files Browse the repository at this point in the history
… or superceded)
  • Loading branch information
treelinelabs committed Mar 26, 2011
1 parent 88abf3d commit 91a2b65
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions train_autoencoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,13 @@ def train(training_data,
image_filename = os.path.join(output_directory, "filters_{i}.png".format(i=image_index))
filters_image.save(image_filename)

# dump the filters to a file, for re-use
filters_dict = {"encoder": encoder.filters.get_value(),
"decoder": decoder.filters.get_value()}
saved_filters_filename = os.path.join(output_directory, "saved_filters_{i}.pkl".format(i=image_index))
with open(saved_filters_filename, "wb") as saved_filters_file:
pickle.dump(filters_dict, saved_filters_file, protocol=pickle.HIGHEST_PROTOCOL)

encoded_code, encoded_locations = encode(image)

# copy the actual code to the optimal code, to be optimized
Expand Down

0 comments on commit 91a2b65

Please sign in to comment.