{"id":17154785,"url":"https://github.com/tancik/stegastamp","last_synced_at":"2025-04-13T00:41:40.360Z","repository":{"id":49749360,"uuid":"180217102","full_name":"tancik/StegaStamp","owner":"tancik","description":"Invisible Hyperlinks in Physical Photographs","archived":false,"fork":false,"pushed_at":"2023-12-08T01:32:09.000Z","size":204,"stargazers_count":737,"open_issues_count":31,"forks_count":198,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-04-04T03:09:17.030Z","etag":null,"topics":["barcode","qrcode","steganography","tensorflow","watermark"],"latest_commit_sha":null,"homepage":"http://www.matthewtancik.com/stegastamp","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tancik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-04-08T19:17:34.000Z","updated_at":"2025-03-29T13:44:44.000Z","dependencies_parsed_at":"2024-01-17T17:57:27.397Z","dependency_job_id":null,"html_url":"https://github.com/tancik/StegaStamp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tancik%2FStegaStamp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tancik%2FStegaStamp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tancik%2FStegaStamp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tancik%2FStegaStamp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tancik","download_url":"https://codeload.github.com/tancik/StegaStamp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650416,"owners_count":21139672,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["barcode","qrcode","steganography","tensorflow","watermark"],"created_at":"2024-10-14T21:49:58.468Z","updated_at":"2025-04-13T00:41:40.327Z","avatar_url":"https://github.com/tancik.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## StegaStamp: Invisible Hyperlinks in Physical Photographs [[Project Page]](http://www.matthewtancik.com/stegastamp)\n\n### CVPR 2020\n**[Matthew Tancik](https://www.matthewtancik.com), [Ben Mildenhall](http://people.eecs.berkeley.edu/~bmild/), [Ren Ng](https://scholar.google.com/citations?hl=en\u0026user=6H0mhLUAAAAJ)**\n*University of California, Berkeley*\n\n![](https://github.com/tancik/StegaStamp/blob/master/docs/teaser.png)\n\n\n## Introduction\nThis repository is a code release for the ArXiv report found [here](https://arxiv.org/abs/1904.05343). The project explores hiding data in images while maintaining perceptual similarity. Our contribution is the ability to extract the data after the encoded image (StegaStamp) has been printed and photographed with a camera (these steps introduce image corruptions). This repository contains the code and pretrained models to replicate the results shown in the paper. Additionally, the repository contains the code necessary to train the encoder and decoder models.\n\n## Citation\nIf you find our work useful, please consider citing:\n```\n    @inproceedings{2019stegastamp,\n        title={StegaStamp: Invisible Hyperlinks in Physical Photographs},\n        author={Tancik, Matthew and Mildenhall, Ben and Ng, Ren},\n        booktitle={IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},\n        year={2020}\n    }\n```\n\n## Installation\n- Clone repo and install submodules\n```bash=\ngit clone --recurse-submodules https://github.com/tancik/StegaStamp.git\ncd StegaStamp\n```\n- Install tensorflow (tested with tf 1.13)\n- Python 3 required\n- Download dependencies\n```bash=\npip install -r requirements.txt\n```\n\n## Training\n### Encoder / Decoder\n- Set dataset path in train.py\n```\nTRAIN_PATH = DIR_OF_DATASET_IMAGES\n```\n\n- Train model\n```bash=\nbash scripts/base.sh EXP_NAME\n```\nThe training is performed in `train.py`. There are a number of hyperparameters, many corresponding to the augmentation parameters. `scripts/bash.sh` provides a good starting place.\n\n### Detector\nThe training code for the detector model (used to segment StegaStamps) is not included in this repo. The model used in the paper was trained using the BiSeNet model released [here](https://github.com/GeorgeSeif/Semantic-Segmentation-Suite). CROP_WIDTH and CROP_HEIGHT were set to 1024, all other parameters were set to the default. The dataset was generated by randomly placing warped StegaStamps onto larger images.\n\n### Tensorboard\nTo visualize the training run the following command and navigate to http://localhost:6006 in your browser.\n```bash=\ntensorboard --logdir logs\n```\n\n## Encoding a Message\nThe script `encode_image.py` can be used to encode a message into an image or a directory of images. The default model expects a utf-8 encoded secret that is \u003c= 7 characters (100 bit message -\u003e 56 bits after ECC).\n\nEncode a message into an image:\n```bash=\npython encode_image.py \\\n  saved_models/stegastamp_pretrained \\\n  --image test_im.png  \\\n  --save_dir out/ \\\n  --secret Hello\n```\nThis will save both the StegaStamp and the residual that was applied to the original image.\n\n## Decoding a Message\nThe script `decode_image.py` can be used to decode a message from a StegaStamp.\n\nExample usage:\n```bash=\npython decode_image.py \\\n  saved_models/stegastamp_pretrained \\\n  --image out/test_hidden.png\n```\n\n## Detecting and Decoding\nThe script `detector.py` can be used to detect and decode StegaStamps in an image. This is useful in cases where there are multiple StegaStamps are present or the StegaStamp does not fill the frame of the image.\n\nTo use the detector, make sure to download the detector model as described in the installation section. The recomended input video resolution is 1920x1080.\n\n```bash=\npython detector.py \\\n  --detector_model detector_models/stegastamp_detector \\\n  --decoder_model saved_models/stegastamp_pretrained \\\n  --video test_vid.mp4\n```\nAdd the `--save_video FILENAME` flag to save out the results.\n\nThe `--visualize_detector` flag can be used to visualize the output of the detector network. The mask corresponds to the segmentation mask, the colored polygons are fit to this segmentation mask using a set of heuristics. The detector outputs can noisy and are sensitive to size of the stegastamp. Further optimization of the detection network is not explored in this paper.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftancik%2Fstegastamp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftancik%2Fstegastamp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftancik%2Fstegastamp/lists"}