spectralforensics
This commit is contained in:
@@ -0,0 +1,187 @@
|
||||
Metadata-Version: 2.4
|
||||
Name: spectralforensics
|
||||
Version: 0.1.0
|
||||
Summary: Explainable spectral forensic analysis
|
||||
Author: José Garcia, Patricio Rodrigues, Carlos Grilo, Rolando Miragaia
|
||||
Maintainer-email: José Garcia <2023144112@my.ipleiria.pt>
|
||||
Requires-Python: >=3.10
|
||||
Description-Content-Type: text/markdown
|
||||
Requires-Dist: numpy
|
||||
Requires-Dist: pillow
|
||||
Requires-Dist: pandas
|
||||
Requires-Dist: scipy
|
||||
Requires-Dist: matplotlib
|
||||
Requires-Dist: scikit-image
|
||||
|
||||
\# SpectralForensics
|
||||
|
||||
|
||||
|
||||
SpectralForensics is an open-source Python library for image forensic analysis using \*\*Fast Fourier Transform (FFT)\*\* and frequency-domain feature extraction.
|
||||
|
||||
|
||||
|
||||
The library was designed to support research in digital image forensics, synthetic media detection, diffusion model analysis, and explainable artificial intelligence (XAI).
|
||||
|
||||
|
||||
|
||||
\## Features
|
||||
|
||||
|
||||
|
||||
SpectralForensics extracts a set of interpretable spectral descriptors from images:
|
||||
|
||||
|
||||
|
||||
\- Spectral Entropy
|
||||
|
||||
\- Anisotropy
|
||||
|
||||
\- Dominant Frequency
|
||||
|
||||
\- Energy Density
|
||||
|
||||
\- High Frequency Ratio
|
||||
|
||||
\- Mean Spectral Energy
|
||||
|
||||
|
||||
|
||||
These descriptors can be used for:
|
||||
|
||||
|
||||
|
||||
\- AI-generated image detection
|
||||
|
||||
\- Deepfake forensics
|
||||
|
||||
\- Diffusion model fingerprinting
|
||||
|
||||
\- Frequency-domain analysis
|
||||
|
||||
\- Explainable machine learning pipelines
|
||||
|
||||
|
||||
|
||||
\## Installation
|
||||
|
||||
|
||||
|
||||
\### Local installation
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
|
||||
py -m pip install -e .
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
\\### Future PyPI installation
|
||||
|
||||
|
||||
|
||||
pip install spectralforensics
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
\\## Quick Start
|
||||
|
||||
|
||||
|
||||
\\### Extract Features from a Single Image
|
||||
|
||||
|
||||
|
||||
```python
|
||||
|
||||
from spectralforensics import extract\\\_spectral\\\_features
|
||||
|
||||
|
||||
|
||||
features = extract\\\_spectral\\\_features("image.jpg")
|
||||
|
||||
|
||||
|
||||
print(features)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
\### Example Output
|
||||
|
||||
|
||||
|
||||
```python
|
||||
|
||||
{
|
||||
|
||||
\  "filename": "image.jpg",
|
||||
|
||||
\  "spectral\\\_entropy": 2.31,
|
||||
|
||||
\  "anisotropy": 0.021,
|
||||
|
||||
\  "dominant\\\_frequency": 12.7,
|
||||
|
||||
\  "energy\\\_density": 58210.3,
|
||||
|
||||
\  "high\\\_frequency\\\_ratio": 0.000091,
|
||||
|
||||
\  "mean\\\_energy": 58210.3
|
||||
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
\---
|
||||
|
||||
|
||||
|
||||
\### Extract Features from an Entire Folder
|
||||
|
||||
|
||||
|
||||
```python
|
||||
|
||||
from spectralforensics import extract\\\_features\\\_from\\\_folder
|
||||
|
||||
|
||||
|
||||
df = extract\\\_features\\\_from\\\_folder(
|
||||
|
||||
\  folder\\\_path="dataset",
|
||||
|
||||
\  output\\\_csv="results.csv"
|
||||
|
||||
)
|
||||
|
||||
|
||||
|
||||
print(df.head())
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
\### Example Output
|
||||
|
||||
|
||||
|
||||
| filename | spectral\_entropy | anisotropy | dominant\_frequency | energy\_density | high\_frequency\_ratio |
|
||||
|
||||
|-----------|----------------|------------|-------------------|----------------|---------------------|
|
||||
|
||||
| real\_001.jpg | 1.21 | 0.012 | 11.0 | 91327 | 0.000037 |
|
||||
|
||||
| dalle\_001.png | 2.50 | 0.034 | 16.0 | 68150 | 0.000177 |
|
||||
|
||||
| flux\_001.jpg | 2.51 | 0.019 | 6.0 | 61004 | 0.000064 |
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
README.md
|
||||
pyproject.toml
|
||||
spectralforensics.egg-info/PKG-INFO
|
||||
spectralforensics.egg-info/SOURCES.txt
|
||||
spectralforensics.egg-info/dependency_links.txt
|
||||
spectralforensics.egg-info/requires.txt
|
||||
spectralforensics.egg-info/top_level.txt
|
||||
src/spectralforensics/__init__.py
|
||||
src/spectralforensics/dataset.py
|
||||
src/spectralforensics/features.py
|
||||
src/spectralforensics.egg-info/PKG-INFO
|
||||
src/spectralforensics.egg-info/SOURCES.txt
|
||||
src/spectralforensics.egg-info/dependency_links.txt
|
||||
src/spectralforensics.egg-info/requires.txt
|
||||
src/spectralforensics.egg-info/top_level.txt
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
numpy
|
||||
pillow
|
||||
pandas
|
||||
scipy
|
||||
matplotlib
|
||||
scikit-image
|
||||
@@ -0,0 +1 @@
|
||||
spectralforensics
|
||||
Reference in New Issue
Block a user