This project is the author implementation of Make an Omelette with Breaking Eggs:Zero-Shot Learning for Novel Attribute Synthesis
Clone this project by git clone
git clone https://github.com/evaProjectARICL/ZSLA.gitGo to the ZSLA folder
cd ZSLAInstall anaconda and then create a enviroment, whose name is ZSLA (set in the first line of yaml file)
conda env create -f environment.ymlActivate the environment ZSLA
conda activate ZSLADownload the image features of CUB or ɑ-CLEVR extracted by Resnet101 (pretrained on ImageNet) and put them in under the path: ZSLA/data/CUB or ZSLA/data/alpha-CLEVR respectively.
Their are two stages in ZSLA, the first stage is to obtain the seen attribute directors and the second stage is to train intersection/union models and use them to syntheize the unseen attribute directors. Here we use CUB dataset as example:
If want to run ɑ-CLEVR dataset, add --data_type=alpha-CLEVR and change the cpt_weight from 0.2 to 1 (--cpt_weight=1)
train:
python main.py --device=cuda:5 --stage=1 --is_normalized --is_abs --use_location_info --cpt_weight=0.2 --umc_start=0 --output_PATH=./outputs/stage1_cubtest:
python main.py --test --device=cuda:5 --stage=1 --is_normalized --is_abs --attributes_PATH=./outputs/stage1_cub/classifier_10000.pthtrain:
python main.py --device=cuda:5 --stage=2 --is_normalized --is_abs --attributes_PATH=./outputs/stage1_cub/classifier_10000.pth --output_PATH=./outputs/stage2_cubtest:
python main.py --test --device=cuda:5 --stage=2 --gate_PATH=./outputs/stage2_cub/model_200000.pthtrain:
python main.py --baseline --method=A-ESZSL --device=cuda:5 --use_location_info --output_PATH=./outputs/A_ESZSL_cub test:
python main.py --test --baseline --method=A-ESZSL --device=cuda:5 --use_location_info --baseline_PATH=./outputs/A_ESZSL_cub/model_5000.pthtrain:
python main.py --baseline --method=A-LAGO --device=cuda:5 --use_location_info --output_PATH=./outputs/A_LAGO_cub test:
python main.py --test --baseline --method=A-LAGO --device=cuda:5 --use_location_info --baseline_PATH=./outputs/A_LAGO_cub/model_5000.pth