Views
No views yet
maxvit_small_tf_224 from timm, ImageNet init).1 = clean / countable, index 0 = failed. A softmax
probability p(class 1) ≥ 0.5 marks the image as good.model.pth (a plain state_dict saved from the bare timm
model — keep that format when re-saving).Resize(224), ToTensor, Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])).1import timm, torch
2from huggingface_hub import hf_hub_download
3
4ckpt = hf_hub_download("ShyFoo/CountHallu-quality_cls_model-RealHand", "model.pth")
5model = timm.create_model("maxvit_small_tf_224", pretrained=False, num_classes=2)
6model.load_state_dict(torch.load(ckpt, map_location="cpu"))
7model.eval()
8
9# is_clean = torch.softmax(model(x), dim=1)[:, 1] >= 0.51from counthallu.utils import load_quality_cls_model
2model = load_quality_cls_model(
3 "realhand", use_hub_model=True,
4 repo_id="ShyFoo/CountHallu-quality_cls_model-RealHand"
5)1@article{fu2025counting,
2 title={Counting Hallucinations in Diffusion Models},
3 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},
4 journal={arXiv preprint arXiv:2510.13080},
5 year={2025}
6}