-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Real Class PNG Format Image Request #11
Comments
You can try to set the jpeg image QF as 100 in |
Yes, when set the
By default, this code uses a JPEG compression rate of 95. It would be more appropriate to use the same compression ratio for both the |
I set QF as 100 and get the results:
|
That is strange, my result after set QF to 100:
|
Actually as the paper stated, the model should be robust to jpeg compression. |
By the way, I have generated the PNG format dire image of
|
@Rapisurazurite From which folder did u take the images? (dire, images, recons) Is it legal to convert |
I use compute_dire.py to generate .png dire image |
for the real dataset |
Does this paper still hold? I mean this a fundamental mistake then... |
I assume, that you converted jpeg (compressed) to png (lossless). |
I think he used 'compute_dire.py' to generate the DIRE reconstruction but saved them as .png this time whereas originally the reals were just .jpeg. I'm not sure this says a lot since the difference of a .jpeg with a lossless DIRE reconstruction might still contain .jpeg artifacts (introduced by subtracting the original JPEG image). |
I also reproduced the OP's findings.
(4b. as a sanity check, then I swapped the real and fake image folders and got the following output:
)
=====================================I obtained similar catastrophic loss of performance after Jpeg encoding when using imagenet_adm_jpeg75: lsun_sd1_jpeg95: =====================================Finally, I also did the following experiment with only synthetic images:
|
@lukovnikov Many thanks for your analysis. I have reproduced several of your points and I agree with your results, however
The JPEG quality of LSUN should be 75, as also stated in https://github.com/fyu/lsun :
How did you get quality 95? I ran |
@ciodar Thanks for letting me know! I simply downloaded the reconstructions (not the original lsun images) from the OneDrive provided by the authors here and ran the following command: I'm not sure what is the source of this discrepancy but would be curious to find out. I was thinking maybe somehow that's the default JPEG quality in the library but then ImageNet reconstructions should also be saved in quality 95, but there the same command gives me quality 75 (and the files are also smaller while being at the same resolution). |
That is strange, since the procedure is the same I followed. I did not download lsun directly, but I assume the authors did when preparing the dataset, so the JPEG quality should be the same as the one stated by LSUN dataset creators. However, I'm now noticing that with quality as low as 75, the reconstructions have some colour blobs (which are not present in real images). I don't know if it is a bug in my conversion and inversion process or if the network struggles to invert heavily compressed images. I will further investigate about this. |
It is quite strange, perhaps the LSUN reconstructions on OneDrive were created using an earlier version of the code? Did you check the data from In any case, I also tried to compress both the reals and the fakes from LSUN test reconstructions down to JPEG with quality 75, leading to bad results (Acc=50%, AP~75%), and encoding just the fake reconstructions to JPEG with quality 75 while keeping the reconstruction jpegs for reals as downloaded from OneDrive gives even worse results (Acc=50%, AP<50%). In both cases, everything is classified by |
This result is actually good as it confirms your previous analysis. Achieving a value of exactly 50% should give a hint that the JPEG quality is the same between real and fake images, assuming that the model does not recognize anything but the JPEG artifacts. This is also supported by the fact that the model achieves a very early convergence with training (less than one epoch), to obtain perfect classification between real JPEG images and fake PNG images. |
I gave a second read to this, and it is different than what I did. The estimated JPEG quality of the reconstructions can differ from the quality of the images. Moreover, the JPEG artifacts can be included even in the uncompressed PNG image generated by the model, since Diffusion Models can reproduce artifacts present in the training set (see Corvi et al. 2023). A more realistic scenario is to encode the generated images into JPEG and recompute the DIRE for all the images, since this is what would happen during an inference step with this method. Interestingly, I followed this second procedure and the results do not differ so much from your findings. My intuition is that in both ways we are producing double (if not triple) compression artifacts, which could be spottable by the detector. I'd like the author @ZhendongWang6 to comment on this, and to know which of these two alternatives he used to calculate the robustness metrics |
Hello, do you still have the dataset for this project? The dataset link is now broken. If you have it, could you please send me a copy? Thank you very much. |
The dataset appears to still be available via the following link: https://rec.ustc.edu.cn/share/ec980150-4615-11ee-be0a-eb822f25e070. By the way, for a more detailed analysis of PNG and JPEG format issues, please refer to Jonas Ricker’s research paper. |
I am very curious about this result. Could you please attach some pictures? |
Here is a paper about jpeg artifacts: https://arxiv.org/pdf/2403.17608.pdf |
I've observed that the images in the "real" folder are in JPG format, while the generated images are in PNG format. I wrote the following code to convert the images in the "adm" folder into JPG:
and after that i ran the
test.py
, and the results oflsun_bedroom/lsun_bedroom
usinglsun_adm.pth
:Before converting the images, the results were as follows (as seen in issue #9)
Can you provide real class PNG dire image? Thanks.
The text was updated successfully, but these errors were encountered: