This repository contains the backend for the document authenticity verification system. It employs an Ensemble Learning approach, combining predictions from six different machine learning models to achieve highly robust and reliable classification of certificates as "Genuine" or "Fraud."
The API accepts an image path, runs a simulated Computer Vision (CV) pipeline to extract key similarity scores, and feeds those scores to the ensemble for the final prediction.
- 6-Model Ensemble: Combines the predictive power of CNN, Random Forest, SVM, Logistic Regression, K-Means, and Naive Bayes.
- Deep Learning Feature Integration: Uses simulated outputs from an image-based feature extractor (signature similarity, seal similarity, layout alignment).
- FastAPI Deployment: Robust and fast API server built on FastAPI for easy prediction serving.
- Tie-Breaker Priority: Uses a structured voting system with a clear priority (CNN > RF > SVM > LR > K-Means > NB) to resolve 3-3 ties.
git clone [https://github.com/RishiGoswami-code/VikingMachineLearningModel.git]
cd VikingMachineLearningModelpython3 -m venv venv
source venv/bin/activate # On Windows: .\venv\Scripts\activatepip install fastapi uvicorn numpy scikit-learn tensorflow pydantic```bash
uvicorn app:app --reload --host 0.0.0.0 --port 8000
```
When the system loads and trains all models, you will see:
All 6 Models Trained and Ready.http://127.0.0.1:8000http://127.0.0.1:8000/docs| Method | Path | Description |
|---|---|---|
| POST | /predict | Runs the full ML pipeline + ensemble. |
{
"image_path": "certificate_good_sig_good_seal_high_clarity.jpg"
}{
"prediction_status": true,
"prediction_label": "GENUINE"
}| **Field ** | **Type ** | Description |
|---|---|---|
| prediction_status | boolean | true = Genuine, false = Fraud |
| prediction_label | string | "GENUINE" or "FRAUD" |
-
CNN
-
Random Forest
-
SVM
-
Logistic Regression
-
K-Means
-
Naive Bayes
-
CNN
-
Random Forest
-
SVM
-
Logistic Regression
-
K-Means
-
Naive Bayes
-
Each model outputs its prediction.
-
The ensemble computes majority vote.
-
If tied, priority order decides the final label.
-
FastAPI (API framework)
-
TensorFlow (CNN model)
-
scikit-learn (RF, SVM, Logistic Regression, Naive Bayes, K-Means)
-
Uvicorn (ASGI server)
-
Pydantic (input validation)
-
Replace simulated CV pipeline with real image analysis
-
Model retraining from UI
-
Add confidence scores
-
Deploy to cloud (AWS / GCP / Render)
Chandan GIri