Pith. sign in

REVIEW 4 major objections 6 minor 22 references

Primary quantization matrix estimation of double compressed JPEG images via CNN

T0 review · 4 major / 6 minor · reviewed 2026-08-14 · deepseek-v4-flash

Pith's one-line read A single CNN can estimate the primary JPEG quantization matrix across aligned, non-aligned, QF1<QF2, and QF1>QF2 double compressions, and does so on small 64x64 patches.

desk verdict A useful CNN for primary quantization matrix estimation, but the 'very general conditions' headline is oversold — Table VI shows a concrete aligned QF1<QF2 case where it badly loses to a model-based method. read the letter →

arxiv 1908.04259 v1 pith:U2QMDIR4 submitted 2019-08-09 eess.IV

classification eess.IV
keywords doubleJPEGcompressionprimaryquantizationmatrixestimationconvolutionalneuralnetworkDenseNetlog-coshlossimageforensicsqualityfactortamperinglocalization
verification ladder T0 review T1 audit T2 compute T3 formal

The pith

A machine-rendered reading of the paper's core claim, the machinery that carries it, and where it could break.

The reading

The paper argues that one convolutional network, rather than a collection of condition-specific estimators, can recover the primary JPEG quantization matrix from a doubly compressed image regardless of grid alignment and regardless of whether the first quality factor is lower or higher than the second. The estimator takes a 64x64 RGB patch and feeds it through a DenseNet regressor whose output is the first 15 zig-zag quantization steps, rounded to integers. The loss is the log-cosh of the per-coefficient error, chosen so that a few badly wrong coefficients do not dominate training. If the claim holds, a single trained model replaces several specialized tools and works on patches small enough to support tampering localization.

What carries the argument

The engine is a DenseNet: a deep convolutional network with three dense blocks in which each layer receives feature maps from all earlier layers, with depth 40 and growth rate k=12, outputting Nc=15 real values after global average pooling and a fully connected layer. The network regresses the first 15 entries of the primary quantization vector taken in zig-zag order. The loss is L(x) = (1/Nc) sum_i log(cosh(q1,i(x)-fi(x))), which behaves like squared error for small deviations and like absolute error for large ones, so outliers do not dominate; the output is rounded to the nearest integer.

What would settle it

Take the QF2=90 model and run it on aligned double compressions with QF2=80 and QF1 in {75, 80, 85}: Table VI already shows the CNN is far worse than the dedicated estimator in that regime, so a systematic sweep over aligned low-QF2 settings with QF1 near QF2 would settle whether the 'general conditions' claim holds or needs an aligned-specific exception.

Watch

Extended reading notes

Core claim

The central claim, as the authors state it, is that a CNN trained once can estimate the primary quantization vector (first 15 coefficients) under very general conditions, unlike prior model-based methods that each require e.g. alignment or QF1<QF2. The authors demonstrate this with experiments on RAISE and Dresden, with OpenCV and Photoshop first compressions, and with mismatched QF values: in most tested cases the CNN yields lower MSE and often higher accuracy than dedicated baselines, with the largest gains in the non-aligned case and when QF1>QF2. The paper also reports that the same network gives good results on 64x64 patches, where statistical methods degrade, and that training with a fixed QF2 transfers to nearby QF2 values at least when the mismatch is not too strong.

Load-bearing premise

The claim of working under very general conditions rests on the assumption that a network trained on OpenCV-coded RAISE images with a fixed QF2 and a finite QF1 grid transfers to other encoders, other QF2 values, and other image sources; if that transfer fails, the generality claim collapses.

Editorial extensions

If this is right

  • One trained model can be deployed without knowing beforehand whether the double compression is aligned, non-aligned, QF1<QF2, or QF1>QF2.
  • The method's accuracy on 64x64 patches should enable quantization-matrix-based tampering localization at finer spatial resolution than model-based estimators allow.
  • Working on small patches means the same estimator can be applied to small spliced regions, not only whole images.
  • The log-cosh loss choice is shown to improve accuracy over L2, suggesting that robust losses matter as much as architecture for this regression task.

Reading between the lines

Editorial extensions of the paper, not claims the author makes directly.

  • Because the training grid shift is uniformly random over 64 positions, aligned examples form only 1/64 of the training data; a deployment setting where aligned double compression is common could require extra aligned samples to preserve performance.
  • The QF2-mismatch and encoder-mismatch results suggest the estimator learns a fairly general artifact signature; if so, a single model might extend to other JPEG variants, such as different chroma-subsampling settings, with limited retraining.
  • Casting the estimation as classification over the finite set of standard quantization steps could trade MSE for accuracy, as the authors note as future work; this might be tested specifically in the aligned low-QF2 regime where the regressor struggles.
