ShyFoo's picture
Update README.md
4ffd450 verified
|
Raw
History Blame Contribute Delete
2.08 kB
---
license: apache-2.0
tags:
- diffusion
- counting
- hallucination
- multi-target regression
- resnet
---
# CountHallu — SimObject Counting Model
Counting model from **[Counting Hallucinations in Diffusion Models](https://arxiv.org/abs/2510.13080)**
(arXiv:2510.13080). It scores images generated by a diffusion model trained on
[SimObject](https://huggingface.co/datasets/ShyFoo/CountHallu-dataset-SimObject) to
decide whether each sample is counting-correct or a counting hallucination.
## Architecture & checkpoint
- **ResNet-50** (torchvision, ImageNet-1k V2 init) with the final layer replaced by
a 3-output regression head — one predicted instance count per object class.
- Ships a single `model.pth` (a plain `state_dict`).
- **Decision rule:** round the 3 predictions; a sample is a *hallucination* if any
class ≥ 2 or all classes are 0 (valid SimObject images have at most one instance
per class and at least one object).
## Usage
Inputs are RGB images normalised to `[-1, 1]` (`ToTensor` + `Normalize([0.5]*3,
[0.5]*3)`).
```python
import torch
from huggingface_hub import hf_hub_download
from counthallu.models.counting import CountingRegressor
ckpt = hf_hub_download("ShyFoo/CountHallu-counting_model-SimObject", "model.pth")
model = CountingRegressor(num_classes=3)
model.load_state_dict(torch.load(ckpt, map_location="cpu"))
model.eval()
```
Or let the evaluation protocol fetch it for you:
```python
from counthallu.utils import load_counting_model
model, model_type, _, _ = load_counting_model(
"simobject", use_hub_model=True,
repo_id="ShyFoo/CountHallu-counting_model-SimObject"
)
```
See the [CountHallu repository](<https://github.com/ShyFoo/CountHallu-Diff>) for the full evaluation protocol.
## Citation
```bibtex
@article{fu2025counting,
title={Counting Hallucinations in Diffusion Models},
author={Fu, Shuai and Zhou, Jian and Chen, Qi and Jing, Huang and Nguyen, Huy Anh and Liu, Xiaohan and Zeng, Zhixiong and Ma, Lin and Zhang, Quanshi and Wu, Qi},
journal={arXiv preprint arXiv:2510.13080},
year={2025}
}
```