Metadata-Version: 2.4
Name: deepface-antispoofing
Version: 1.1.2
Summary: A Python package for advanced face recognition, anti-spoofing, and deepfake detection, offering robust analysis to distinguish real faces from printed images, replay attacks, and presentation attacks, alongside precise age, gender, and genuine vs. AI-generated face predictions, ideal for secure authentication and identity verification.
Author: IP Softech - Pratham Pansuriya
Author-email: ipsoftechsolutions@gmail.com
Classifier: Programming Language :: Python
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: requests
Requires-Dist: opencv-python
Requires-Dist: numpy
Requires-Dist: tensorflow
Requires-Dist: flask
Requires-Dist: flask-cors
Requires-Dist: deepface
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# DeepFace Anti-Spoofing

The **DeepFace Anti-Spoofing** package enables users to perform advanced face recognition, anti-spoofing, and deepfake detection on images. It provides predictions for age, gender, and determines whether an image contains a real face, a printed photo, a replay attack, a presentation attack, or an AI-generated deepfake. This package is designed for secure authentication, identity verification, and seamless integration into Python applications, ensuring reliable and efficient image analysis.

## Features

- **Face Analysis**: Predict age and gender from uploaded images using the `analyze_image` method.
- **Anti-Spoofing Detection**: Determine whether a face is real or part of a spoofing attack (e.g., printed photo, replay, or presentation attack) using the `analyze_deepface` method.
- **Deepfake Detection**: Detect AI-generated faces or deepfakes with high accuracy via the `analyze_image` method.
- **Simple Integration**: Easily integrate into Python applications for robust image analysis.

## Documentation

Comprehensive documentation, guidance, and code examples, including a web interface for testing, are provided at the [DeepFace Anti-Spoofing Documentation](https://ipsoftechsolutions.pythonanywhere.com/deepface-antispoofing-documentation/).

## Installation

To use the DeepFace Anti-Spoofing and Deepfake Analysis package in your Python application, install the required package:

```bash
pip install deepface-antispoofing
```

## Usage Examples

### Example 1: Face Analysis with Age, Gender, and Deepfake Detection
The `analyze_image` method predicts age, gender, and whether the image contains a real or AI-generated face.

```python
from deepface_antispoofing import DeepFaceAntiSpoofing

file_path = "path_to_image.jpg"

deepface = DeepFaceAntiSpoofing()

response = deepface.analyze_image(file_path)

print(response)
```

**Sample Response**:
```json
{
  "id": 1,
  "age": 30,
  "gender": {
    "Male": 0.85,
    "Female": 0.15
  },
  "dominant_gender": "Male",
  "spoof": {
    "Fake": 0.02,
    "Real": 0.98
  },
  "dominant_spoof": "Real",
  "timestamp": "2025-04-18 12:34:56"
}
```

### Example 2: Anti-Spoofing Detection for Printed, Replay, or Presentation Attacks
The `analyze_deepface` method determines whether the face is real or part of a spoofing attack, such as a printed photo, replay attack, or presentation attack.

```python
from deepface_antispoofing import DeepFaceAntiSpoofing

file_path = "path_to_image.jpg"

deepface = DeepFaceAntiSpoofing()

response = deepface.analyze_deepface(file_path)

print(response)
```

**Sample Response**:
```json
{
  "confidence": 1.0,
  "is_real": "True",
  "processing_time": 1.03,
  "spoof_type": "Real Face",
  "success": "True"
}
```

## Key Points

- Ensure the uploaded image contains a clear face for accurate analysis.
- Use `analyze_image` for age, gender, and deepfake detection.
- Use `analyze_deepface` for detecting spoofing attacks like printed photos, replay attacks, or presentation attacks.
- Refer to the [official documentation](https://ipsoftechsolutions.pythonanywhere.com/deepface-antispoofing-documentation/) for detailed endpoint specifications, advanced features, and web interface usage.

## Support

For any issues or questions, please contact [ipsoftechsolutions@gmail.com](mailto:ipsoftechsolutions@gmail.com).

---

Thank you for choosing DeepFace Anti-Spoofing for your face recognition, anti-spoofing, and deepfake detection needs!