Share X Bluesky LinkedIn Reddit HN

Signed reviews

No signed human review yet.

Editorial analysis

A structured set of objections, weighed in public.

Desk editor's note, referee report, and a circularity audit.

Referee Report

4 major / 6 minor

Summary. The paper proposes a single CNN-based estimator, adapted from a DenseNet architecture, that predicts the first Nc=15 entries of the primary quantization matrix of a doubly compressed JPEG image from a 64x64 pixel patch. The network is trained with a log-cosh regression loss (Eq. 1) for fixed second compression quality factors QF2=90 and QF2=80, with QF1 drawn from a grid and a uniformly random grid shift between the two compressions. Experiments on RAISE and Dresden datasets, with mismatched QF1, mismatched QF2, and Photoshop-based first compressions, report that the CNN outperforms model-based baselines in most settings, especially for non-aligned compressions and for QF1>QF2, while the abstract claims the method works under very general conditions (aligned/non-aligned, QF1<QF2, QF1>QF2).

Significance. If the central claim held as stated, the paper would be a useful contribution to JPEG forensics: a single learned estimator that removes the need for condition-specific tools and works at smaller patch sizes than prior art would have clear practical value for tampering localization. The empirical support is substantial in several regimes: non-aligned MSE improvements of roughly an order of magnitude (e.g., Table I, QF1=60: CNN-Log 2.17 versus [6] 33.2 and [10] 16.4), and genuine generalization checks to a different database (Table IV), mismatched QF2 (Table III), and Photoshop-encoded first compressions (Table V) are a real strength. The use of a simple regression loss with rounding is a reasonable and reproducible design choice, and the reported comparison includes both MSE and accuracy on the same 15 coefficients. However, the headline generality claim is contradicted by the paper's own aligned QF2=80 results in Table VI, so the claimed scope of the contribution is larger than the evidence supports.

major comments (4)
  1. [Section IV-B, Table VI] The aligned QF2=80 row for QF1=75 directly contradicts the abstract's claim that the method works under very general conditions. For this row, CNN-Log has MSE 10.6 and Acc 0.20, while the model-based method [9] achieves MSE 1.30 and Acc 0.66; similar large gaps appear for QF1=80 and QF1=85. QF1=75 is inside the training grid for QF2=80 listed in Section IV-A, so this is not a training-distribution mismatch. The text attributes the row to "a general performance loss by all techniques," but [9] does not suffer such a loss in that row. This is a load-bearing counterexample to the paper's main claim, and it must be fixed (e.g., by retraining with aligned samples adequately represented, or by explicitly excluding the aligned QF1<QF2 regime from the claimed scope).
  2. [Section IV-A, training protocol] The training protocol strongly undersamples the aligned case: a uniformly distributed random grid shift is applied between compressions, so aligned samples occur with probability only 1/64, and the QF2=80 model is fine-tuned for only 20 epochs from the QF2=90 model. This is the most plausible explanation for the catastrophic aligned QF2=80 results in Table VI, and it is not discussed. The authors should either introduce a mixed training strategy that guarantees aligned samples are adequately represented, or provide an explicit analysis of how the aligned-case failure depends on the sampling probability. As it stands, the claim that a single network covers the aligned regime is not supported for QF2=80.
  3. [All tables (Section IV-B)] All reported MSE and accuracy figures are single-run point estimates with no error bars, no repeated training runs, and no statistical significance tests. Several comparisons, especially in the aligned non-QF1=QF2 cases, are numerically close (e.g., Table I, QF1=60 aligned: CNN-Log 1.86 versus [9] 1.87, and QF1=65 aligned: 1.28 versus 9.21 in one baseline but 1.28 versus 1.13 for CNN-L2). Without variance information, the claimed improvements in those rows are not reliably established. The authors should report mean and standard deviation over at least a few training runs, or make a clear statement that the differences are within expected variability.
  4. [Section IV-A, generalization claim] The assertion that "a network trained with a given QF2 generalizes pretty well to different QF2's" is supported only by Table III, which tests a single mismatched QF2=92. That is a weak basis for a general claim, especially since Table V shows substantial degradation for low Photoshop qualities and the aligned QF2=80 results show a failure mode. The paper should either test a wider range of QF2 mismatches (both above and below the training value, including QF2=80 from a QF2=90 model and vice versa) or soften the claim to reflect the evidence. This is directly relevant to the promised generality of the method.
