tancik / stegastamp Goto Github PK
View Code? Open in Web Editor NEWInvisible Hyperlinks in Physical Photographs
Home Page: http://www.matthewtancik.com/stegastamp
License: MIT License
Invisible Hyperlinks in Physical Photographs
Home Page: http://www.matthewtancik.com/stegastamp
License: MIT License
How to fine tune the model through the trained CKPT model
When I run decode python code on both images and videos, it comes to this problem.
Traceback (most recent call last):
File "decode_image.py", line 64, in
main()
File "decode_image.py", line 57, in main
bitflips = bch.decode_inplace(data, ecc)
ValueError: invalid parameters
I am not familar with bch, so how can I solve this?
ValueError: Cannot feed value of shape (1, 200, 200, 3) for Tensor 'input_hide:0', which has shape '(?, 400, 400, 3)'
How to achieve the encoded image pixels and the encoded pixels consistent?
The encoded_image in the network has always been operated in the form of a tensor. When I want to make some changes to the noise layer, I find that I cannot directly assign a value to the tensor, so I want to convert the encoded_image to the form of an array first. I use sess.run and .eval() both failed. Is there any solution? Thank you very much! ! ! ! ! !
I am wondering when you feed a natural image without residual secret into the decoder network.
what result will the decoder produce?
The ouuout images are 400x400. IS possible to change this output to a higher quality?
Where can i change the length of the message.
Have you implemented this algorithm in other deep learning frameworks, such as pytorch, caffe ?
Hi,
Thanks for this awesome library but can you please guide me how you have implemented this on the camera scanning
If possible can you show some example code as when we are taking the images from the camera it doesn't work
In trying to train I got this error (tensorflow1.15)
models.py", line 4, in
import lpips_tf
ModuleNotFoundError: No module named 'lpips_tf'
Tried to fix with
https://github.com/alexlee-gk/lpips-tensorflow but didn't solve the problem.
What am I missing?
hello,if I have 10 pictures of 400X400, How long does it take for you to train the model. It took me a long time to train the model.
Hello, I have been studying your paper recently. I don't quite understand the role of discriminator, because I find that G_loss is used in total loss, so what is the role of D_loss? And is the loss of discriminator negative? Thank you very much!
Hello, tancik!
Excuse me, if you don't use BCH code, what is the decoding accuracy (bit_acc)?
Every 12 bytes (96 bits), only 5 bits can be corrected, right?
encode_image.py
and decode_image.py
, The BCH parameters you use are:
BCH_POLYNOMIAL = 137
BCH_BITS = 5
bchlib
source code, my understanding is,Thank you for your amazing work.
What is the dataset used in training the detector?
What does YUV_scales stand for? Why did you set y,u, and v to 1,100,100, respectively?
How do I adjust these three parameters?
Many thanks
I try to train model, bug could not get the same performance like the released model.
Could you share training parameters or told me how to adjust parameters.
Thanks.
How many images in your training dataset?
Dear tancik:
I got the following error when running encode_image.py
:
Error: Can only encode 56 bits (7 characters) with ECC.
I'm confused about why it can only encode 56 bits (7 characters) with ECC.
Thanks in advance! 😄
Hi everyone,
I am trying to add a image switch to decode.py file to detect and decode the hidden physical images. Anyone has done it before or any suggestions ?
Do you need to change some parameters?I changed part of the code, but it is still not right, I wonder if it is a parameter problem。
Hello!
in build_model, borders control the generation of encoded image. what's the 'borders' mean? what's the different between 'no_edge' 'black' 'random' 'white' and 'image'
I trained the original model without any modification, and got a model which can work well. But the model size is too big, about 1.1GB, while the supplied pretrained model is 217MB.
I just wonder if the pretrained model has discard some weights? Like the discriminator network's weights?
Hello, tancik !
I am keen on your outstanding work. But when I was traing a detector for distiguishing the encoded images from complex background (not totally white), I have some trouble about making dataset. Here is my questions:
Are the encoded images placing on totally white background in the traing dataset for detector?
If the encoded image's size is small (maybe 1/100 of an A4 paper), how can I make a training dataset to get great precision ?
Finally, I have written a documentation to guide chinese novices to build an environment and turn your code from tensorflow 1.x to tensorflow 2.x. I hope you will like it and it can help more githubers to run your work.
Could you guys give the original detector model please?
I mean the one you released is not robust.
I have cloned the project from github and installed the requirements after than i have specified the "TRAIN_PATH" but when i try to launch the train.py i am facing with error code:
Traceback (most recent call last):
File "C:/Users/yavuz/PycharmProjects/Tensorflowpytorch/StegaStamp/train.py", line 224, in <module>
main()
File "C:/Users/yavuz/PycharmProjects/Tensorflowpytorch/StegaStamp/train.py", line 151, in main
writer = tf.summary.FileWriter(join(LOGS_Path,EXP_NAME),sess.graph)
File "C:\Users\yavuz\AppData\Local\Programs\Python\Python37\lib\ntpath.py", line 115, in join
genericpath._check_arg_types('join', path, *paths)
File "C:\Users\yavuz\AppData\Local\Programs\Python\Python37\lib\genericpath.py", line 149, in _check_arg_types
(funcname, s.__class__.__name__)) from None
TypeError: join() argument must be str or bytes, not 'NoneType'
Process finished with exit code 1
Note:
I have changed the /// parser.add_argument('exp_name', type=str)
/// to /// parser.add_argument('--exp_name', type=str)
///
Because i was also having an error in other way.
I have read all the paper and wanted to try it but having hard time on debugging. Because i do not have much experience on python.
Waiting for your help.
Hello, I don't quite understand the function of the parameter "border", can you explain it?
Hi, are you available for contract work ? I need this tech for a commercial project.
my test environment:
docker pull tensorflow/tensorflow:1.13.2-gpu-py3
and I found the lastest saved model
root@3ec62ce01961:~/StegaStamp# du -sm saved_models/7/*
208 saved_models/7/saved_model.pb
0 saved_models/7/variables
but the released model is
(tf1.13) [phoenixkiller@ultrapower stegastamp_pretrained]$ du -sm *
1 saved_model.pb
207 variables
Does I got pb model?
And I still could not get the performance same as release model.
Should I change tensorflow version to 1.13.1?
Watermark steganography is bad for low-frequency pictures. Is it because my parameters have not been adjusted? When I deal with black-and-white document images, the visual effect of watermarks is very poor. How to adjust? The watermark cannot be extracted from the picture taken by the mobile phone.
as title
hi, can you give me some advise about:
1 how to improve str acc?
I use win10 + tf cpu to train a model with the same image dataset you offered.
perhaps the iterate does not reach its maximum num(14w, now is about 1.9w)
2 and are the parameters in parser.add_argument(in train.py) correct? I need some details about these paras, to make sure whether I am on the right way training model.
3 can you tell me the ideal about these tf encode/decode/discriminator models, why do we need these 10 or 5 CNN layers? and why can these models achieve a good performance?
4 and can you tell me the BCH code? in code, you use BCH_POLYNOMIAL = 137, BCH_BITS = 5. this BCH code need 127bits(92bits are valid bits that we can hide data). But in parper, you use 100bits(96bits+4bits) which can recover 56 bits data.
many thanks!
Hello, @tancik
Did you find out which parameter affects decodability of the printed image the most when doing experiments?
I tried to train a new model with some image which is not natural, but the some of the printed images can't be decoded.
After training the saved PB model, when a picture is encrypted, printed and photographed, it cannot be decrypted
Is the picture distortion just controlled by lpips_loss_scale ?
G_loss_scale,l2_loss_scale, What does G,l2 stand for?
Many thinks
Hello guys. could anyone tell me what kind of file form should I create for save_video FILENAME?
When I run this project, spyder told me: train.py: error: the following arguments are required: exp_name,I am new for this, so I how to deal with it? Thanks(#^.^#)
Hello, tancik
I wonder if this is an unexpected mistake in writing?
"Accounting for error correcting, using only 50 total message bits would drastically reduce the number of possible encoded hyperlinks to under one billion"
The paper said that ”use 100 bits to hide 56 bits“,
so if we use 50 bits, it can hide ” under one billion“ ? really?
look forward to your reply. Many Thanks!
Failed in models.py line 3: import lpips.lpips_tf.
No module named 'lpips_tf'.
Where is test_vid.mp4?
Hello, when I first read the source code, I had this problem.
The source code of computing str_acc and bit_acc is the follows:
''
def get_secret_acc(secret_true,secret_pred):
with tf.variable_scope("acc"):
secret_pred = tf.round(secret_pred)
correct_pred = tf.count_nonzero(secret_pred - secret_true, axis=1)
str_acc = 1.0 - tf.count_nonzero(correct_pred - tf.to_int64(tf.shape(secret_pred)[1])) / tf.size(correct_pred, out_type=tf.int64)
bit_acc = tf.reduce_sum(correct_pred) / tf.size(secret_pred, out_type=tf.int64)
return bit_acc, str_acc
''
why the line 4 is tf.count_nonzero(secret_pred - secret_true, axis=1)? This seems to compute the error bit number of each batch. However, the str_acc and bit_acc use it as the correct number. I think it maybe a typo, but the traning log of tensorborad shows a reasonable result.
Could you send the dataset to me ? I cannot get the data.
hi @tancik
since the fc layer
in decoder
is too larger (13*13 * 128 * 500 = 10,816,000), so i want use a conv(dim=1024) to increase the dimension and then use tf.reduce_mean(x, axis=[1, 2])
, but in the first 1w iterations, the bit_acc
always gets around 0.5, and the str_acc
gets zero. so how to reduce the params for the fc layer
, at the same time, it can get good results?
When I run the code to my own video
python detector.py
--detector_model detector_models/stegastamp_detector
--decoder_model saved_models/stegastamp_pretrained
--video test_vid.mp4
I found bitflips always has value -1
The following is what I did:
step 1: Hide message into image lena and verified the message can be decoded
step 2: Print the image with message inside
step 3: Record a video of the printed image
And then, I found the bitflips always has value -1, could you help me with this problem. Thank you.
The image and video can be find here.[https://drive.google.com/open?id=1XGXWCN78kDvr6IEtTyIQKB6JJ9jXvTok]
Excuse me,sir.Can you help me? I try to use the natural images (100000 images) from Set and retrain the model,but don’t know why the generated model's variables directory is empty and saved_model.pb file is really big ,and I try a lot ,many say it's the reason that the graph is "frozen" (i.e., all variables are converted to constant nodes in the graph), so there are no "variables" left in the computation and hence the directory is empty.I don't know how to solve this,and I really appreciate for your help.
the code to generate model is below:
with tf.Session(graph=tf.Graph()) as session: tf.import_graph_def(constant_graph_def, name='') tf.saved_model.simple_save(session, SAVED_MODELS + '/' + EXP_NAME, inputs={'secret': secret_pl, 'image': image_pl}, outputs={'stegastamp': deploy_hide_image_op, 'residual': residual_op, 'decoded': deploy_decoder_op})
Hi,did you do the ablation study of the STN module of the decoder? I find it doesn't play an important role for improving decoding accuracy. Furthermore, the parameters of the STN cost too much space. The model size decrease from 200M to 50M after removing this module.
I did some testing and found that it requires a white border around the image containing the hidden code for the detector to work. For my use-case, I need the detector to work even without the white border. So I will have to retrain the detector.
For that I am following the other github repo but it seems to be causing some issues with the input size of model.
Has anyone tried this?
Hi, I can't understand the motion blur kernel, which is implemented in random_blur_kernel function.
Line 8 in 2e852ee
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.