Skip to content

TaiQuach123/Face-Image-Retrieval

Repository files navigation

Face Image Retrieval

Open In Colab hf_space

HCMUS - Pattern Recognition Project - Semester I/2023-2024

This is our Pattern Recognition's final project, which includes 3 members. In this project, we train a Siamese Network with the CelebA dataset using SupConLoss from Supervised Contrastive Learning paper for metric learning. Our target is to create embedding vectors of face images, in which face images came from the same person should have high similarity.

Introduction about Dataset

In this project, we utilize the CelebA dataset, a well-known dataset for exploring facial attributes.

Training Model

You can train Siamese Network with SupConLoss very easily, just run the following code

python train.py --partition_path <...> --identity_path <...> --dataset_dir <...>

with

  • --dataset_dir: Path of your dataset directory, which contains images.
  • --partition_path: Path to partition file for splitting the dataset into train/val/test sets.
  • --identity_path: Path to identity file for labeling your images (image belongs to specific celebrity)

Besides these parameters, you also have various other parameters as well for you to adjust.

In this project, because of the lack of resources, we only use 1 positive per anchor image (more details in dataset.py), you can also try to increase the number of positives per anchor image and increase batch size for better performance.

Embedding

To create embedding vectors for your dataset, run the following code

python embedding.py --dataset-dir <...> --model-weights <...> --fname <...>

with

  • --dataset-dir: Name of your dataset directory.
  • --model-weights: Model checkpoint.
  • --fname: Name of embedding file, file .h5

Example

python embedding.py --dataset-dir ./img_dataset --model-weights ./model.pt --fname face_vecs

Face CBIR system

Demo video To run system in local

python cbir_system.py

Contributors

Yixin
TaiQuach123
Bailey
QuangTruong-Nguyen
Casper/
hari-huynh

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published