minor comments (6)
  1. [Equation (1)] In Eq. (1), the notation q1,i(x) is used both for the ground-truth quantization step and as a function of the image patch, while f_i(x) is the predicted soft output. Clarify the notation so that the dependent variable x is not overloaded with the index i.
  2. [Tables I-VI] The abbreviations "[6], N-Al" and "[6], Al" in the table headers are not defined in the caption or text. Spell out that these are the aligned and non-aligned variants of the method from [6], and similarly for [9] and [10], so that readers can interpret the comparisons without referring to the bibliography.
  3. [Figure 1] The caption of Fig. 1 states "non-aligned (left) and aligned (right)" but does not state that the accuracy is averaged over all QF1 values or that QF2=90. Add this information to the caption.
  4. [Section IV-A, dataset description] The paper says the training dataset uses 4e5 patches per QF1, and the test set uses 5780 patches from 1156 images, with 5 patches per image. State explicitly whether these patches are non-overlapping and whether the test patches come from images not used in the validation set, to avoid any ambiguity about data leakage.
  5. [Section IV-B, Table VI discussion] The sentence "Since many sota methods tend to perform worse when the second QF is small (noticeably smaller that QF1)" contains a typo: "that" should be "than." Also, the discussion of the aligned QF2=80 failure is too brief given the magnitude of the discrepancy.
  6. [Section III, network architecture] The DenseNet configuration is described in prose. A compact table or a reference to the exact Keras implementation (the link in [21] is given) would improve reproducibility, particularly the number of convolutional layers per dense block, the transition layer details, and the exact input preprocessing (or lack thereof).

Circularity Check

0 steps flagged · score 0.0 of 10

No circularity found: the CNN estimator is a supervised regressor trained on pairs of double-compressed patches and known primary quantization vectors, then evaluated on held-out data, mismatched QF1/QF2, a second dataset, and a different encoder; no prediction reduces to its inputs by construction.

full rationale

The central method is supervised learning: the network f(x) is trained by minimizing Eq. (1), L(x) = (1/Nc) sum_i log(cosh(q1,i(x) - f_i(x))), where q1,i(x) is the true quantization step obtained by constructing double-compressed images with known QF1 and QF2 (Section IV-A). This is a standard empirical risk minimization setup, not a derivation in which a parameter fitted to a subset is renamed a prediction. The evaluation in Tables I and VI uses held-out RAISE patches; Table II uses QF1 values not present in the training grid; Table III uses mismatched QF2 = 92 on a model trained with QF2 = 90; Table IV uses the Dresden dataset; and Table V uses Photoshop for the first compression, creating a genuine encoder mismatch with the OpenCV-trained model. These tests prevent the performance numbers from being forced by construction. The claim in Section IV-A that a network trained with a given QF2 generalizes to other QF2 values is an empirical assertion, and it is tested in Table III; even where the evidence is only partial, such as the weak aligned QF2 = 80 row in Table VI for QF1 = 75, that is a generalization/correctness concern, not circularity. The few self-references ([3], [18]) are background or prior forensic tools, not load-bearing arguments that reduce to unverified self-citations. No equation in the paper is shown to equal another by definition, and no fitted parameter is presented as an independently predicted quantity. Therefore the circularity score is 0.

Assumptions & free parameters 3 free parameters · 4 assumptions · 0 invented entities

The method is a supervised regressor, so its effective 'derivation' is the training data and the architecture choices: the RAISE/OpenCV double-compression pipeline, fixed QF2 values (90 and 80), the Nc=15 truncation, the DenseNet depth-40 and growth-12 configuration, and the log-cosh loss. No new physical or formal entities are postulated. The main assumptions are domain assumptions inherited from the JPEG forensics literature (truncation to 15 coefficients, knowledge of Q2) plus the generalization assumption that training on one compression pipeline transfers to other pipelines and image sources.

free parameters (3)
  • Trained DenseNet weights = not reported (millions of parameters)
    The estimator f(x) in Eq. (1) is fully determined by weights fitted to the RAISE/OpenCV double-compressed training set; the central result is a learned function, not a derived one.
  • Nc = 15 = 15
    Number of leading zig-zag coefficients estimated; inherited from prior works [6], [7], [9], [10], sets the output dimension and the denominator of the MSE and accuracy metrics.
  • DenseNet hyperparameters (depth 40, growth rate 12, dropout 0.2, Adam lr 1e-5, batch 32, 60/20 epochs)
    Chosen by hand following DenseNet practice; no ablation study justifies these values, yet they shape the estimator's behavior.
