Giter VIP home page Giter VIP logo

rivagan's Introduction

“DAI-Lab” An open source project from Data to AI Lab at MIT.

Travis CI Shield

RivaGAN

Robust Video Watermarking with Attention

Overview

The goal of video watermarking is to embed a message within a video file in a way such that it minimally impacts the viewing experience but can be recovered even if the video is redistributed and modified, allowing media producers to assert ownership over their content.

RivaGAN implements a novel architecture for robust video watermarking which features a custom attention-based mechanism for embedding arbitrary data as well as two independent adversarial networks which critique the video quality and optimize for robustness.

Using this technique, we are able to achieve state-of-the-art results in deep learning-based video watermarking and produce watermarked videos which have minimal visual distortion and are robust against common video processing operations.

Install

Requirements

RivaGAN has been developed and tested on Python3.4, 3.5, 3.6 and 3.7

Also, although it is not strictly required, the usage of a virtualenv is highly recommended in order to avoid interfering with other software installed in the system in which RivaGAN is run.

These are the minimum commands needed to create a virtualenv using python3.6 for RivaGAN:

pip install virtualenv
virtualenv -p $(which python3.6) RivaGAN-venv

Afterwards, you have to execute this command to activate the virtualenv:

source RivaGAN-venv/bin/activate

Remember to execute it every time you start a new console to work on RivaGAN!

Install from source

With your virtualenv activated, you can clone the repository and install it from source by running make install on the stable branch:

git clone [email protected]:DAI-Lab/RivaGAN.git
cd RivaGAN
git checkout stable
make install

Install for Development

If you want to contribute to the project, a few more steps are required to make the project ready for development.

Please head to the Contributing Guide for more details about this process.

Quickstart

In this short tutorial we will guide you through a series of steps that will help you getting started training your own instance of RivaGAN.

Download the training data

Start by running the following commands to automatically download the Hollywood2 and Moments in Time datasets. Depending on the speed of your internet connection, this may take up to an hour.

cd data
bash download.sh

Train a model

Now you're ready to train a model.

Make sure to having activated your virtualenv and installed the project, and then execute the following python commands:

from rivagan import RivaGAN

model = RivaGAN()
model.fit("data/hollywood2", epochs=300)
model.save("/path/to/model.pt")

Make sure to replace the /path/to/model.pt string with an appropiate save path.

Encode data in a video

You can now load the trained model and use it as follows:

data = tuple([0] * 32)
model = RivaGAN.load("/path/to/model.pt")
model.encode("/path/to/video.avi", data, "/path/to/output.avi")

Decode data from the video

After the data is encoded in the video, it can be recovered as follows:

recovered_data = model.decode("/path/to/output.avi"):

Citing RivaGAN

If you use RivaGAN for your research, please consider citing the following work:

Zhang, Kevin Alex and Xu, Lei and Cuesta-Infante, Alfredo and Veeramachaneni, Kalyan. Robust Invisible Video Watermarking with Attention. MIT EECS, September 2019. (PDF)

@article{zhang2019robust,
    author={Kevin Alex Zhang and Lei Xu and Alfredo Cuesta-Infante and Kalyan Veeramachaneni},
    title={Robust Invisible Video Watermarking with Attention},
    year={2019},
    eprint={1909.01285},
    archivePrefix={arXiv},
    primaryClass={cs.MM}
}

What's next?

For more details about RivaGAN and all its possibilities and features, please check the documentation site.

rivagan's People

Contributors

csala avatar k15z avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rivagan's Issues

Poor performance

  • Python version: 3.9
  • Operating System: Linux

Description

from rivagan import RivaGAN

model = RivaGAN()
model.fit('./data/hollywood2', epochs=300, batch_size=12, use_critic=True, use_adversary=True)
model.save('./checkpoints/model.pt')

When I use this script for training, I get a few warnings as follows,

[mp3float @ 0xe49f1240] Header missing
[mp3float @ 0xe49f1240] Header missing
[mp3float @ 0xe4c01e00] Header missing

I don't know if this affects the model.
My model accuracy has been stuck at about 54%.

What I use is Hollywood2 dataset and it has been processed for successful loading.

Has anyone else experienced the same problem, or has anyone reproduced the results of the paper.

resource file download faile

the file script download.sh ,the path is not avaliable ftp://ftp.irisa.fr/local/vistas/actions/Hollywood2-actions.tar.gz ,where can get the resource

No Data folder in the root

  • RivaGAN version: Latest
  • Python version: 3.6
  • Operating System: Windows

Description

Data folder is missing in root.

What I Did

//downloaded instead of git clone... 

Bad Accuracy

  • RivaGAN version:
  • Python version: 3.6
  • Operating System: Ubuntu18.04

Hi, I trained the model with hollywood2 according to the guideline. But I only get an accuracy of 74% when there is no modification. Did I miss anything? Thank you!

Li

Video output becomes blue after encoding watermark

  • RivaGAN version: Created My Own Version with few modifications
  • Python version: 3.8
  • Operating System: Windows 10

Description

I was trying to encode watermark into video, Video output generates with a blue layer. Is there any solution or guide to resolve this?

Thanks

