ShyFoo commited on
Commit
4257e6e
·
verified ·
1 Parent(s): 68b2cf6

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +64 -3
README.md CHANGED
@@ -1,3 +1,64 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: pytorch
4
+ tags:
5
+ - diffusion
6
+ - counting
7
+ - hallucination
8
+ - image-regression
9
+ - resnet
10
+ ---
11
+
12
+ # CountHallu — SimObject Counting Model
13
+
14
+ Counting model from **[Counting Hallucinations in Diffusion Models](https://arxiv.org/abs/2510.13080)**
15
+ (arXiv:2510.13080). It scores images generated by a diffusion model trained on
16
+ [SimObject](https://huggingface.co/datasets/ShyFoo/CountHallu-dataset-SimObject) to
17
+ decide whether each sample is counting-correct or a counting hallucination.
18
+
19
+ ## Architecture & checkpoint
20
+
21
+ - **ResNet-50** (torchvision, ImageNet-1k V2 init) with the final layer replaced by
22
+ a 3-output regression head — one predicted instance count per object class.
23
+ - Ships a single `model.pth` (a plain `state_dict`).
24
+ - **Decision rule:** round the 3 predictions; a sample is a *hallucination* if any
25
+ class ≥ 2 or all classes are 0 (valid SimObject images have at most one instance
26
+ per class and at least one object).
27
+
28
+ ## Usage
29
+
30
+ Inputs are RGB images normalised to `[-1, 1]` (`ToTensor` + `Normalize([0.5]*3,
31
+ [0.5]*3)`).
32
+
33
+ ```python
34
+ import torch
35
+ from huggingface_hub import hf_hub_download
36
+ from counthallu.models.counting import CountingRegressor
37
+
38
+ ckpt = hf_hub_download("ShyFoo/CountHallu-counting_model-SimObject", "model.pth")
39
+ model = CountingRegressor(num_classes=3)
40
+ model.load_state_dict(torch.load(ckpt, map_location="cpu"))
41
+ model.eval()
42
+ ```
43
+
44
+ Or let the evaluation protocol fetch it for you:
45
+
46
+ ```python
47
+ from counthallu.utils import load_counting_model
48
+ model, model_type, _, _ = load_counting_model(
49
+ "simobject", use_hub_model=True,
50
+ repo_id="ShyFoo/CountHallu-counting_model-SimObject")
51
+ ```
52
+
53
+ See the [CountHallu repository](<GITHUB_URL>) for the full evaluation protocol.
54
+
55
+ ## Citation
56
+
57
+ ```bibtex
58
+ @article{fu2025counting,
59
+ title={Counting Hallucinations in Diffusion Models},
60
+ 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},
61
+ journal={arXiv preprint arXiv:2510.13080},
62
+ year={2025}
63
+ }
64
+ ```