Giter VIP home page Giter VIP logo

steganography-nn's Introduction

Steganography LSTM

Code for the paper Generating Steganographic Text with LSTMs. The LSTM is based on the Word Language Model example from PyTorch (http://pytorch.org/).

Requirements

Data

A small sample of Penn Treebank and Tweets. pre-process.py is tokenization of punctuation.

Training

python main.py --cuda --nhid 600 --nlayers 3 --epochs 6 --data './data/tweets' --save './models/twitter-model.pt' For the full list of arguments, check the PyTorch example README.

Text Generation

One of our key original contributions. After we train our model, we generate words and restrict the output based on the secret text. generate.py is modified such that it takes the secret text and modifies the probabilities based on the "bins" as described in our paper. If replication factor is bigger than 1, the encoding/decoding is non-deterministic.

Example generation with 4 bins: python generate.py --data './data/tweets' --checkpoint './models/twitter-model.pt' --cuda --words 1000 --temperature 0.8 --bins 8 --common_bin_factor 4 --num_tokens 20 --secret_file './demo/secret_file.txt' --outf './outputs/stegotext.txt' --replication_factor 3 --save_bins --save_corpus add --random if non existing './demo/secret_file.txt'

See the arguments in generate.py or refer to the PyTorch example README.

Stegotext decoding

Given that we know the seed that was used to generate to stegotext, we can decode it.

python decoder.py --data './data/tweets' --checkpoint './models/twitter-model.pt' --cuda --bins 8 --model_char_nn './tools/rnn_char/models/wiki.pt' --encoded_file './outputs/stegotext.txt' --replication_factor 3 --save_corpus --next_character 10 --save_bins --num_tokens 20 --common_bin_factor 4

See the arguments in decoder.py

Credits

This code is based on tbfang/steganography-lstm. The character-level rnn is based on Practical PyTorch: Generating Shakespeare with a Character-Level RNN

steganography-nn's People

Contributors

vincentballet avatar mariejeannel avatar

Watchers

 avatar paper2code - bot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.