how to extract the data from the watermarked video ?

  • RivaGAN version:
  • Python version:
  • Operating System:

Description

The extracted watermark information is a string of numbers of type Float32
How to check whether the extracted watermark is correct
part of outputs are like this

What I Did

[array([-0.22932515, -0.05714366, -1.2726792 , -0.05257967, -0.10511999,
       -4.496194  , -0.72906655, -7.0054197 ,  1.2017044 , -0.07988264,
       -0.554625  , -0.38207918, -0.37821755, -0.23825747, -0.06544079,
       -0.18358664, -1.1621505 , -0.04027031, -1.3203971 , -0.04445288,
       -0.02693273, -0.04580238, -0.09852732, -0.7537201 , -0.8482291 ,
       -0.05759114, -0.9152253 , -0.15124811, -0.69108665, -1.4571815 ,
       -0.08187085, -0.03920848], dtype=float32), array([-0.2196667 , -0.0540536 , -1.5967504 , -0.04509218, -0.10601447,
       -3.8246827 , -0.8229772 , -7.316689  ,  1.1962031 , -0.07542385,
       -0.47025478, -0.42007202,  0.04247466, -0.1553794 , -0.05957376,
       -0.12692125, -0.99911606, -0.01197424, -1.931857  , -0.04010678,
       -0.0247244 , -0.04174514, -0.09097901, -1.3404232 , -0.8031849 ,
       -0.05421488, -0.9168243 , -0.16437075, -0.63380903, -1.4590236 ,
       -0.07584139, -0.0354542 ], dtype=float32), array([-0.21605897, -0.05655681, -1.5917764 , -0.04962874, -0.10279732,
       -3.9548905 , -0.85447276, -6.641722  ,  1.4988332 , -0.07171236,
       -0.58976734, -0.4822218 , -0.5583661 , -0.44414252, -0.06283236,
       -0.04334006, -0.9056364 , -0.02996331, -1.5311664 , -0.03888033,
       -0.02365516, -0.04321809, -0.08855483, -1.3248276 , -0.70889914,
       -0.0529329 , -0.914947  , -0.02763503, -0.58799237, -1.4167793 ,
       -0.07745175, -0.03598158], dtype=float32), array([-0.21729237, -0.06073643, -1.7749408 , -0.05128128, -0.10150994,
       -3.647244  , -0.9945726 , -6.587243  ,  1.1882725 , -0.07274818,
       -0.70474637, -0.2876239 , -0.6520075 , -0.2658491 , -0.06356473,
       -0.10729884, -0.8362877 , -0.02482117, -1.4181769 , -0.03995933,
       -0.02395962, -0.04428652, -0.09166634, -1.2472842 , -0.91013485,
       -0.05398247, -0.73910624, -0.01726682, -0.67850876, -1.2625008 ,
       -0.07508389, -0.03764728], dtype=float32), array([-0.21252002, -0.05803272, -2.0322752 , -0.05201769, -0.10255759,
       -3.801908  , -0.960667  , -5.9786286 ,  1.2340491 , -0.06969828,
       -0.7945951 , -0.36546695, -1.2804725 , -0.16977169, -0.06502119,
        0.04623017, -0.78163105, -0.01119128, -1.1249161 , -0.0384632 ,
       -0.02465068, -0.04448389, -0.08820156, -1.0601249 , -0.8741142 ,
       -0.05270627, -0.7521928 ,  0.03751253, -0.57171124, -1.1868995 ,
       -0.07276401, -0.03677569], dtype=float32), array([-0.22099555, -0.06090005, -1.6498708 , -0.05538905, -0.10977125,
       -3.8797262 , -0.68402606, -6.6135855 ,  1.1882415 , -0.07178833,
       -0.7655401 , -0.5266853 , -0.8798227 , -0.19440982, -0.06883975,
        0.03872593, -0.6610789 , -0.03265392, -1.6900032 , -0.0410734 ,
       -0.02811369, -0.04813316, -0.09063462, -1.3307556 , -0.58502895,
       -0.05466864, -0.6534804 , -0.21974505, -0.72906893, -1.1342072 ,
       -0.07908204, -0.03858798], dtype=float32), array([-0.2232397 , -0.05757632, -1.4883542 , -0.04831245, -0.10195197,
       -4.181132  , -0.581693  , -6.6753025 ,  1.3174125 , -0.06622721,
       -0.693849  , -0.54539883, -0.6668897 , -0.18836862, -0.06199639,
       -0.03910651, -0.8918489 , -0.02746316, -1.9715004 , -0.03671256,
       -0.02696823, -0.04149688, -0.08421695, -1.5544248 , -0.54859847,
       -0.05067875, -0.60275084, -0.08506186, -0.6193348 , -1.1903898 ,
       -0.07435871, -0.03601457], dtype=float32),

0it [00:00,? It /s] metric is "NaN"

  • RivaGAN version:
  • Python version:
  • Operating System:

Description

Hello, I would like to ask you how to set my training set. I put avi videos in the directory "data/Hollywood2", but when I was training, all the prompt "0it [00:00,? It /s]" appeared, and the value of each metric was NaN. How can I solve this problem?

What I Did

Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.

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.