This is a pytorch Implementation of image steganography using deep convolutional neural networks ,This repo contains the core code of the Image Model of the ICMR2019 paper:
High-Capacity Convolutional Video Steganography with Temporal Residual Modeling (ICMR2019, oral)
This repo mainly contains the code of Reference-frame-model, while the Residual-frame-model has the same structure, so you can use the code to achieve the similar result mentioned in the paper. Here are some video demo.
Steganography is the science of Hiding a message in another message. In this case, a Picture is hidden inside another picture using Deep convolutional neural networks.
You need to clone or download this repository first, Then the dependencies can be installed by using
pip install -r requirements.txt
If you just want to inference the model, you can type like this:
# because the filesize is limited to 100MB, so the model is separated into 2 file netH.tar.gz.1 and netH.tar.gz.2 in the checkPoint folder
cat ./checkPoint/netH.tar.gz* | tar -xzv -C ./checkPoint/
CUDA_VISIBLE_DEVICES=0 python main.py --test=./example_pics
You can also use your own image folder to replace the example_pics, just need to provide the correct path.
Otherwise if you need to train the model on your own dataset, you need to change the DATA_DIR path in the main.py, which is in the 35th line, both train and validation dataset need to be put into the folder.
35 DATA_DIR = '/n/liyz/data/deep-steganography-dataset/'
And then type like this:
CUDA_VISIBLE_DEVICES=0 python main.py
This task requires a lot of computing resources, our model is trained in 45000 iamges from ImageNet, and evaluated on 5000 pics. All images are resized to 256*256 without normalization. And this take us nearly 24 hours on one nvidia GTX 1080 ti.
The Framework takes in Two images. One is the cover image(the 1st row) and another is the secret image(the 3rd row) .
The goal is to 'hide' the secret image in the cover image Through a Hiding net such that only the cover image is visible. This is called container image(the 2nd row)
Then , this hidden image can be passed to a Revealing network, which can get the hidden image back, and this is called rev_secret img(the 4th row).
As you can see, it is visually very hard to find the difference between the cover image and the contianer image. Yet the Reveal network can get back the information of the secret image only with tiny deviation. (If you can not notice the tiny deviation, you can download the picture to zoom in)- deviation between cover and contianer
cover image | container image |
- deviation between secret and revealed secret
secret image | revealed secret image |
- Unlike the [1], we just used two nets to get the result, one Hiding net and one Revealing net.
- For the Hiding net, an Unet structred convolutional network was used to achive this goal. Cover image and secret image are concatenated into a 6 channels tensor as the input of the Hiding net.
- For Revealing net, there are 6 conv layers with 3*3 kernel size, and each layer is followed by a BN and ReLU except the last one. Contianer img produced by the Hiding net is used as the input of the Revealing net directly.
- For more details of the network architecture, you can just read the source code which is in the models folder
Two networks were trained with beta values 0.75), batch size of 32(16 covers and 16 secrets). The loss curves are shown below:
- Loss curves on Hiding net and Revealing net
MSE loss on cover and contianer | MSE loss on secret and revealed secret |
- Averaged pixel-wise discrepancy
Dataset | contianer - cover(APD) (0-255) | secret - rev_secret(APD) (0-255) |
---|---|---|
training | 4.20 | 4.73 |
validation | 4.16 | 4.40 |
[1] Baluja S. Hiding Images in Plain Sight: Deep Steganography[C]//Advances in Neural Information Processing Systems. 2017: 2066-2076.
Thanks for the help of @arnoweng during this project.
If this code is helpful for you, please cite our paper:
@inproceedings{weng2019high,
title={High-Capacity Convolutional Video Steganography with Temporal Residual Modeling},
author={Weng, Xinyu and Li, Yongzhi and Chi, Lu and Mu, Yadong},
booktitle={Proceedings of the 2019 on International Conference on Multimedia Retrieval},
pages={87--95},
year={2019}
}