Update README.md
Browse files
README.md
CHANGED
|
@@ -14,26 +14,37 @@ tags:
|
|
| 14 |
- swin
|
| 15 |
- localization
|
| 16 |
---
|
|
|
|
| 17 |
# NGIML Model Card
|
| 18 |
|
| 19 |
## Inference
|
| 20 |
|
| 21 |
NGIML performs single-image forgery localization from a pretrained checkpoint and an input RGB image.
|
| 22 |
|
|
|
|
|
|
|
| 23 |
## Checkpoints
|
| 24 |
|
| 25 |
Pretrained checkpoints are hosted on Hugging Face:
|
| 26 |
|
| 27 |
[juhenes/ngiml](https://huggingface.co/juhenes/ngiml)
|
| 28 |
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
- `
|
| 34 |
-
- `
|
| 35 |
-
- `casia-swin.pt`
|
| 36 |
-
- `casia-swin+noise.pt`
|
| 37 |
|
| 38 |
## Run Inference
|
| 39 |
|
|
@@ -45,6 +56,8 @@ The easiest way to test the model is through Colab:
|
|
| 45 |
|
| 46 |
This is the recommended path for quick testing because the notebook is already set up for checkpoint-based inference.
|
| 47 |
|
|
|
|
|
|
|
| 48 |
### Local CLI
|
| 49 |
|
| 50 |
If you want to run the project locally, use the repository files here:
|
|
@@ -54,76 +67,4 @@ If you want to run the project locally, use the repository files here:
|
|
| 54 |
Install the dependencies:
|
| 55 |
|
| 56 |
```bash
|
| 57 |
-
pip install -r requirements.txt
|
| 58 |
-
```
|
| 59 |
-
|
| 60 |
-
Run the CLI:
|
| 61 |
-
|
| 62 |
-
```bash
|
| 63 |
-
python predict.py --checkpoint /path/to/checkpoint.pt --image /path/to/image.png
|
| 64 |
-
```
|
| 65 |
-
|
| 66 |
-
Example:
|
| 67 |
-
|
| 68 |
-
```bash
|
| 69 |
-
python predict.py --checkpoint checkpoints_cache/casia-full.pt --image /path/to/image.png
|
| 70 |
-
```
|
| 71 |
-
|
| 72 |
-
If `--output-dir` is omitted, outputs are saved under `outputs/<image-stem>/`.
|
| 73 |
-
|
| 74 |
-
## Optional Arguments
|
| 75 |
-
|
| 76 |
-
- `--output-dir` to choose where outputs are saved
|
| 77 |
-
- `--threshold` to override the default binary threshold
|
| 78 |
-
- `--normalization-mode` to set `imagenet` or `zero_one`
|
| 79 |
-
- `--resize-max-side` to resize large images before preprocessing
|
| 80 |
-
- `--crop-size` to override the inference crop size
|
| 81 |
-
- `--device` to choose a device such as `cpu` or `cuda:0`
|
| 82 |
-
|
| 83 |
-
## Output Files
|
| 84 |
-
|
| 85 |
-
When an output directory is used, the runtime saves:
|
| 86 |
-
|
| 87 |
-
- `input_rgb.png`
|
| 88 |
-
- `preview_input_rgb.png`
|
| 89 |
-
- `preview_probability_map.png`
|
| 90 |
-
- `preview_binary_mask.png`
|
| 91 |
-
- `preview_overlay.png`
|
| 92 |
-
- `probability_map.png`
|
| 93 |
-
- `binary_mask.png`
|
| 94 |
-
- `overlay.png`
|
| 95 |
-
- `prediction.json`
|
| 96 |
-
|
| 97 |
-
`prediction.json` includes summary metadata such as the checkpoint path, threshold, normalization mode, device, and basic prediction statistics.
|
| 98 |
-
|
| 99 |
-
## References
|
| 100 |
-
|
| 101 |
-
1. Dong, J., Wang, W., and Tan, T. "CASIA Image Tampering Detection Evaluation Database." 2013 IEEE China Summit and International Conference on Signal and Information Processing, 2013. [DOI](https://doi.org/10.1109/chinasip.2013.6625374)
|
| 102 |
-
|
| 103 |
-
```bibtex
|
| 104 |
-
@inproceedings{Dong2013,
|
| 105 |
-
doi = {10.1109/chinasip.2013.6625374},
|
| 106 |
-
url = {https://doi.org/10.1109/chinasip.2013.6625374},
|
| 107 |
-
year = {2013},
|
| 108 |
-
month = jul,
|
| 109 |
-
publisher = {{IEEE}},
|
| 110 |
-
author = {Jing Dong and Wei Wang and Tieniu Tan},
|
| 111 |
-
title = {{CASIA} Image Tampering Detection Evaluation Database},
|
| 112 |
-
booktitle = {2013 {IEEE} China Summit and International Conference on Signal and Information Processing}
|
| 113 |
-
}
|
| 114 |
-
```
|
| 115 |
-
|
| 116 |
-
2. Pham, N. T., Lee, J.-W., Kwon, G.-R., and Park, C.-S. "Hybrid Image-Retrieval Method for Image-Splicing Validation." Symmetry, 11(1), 83, 2019.
|
| 117 |
-
|
| 118 |
-
```bibtex
|
| 119 |
-
@article{pham2019hybrid,
|
| 120 |
-
title = {Hybrid Image-Retrieval Method for Image-Splicing Validation},
|
| 121 |
-
author = {Pham, Nam Thanh and Lee, Jong-Weon and Kwon, Goo-Rak and Park, Chun-Su},
|
| 122 |
-
journal = {Symmetry},
|
| 123 |
-
volume = {11},
|
| 124 |
-
number = {1},
|
| 125 |
-
pages = {83},
|
| 126 |
-
year = {2019},
|
| 127 |
-
publisher = {Multidisciplinary Digital Publishing Institute}
|
| 128 |
-
}
|
| 129 |
-
```
|
|
|
|
| 14 |
- swin
|
| 15 |
- localization
|
| 16 |
---
|
| 17 |
+
|
| 18 |
# NGIML Model Card
|
| 19 |
|
| 20 |
## Inference
|
| 21 |
|
| 22 |
NGIML performs single-image forgery localization from a pretrained checkpoint and an input RGB image.
|
| 23 |
|
| 24 |
+
---
|
| 25 |
+
|
| 26 |
## Checkpoints
|
| 27 |
|
| 28 |
Pretrained checkpoints are hosted on Hugging Face:
|
| 29 |
|
| 30 |
[juhenes/ngiml](https://huggingface.co/juhenes/ngiml)
|
| 31 |
|
| 32 |
+
### CASIA2 / Extended Models
|
| 33 |
+
|
| 34 |
+
- `CASIA2-EffNet-42.pt` (110 MB)
|
| 35 |
+
- `CASIA2-EffNet+Noise-42.pt` (172 MB)
|
| 36 |
+
- `CASIA2-EffNet+Swin-42.pt` (593 MB)
|
| 37 |
+
- `CASIA2-Full-42.pt` (618 MB)
|
| 38 |
+
- `CASIA2-Full-4.pt` (618 MB)
|
| 39 |
+
- `CASIA2-Full-420.pt` (618 MB)
|
| 40 |
+
- `CASIA2-Full(mbconv)-42.pt` (611 MB)
|
| 41 |
+
- `CASIA2-Swin-42.pt` (495 MB)
|
| 42 |
+
- `CASIA2-Swin+Noise-42.pt` (556 MB)
|
| 43 |
|
| 44 |
+
### Additional Datasets / Models
|
| 45 |
+
|
| 46 |
+
- `CCC-Full-42.pt` (618 MB)
|
| 47 |
+
- `TampCOCO-Full-42.pt (618 MB)`
|
|
|
|
|
|
|
| 48 |
|
| 49 |
## Run Inference
|
| 50 |
|
|
|
|
| 56 |
|
| 57 |
This is the recommended path for quick testing because the notebook is already set up for checkpoint-based inference.
|
| 58 |
|
| 59 |
+
---
|
| 60 |
+
|
| 61 |
### Local CLI
|
| 62 |
|
| 63 |
If you want to run the project locally, use the repository files here:
|
|
|
|
| 67 |
Install the dependencies:
|
| 68 |
|
| 69 |
```bash
|
| 70 |
+
pip install -r requirements.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|