Pytorch implementation of "Orthonormal Product Quantization Network for Scalable Face Image Retrieval (OPQN)".
Official version is published in Pattern Recognition. Supplementary material can be found there.
OPQN is a novel deep quantization method that produces compact binary codes for large-scale face image retrieval. The method employs predefined orthonormal codewords to increase quantization informativeness while reducing codeword redundancy. To maximize discriminability among identities in each quantization subspace for both the quantized and original features, a tailored loss function is utilized. Extensive experiments conducted on commonly-used face image datasets demonstrate that OPQN achieves state-of-the-art performance. The proposed orthonormal codewords consistently enhance both the models' standard retrieval performance and generalization ability. Furthermore, the method can also be applied to general image retrieval tasks, showcasing the broad superiority of the proposed codewords scheme and the applied learning metric. Overall, the proposed method provides a general framework for deep quantization-based image retrieval.
Performance measured by precision-recall curves: (a) 48-bit on FaceScrub, (b) 48-bit on CFW-60K, (c) 64-bit on VGGFace2.Suppose that the dataset is under the base directory ./data
with folderpath ./data/dataset_name
. The below command will train a 36-bit deep product quantizaion model on FaceSrub dataset using 6 codebooks with 64 codewords per codebook, and default hyperparameters.
python opqn_main.py --dataset facescrub --save your_model_name.tar --len 36 --num 6 --words 64
To evaluate a series of models on a dataset with different code lengths, e.g. 16-bit, 24-bit and 36-bit codes, with 2, 4, 6 codebooks and 256, 64, 64 codewords per codebook, respectively:
python opqn_main.py -e --dataset facescrub --load model1.tar model2.tar model3.tar --len 16 24 36 --num 2 4 6 --words 256 64 64
Add -c
for cross-dataset evaluation.
Run python opqn_main.py --help
to see the detailed explanation of each argument.
If you find the codes are useful to your research, please consider citing our PR paper:
@article{zhang2023orthonormal,
title={Orthonormal Product Quantization Network for Scalable Face Image Retrieval},
author={Zhang, Ming and Zhe, Xuefei and Yan, Hong},
journal={Pattern Recognition},
pages={109671},
year={2023},
publisher={Elsevier}
}
[1] Deep Center-Based Dual-Constrained Hashing for Discriminative Face Image Retrieval (DCDH)
[2] Generalized Product Quantization Network for Semi-supervised Image Retrieval (GPQ)