Metadata-Version: 2.1
Name: datasouls-antispoof
Version: 0.0.1
Summary: Detect spoofing attack
Home-page: https://github.com/ternaus/datasouls_antispoof
Author: Vladimir Iglovikov
License: MIT
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Description-Content-Type: text/markdown
Requires-Dist: timm
Requires-Dist: torch
Requires-Dist: torchvision
Provides-Extra: test
Requires-Dist: pytest ; extra == 'test'

# Anti spoofing with the Datasouls dataset
![](https://habrastorage.org/webt/uv/7u/ws/uv7uwsjkcz732_vhf0opx3zfjrc.jpeg)

## Dataset

[ID & RD anti spoofing challenge](https://ods.ai/competitions/idrnd-facial-antispoofing)

Four types of images:
* real
* replay
* printed
* mask2d

## Training

### Define the config.
Example at [datasoluls_antispoof/configs](datasouls_antispoof/configs)

### Define the environmental variable `IMAGE_PATH` that points to the folder with the dataset.
Example:
```bash
export IMAGE_PATH=<path to the folder with images>
```
### Inference

```bash
python -m torch.distributed.launch --nproc_per_node=<num_gpu> datasouls_antispoof/inference.py \
                                   -i <path to images> \
                                   -c <path to config> \
                                   -w <path to weights> \
                                   -o <output-path> \
                                   --fp16
```

### Pre-trained models

| Models        | Validation accuracy | Config file  | Weights |
| ------------- |:--------------------:| :------------:| :------: |
| swsl_resnext50_32x4d | 0.9673 | [Link](datasouls_antispoof/configs/2020-11-30b.yaml) | [Link](https://github.com/ternaus/datasouls_antispoof/releases/download/0.0.1/2020-11-30b_resnext50_32x4d.zip) |