assumptions (4)
  • domain assumption The first Nc=15 zig-zag DCT coefficients are the discriminative ones; medium-high frequency steps are similar across matrices and less important.
    Invoked in Section II to justify truncating q1 to 15 entries, following [6], [7], [9], [15].
  • domain assumption The second quantization matrix Q2 is available (from the JPEG header or via separate estimators [17], [18]); the network is trained with QF2 fixed.
    Section IV-A states training fixes QF2; the practical claim assumes Q2 is known in use.
  • domain assumption A trained model transfers across image sources and encoders when the mismatch is not too strong.
    Section IV-A asserts generalization to different QF2 and the Dresden and Photoshop tests assume it; Table V shows it degrades for low Photoshop qualities.
  • domain assumption Uniformly random grid shifts in training, with aligned probability 1/64, cover the alignment distribution encountered in practice.
    Section IV-A generates shifts this way; non-aligned results rely on this coverage.

how reviews work

0 comments
Cite this review

Pith. "Pith review of Primary quantization matrix estimation of double compressed JPEG images via CNN." pith.science (2026). https://pith.science/paper/U2QMDIR4

@misc{pith2026190804259,
  author       = {Pith},
  title        = {Pith review of: Primary quantization matrix estimation of double compressed JPEG images via CNN},
  year         = {2026},
  howpublished = {\url{https://pith.science/paper/U2QMDIR4}},
  note         = {Machine review of arXiv:1908.04259}
}
read the original abstract

Available model-based techniques for the estimation of the primary quantization matrix in double-compressed JPEG images work only under specific conditions regarding the relationship between the first and second compression quality factors, and the alignment of the first and second JPEG compression grids. In this paper, we propose a single CNN-based estimation technique that can work under a very general range of settings. We do so, by adapting a dense CNN network to the problem at hand. Particular attention is paid to the choice of the loss function. Experimental results highlight several advantages of the new method, including: i) capability of working under very general conditions, ii) improved performance in terms of MSE and accuracy especially in the non-aligned case, iii) better spatial resolution due to the ability of providing good results also on small image patches.

Figures

Figures reproduced from arXiv: 1908.04259 by the authors.

Figure 1
Figure 1. Average Acc of the estimation for each DCT coefficient [PITH_FULL_IMAGE:figures/full_fig_p003_1.png] view at source ↗

Discussion (0). Continue with ORCID to comment.

Reference graph

Works this paper leans on

22 extracted references · 19 canonical work pages

  1. [9]

    First quantiza- tion matrix estimation from double compressed JPEG images,

    F. Galvan, G. Puglisi, A. R. Bruna, and S. Battiato, “First quantiza- tion matrix estimation from double compressed JPEG images,” IEEE Transactions on Information Forensics and Security , vol. 9, no. 8, pp. 1299–1310, Aug 2014

  2. [7]

    Estimation of primary quantization steps in double-compressed JPEG images using a statistical model of discrete cosine transform,

    T. H. Thai and R. Cogranne, “Estimation of primary quantization steps in double-compressed JPEG images using a statistical model of discrete cosine transform,” IEEE Access, vol. 7, pp. 76 203–76 216, 2019

  3. [6]

    Image forgery localization via block-grained analysis of JPEG artifacts,

    T. Bianchi and A. Piva, “Image forgery localization via block-grained analysis of JPEG artifacts,” IEEE Transactions on Information Forensics and Security, vol. 7, no. 3, pp. 1003–1017, June 2012

  4. [10]

    Robust first quantization matrix estimation based on filtering of recompression artifacts for non- aligned double compressed JPEG images,

    N. Dalmia and M. Okade, “Robust first quantization matrix estimation based on filtering of recompression artifacts for non- aligned double compressed JPEG images,” Signal Processing: Image Communication, vol. 61, pp. 9–20, 2018. [Online]. Available: http://www.sciencedirect.com/science/article/pii/S0923596517302084

  5. [1]

    Detection of double-compression in JPEG images for applications in steganography,

    T. Pevny and J. Fridrich, “Detection of double-compression in JPEG images for applications in steganography,” IEEE Transactions on Infor- mation Forensics and Security , vol. 3, no. 2, pp. 247–258, June 2008

  6. [2]

    Detecting doubly compressed JPEG images by using mode based first digit features,

    B. Li, Y . Q. Shi, and J. Huang, “Detecting doubly compressed JPEG images by using mode based first digit features,” in 2008 IEEE 10th Workshop on Multimedia Signal Processing , Oct 2008, pp. 730–735

  7. [3]

    Aligned and non-aligned double JPEG detection using convolutional neural networks,

    M. Barni, L. Bondi, N. Bonettini, P. Bestagini, A. Costanzo, M. Maggini, B. Tondi, and S. Tubaro, “Aligned and non-aligned double JPEG detection using convolutional neural networks,” J. Vis. Comun. Image Represent. , vol. 49, no. C, pp. 153–163, Nov. 2017. [Online]. Available: https://doi.org/10.1016/j.jvcir.2017.09.003

  8. [4]

    Detecting doubly compressed JPEG images by factor histogram,

    J. Yang, G. Zhu, and J. Huang, “Detecting doubly compressed JPEG images by factor histogram,” in Asia-Pacific Signal and Information Processing Association Annual Summit and Conference. , 2011

