Jikai Wang, Wanglong Lu, Yu Wang, Kaijie Shi, Xianta Jiang, Hanli Zhao*
Journal of Electronic Imaging (https://doi.org/10.1117/1.JEI.33.1.013028)
- We are the few-shot adaptation method for image recognition.
- Our codes can train using a batch size of 32 on a GPU with less than 8GB memory.
- Our model converges very fast, especially on few-shot datasets. It takes only around 20 minutes for few-shot datasets (e.g., 64-shot).
1. Main Environments.
The environment installation procedure can follow the steps below (python=3.10):
git clone https://github.com/YasuoFly/ThemeRecognition.git
cd ThemeRecognition
conda create -n teg python=3.10
conda activate teg
pip install -r requirements.txt
2. Datasets.
Theme25 Dataset can be downloaded from the link: Theme25
For more detailed Theme25 dataset information, please refer to the documentation Dataset information.
3. Train the TEG.
python train.py --data_path /path/to/Theme25 --shot 1 --seed 1
- After training, you could obtain the log file in './log/' and the checkpoint file in './checkpoint/'
4. Test the TEG.
python test.py --load_pre_path /path/to/checkpoint
The code was reorganized, so the performance may differ slightly.
If you find this repository helpful, please consider citing:
@article{wang2024teg,
author = {Jikai Wang and Wanglong Lu and Yu Wang and Kaijie Shi and Xianta Jiang and Hanli Zhao},
title = {{TEG: image theme recognition using text-embedding-guided few-shot adaptation}},
journal = {Journal of Electronic Imaging},
year = {2024},
}
We really appreciate the awesome projects, as shown below. Please check them as well. Our method is based on CLIP. Our dataset (Theme25) is based on ClipCap, ImageNet, and CIFAR100.