Modeling Cardinality in Image Hashing