Show all 22 references
  1. [5]

    Exposing digital forgeries from JPEG ghosts,

    H. Farid, “Exposing digital forgeries from JPEG ghosts,” IEEE Transac- tions on Information Forensics and Security , vol. 4, no. 1, pp. 154–160, March 2009

  2. [8]

    Estimation of primary quantization matrix in double compressed JPEG images,

    J. Luks and J. Fridrich, “Estimation of primary quantization matrix in double compressed JPEG images,” Proc. Digital Forensic Research Workshop, 01 2003

  3. [11]

    Densely connected convolutional networks,

    G. Huang, Z. Liu, L. Van Der Maaten, and K. Q. Weinberger, “Densely connected convolutional networks,” in Proceedings of the IEEE confer- ence on computer vision and pattern recognition , 2017, pp. 4700–4708

  4. [12]

    A multi-purpose image forensic method using densely connected convolutional neural networks,

    Y . Chen, X. Kang, Y . Q. Shi, and Z. J. Wang, “A multi-purpose image forensic method using densely connected convolutional neural networks,” Journal of Real-Time Image Processing , vol. 16, no. 3, pp. 725–740, 2019

  5. [13]

    Application of densenet in camera model identification and post- processing detection,

    U. Kamal, A. M. Rafi, R. Hoque, S. Das, A. Abrar, M. Hasan et al. , “Application of densenet in camera model identification and post- processing detection,” arXiv preprint arXiv:1809.00576 , 2018

  6. [14]

    Detecting double JPEG compression with same quantization matrix based on dense cnn feature,

    X. Huang, S. Wang, and G. Liu, “Detecting double JPEG compression with same quantization matrix based on dense cnn feature,” in 2018 25th IEEE International Conference on Image Processing (ICIP) , Oct 2018, pp. 3813–3817

  7. [15]

    W. B. Pennebaker and J. L. Mitchell, JPEG: Still image data compres- sion standard. Springer Science & Business Media, 1992

  8. [16]

    How to train neural networks,

    R. Neuneier and H. G. Zimmermann, “How to train neural networks,” in Neural networks: tricks of the trade . Springer, 1998, pp. 373–423

  9. [17]

    Video codec identification,

    P. Bestagini, A. Allam, S. Milani, M. Tagliasacchi, and S. Tubaro, “Video codec identification,” inAcoustics, Speech and Signal Processing (ICASSP), 2012 IEEE International Conference on . IEEE, 2012, pp. 2257–2260

  10. [18]

    Detection of adaptive histogram equalization robust against JPEG compression,

    M. Barni, E. Nowroozi, and B. Tondi, “Detection of adaptive histogram equalization robust against JPEG compression,” in IWBF 2018, Interna- tional Workshop on Biometrics and Forensics , 2018, pp. 1–8

  11. [19]

    RAISE: A raw images dataset for digital image forensics,

    D. Dang-Nguyen, C. Pasquini, V . Conotter, and G. Boato, “RAISE: A raw images dataset for digital image forensics,” in Proceedings of the 6th ACM Multimedia Systems Conference , ser. MMSys ’15. New York, NY , USA: ACM, 2015, pp. 219–224. [Online]. Available: http://doi.acm.org...

  12. [20]

    The ’Dresden Image Database’ for benchmarking digital image forensics,

    T. Gloe and R. B ¨ohme, “The ’Dresden Image Database’ for benchmarking digital image forensics,” in Proceedings of the 2010 ACM Symposium on Applied Computing , ser. SAC ’10. New York, NY , USA: ACM, 2010, pp. 1584–1590. [Online]. Available: http://doi.acm.org/10.1145/1774088.1774427

  13. [21]

    Available: https://github.com/seasonyc/densenet

    [Online]. Available: https://github.com/seasonyc/densenet

  14. [22]

    An effective method for detecting double JPEG compression with the same quantization matrix,

    J. Yang, J. Xie, G. Zhu, S. Kwong, and Y . Shi, “An effective method for detecting double JPEG compression with the same quantization matrix,” IEEE Transactions on Information Forensics and Security, vol. 9, no. 11, pp. 1933–1942, 2014

Pith tools

Reviewed August 14, 2026 · model on record in the stance chip above.