How fardinabbasi/ml_fake_image_detection works
Main components
• Data Ingestion & Storage:
• Input images organized in two directories: “real” and “fake.”
• CSV files: “features.csv” and “labels.csv” representing the deep features.
• Feature Extraction Module:
• Handcrafted Feature Extraction: LBP and FFT methods implemented in code.
• Deep Features: Already provided but still integrated as a parallel track.
• Data Preprocessing:
• Cleaning (handling nulls, fixing or removing incorrect labels).
• Standardization (normalizing feature values).
• Train/Test Data Split.
• Dimension Reduction:
• PCA.
• LOL (Linear Optimal Low-Rank Projection).
• Classification Module:
• Logistic Regression (with Newton-Cholesky solver as mentioned).
• SVM (including grid search for hyperparameters).
• Random Forest (including hyperparameter tuning, e.g., number of estimators and max depth).
• Clustering Module:
• Mini-Batch K-Means (with evaluation using inertia/elbow method).
• Gaussian Mixture Models (with model selection via AIC/BIC).
• Result Evaluation & Reports:
• Visualization of classification evaluations (classification reports, confusion matrices).
• Clustering visualizations and sample decision tree from Random Forest.
• Supporting PDF reports and Jupyter Notebooks (Code.ipynb).
Relationships and data flow
• Both handcrafted and deep features are processed (handcrafted features are computed via the LBP and FFT methods, while deep features are read from provided CSV files).
• Next, funnel all features to the “Preprocessing” stage where data cleansing, standardization, and the train-test split occur.
• Then, the high-dimensional data is fed into the “Dimension Reduction” module where PCA and LOL transform the data into a more manageable size.
• Post dimension reduction, the refined feature set splits into two branches:
• One branch enters the “Classification” module (utilizing Logistic Regression, SVM, and Random Forest) to produce predictions.
• The other branch flows into the “Clustering” module (with Mini-Batch K-Means and GMM) for unsupervised analysis.
• Finally, evaluation results are generated and consolidated into visualization outputs (reports and images in the “readme_images” directory).
Important architectural patterns
• Pipeline/Modular architecture: Each processing step (extraction, preprocessing, reduction, classification, clustering) is a distinct module that feeds data into the next.
• Parallel feature processing: The design accommodates both handcrafted and deep features, highlighting design extensibility.
• Separation of concerns: Each component exactly targets a single functionality, making the system easier to understand and potentially scale.
Relevant technologies and libraries
• Image Processing: kimage I/O (skimage.io) and resize functions.
• Feature extraction: Custom implementation of LBP (using skimage.feature) and FFT from NumPy.
• Dimensionality reduction: Implementation of PCA and LOL.
• Machine Learning Models: scikit-learn (for Logistic Regression, SVM, Random Forest, and clustering algorithms).