https://github.com/chris10m/jpeg-compression-detection

https://github.com/chris10m/jpeg-compression-detection

Science Score: 10.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (7.7%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: Chris10M
  • License: mit
  • Language: Python
  • Default Branch: main
  • Size: 1.02 MB
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created over 3 years ago · Last pushed over 3 years ago

https://github.com/Chris10M/jpeg-compression-detection/blob/main/

# JPEG Image Compression Detection And Quality Factor Detection

Few methods for JPEG Image Compression Detection And Quality Factor Detection


Low Compression            |  Medium Compression       |  High Compression 
:-------------------------:|:-------------------------:|:-------------------------:
![](images/high.png)       |  ![](images/mid.png)      |  ![](images/low.png)


## Methods

### DCT Based JPEG Compression Detection

[Image taken from here](https://www.cs.auckland.ac.nz/compsci708s1c/lectures/jpeg_mpeg/jpeg.html)

method

* Split the image into 8x8 blocks. * Compute the DCT coefficients for each block and quantize the frequency components. * Compute the normalized frequencies across all the blocks. * Compute the variance of the high frequency blocks. * If the variance is high, then unclamped high frequency components are present. If the variance is low, then jpeg quanitzed high frequency components are present. * The above observation can be used to classify if a jpeg image is compressed. ### Model Based Detection and Regression Reconstructed Reference | Input | Residual :-------------------------:|:-------------------------:|:-------------------------: ![](images/reference.png) | ![](images/input.png) | ![](images/residual.png) * Compute a reference denoised image using [Real-ESRGAN](https://github.com/xinntao/Real-ESRGAN). * Compute the residual image, i.e., difference between reference denoised image and input image. * The residual image contains high-frequency components, artifacts, etc. * The residual image is passed to a resnet model to get classifcation and regression of jpeg-compression and quality factor respectively. * The model is trained with augmenting single, doube jpeg compressions. * Non-aligned double JPEG compression should be implicitly handled as the reference image should produce a constant noise pattern. ### Pre-Trained Regression Model * We compute the JPEG Quality Factor using a pretrained regressor, [Towards Flexible Blind JPEG Artifacts Removal (FBCNN, ICCV 2021)](https://arxiv.org/abs/2109.14573) which supports single, doube jpeg compressions with Non-alignment of the quantized matrices in double jpeg compression. * The [FBCNN](https://github.com/jiaxi-jiang/FBCNN) repository is used. ## Usage Run get_dataset.sh to download the datasets. ``` bash get_dataset.sh ``` ### DCT Based JPEG Compression Detection Execute dct_validation.py to obtain the validation results stored as csv in outputs/dct.csv ``` python3 dct_validation.py ``` ### Model Based Detection and Regression Execute dnn_validation.py to obtain the validation results stored as csv in outputs/dnn.csv ``` python3 dnn_validation.py ``` ### Pre-Trained Regression Model Execute fbcnn_validation.py to obtain the validation results stored as csv in outputs/fbcnn.csv ``` python3 fbcnn_validation.py ``` ### Train To train the DNN model, we run train.py ``` python3 train.py ```

Owner

  • Name: Christen Millerdurai
  • Login: Chris10M
  • Kind: user

PhD & Researcher @ AV DFKI-Kaiserslautern.

GitHub Events

Total
Last Year

Dependencies

requirements.txt pypi
  • Pillow ==9.2.0
  • basicsr ==1.4.2
  • ipython ==8.5.0
  • matplotlib ==3.6.0
  • numpy ==1.23.1
  • opencv_python ==4.6.0.66
  • pytorch_lightning ==1.7.7
  • requests ==2.28.1
  • scikit_image ==0.19.3
  • scipy ==1.9.1
  • skimage ==0.0
  • torch ==1.12.1
  • torch_dct ==0.1.5
  • torchmetrics ==0.9.3
  • torchvision ==0.13.1