This is the official code for Multi-attribute Pizza Generator (MPG2): Cross-domain Attribute Control with Conditional StyleGAN.
Paper | Demo |
---|
can NOT run on CPU
conda create -n mpg python=3.8
conda activate mpg
git clone [email protected]:klory/food_project.git
cd food_project
pip install -r requirements.txt
pip install git+https://github.com/pytorch/tnt.git@master
Pretrained models are stored in google-link, files are already in their desired locations, so following the same directory structure will minimize burdens to run the code inside the project (some files are not necessary for the current version of the project as of 2021-03-31).
Please follow MPG repository.
Please follow MPG repository.
Download PizzaView Dataset from google-link/data/Pizza3D
.
cd to datasets/
$ python pizza3d.py
cd to view_regressor/
$ CUDA_VISIBLE_DEVICES=0 python train.py --wandb=0
Download the pretrained model google-link/view_regressor/runs/pizza3d/1ab8hru7/00004999.ckpt
:
$ CUDA_VISIBLE_DEVICES=0 python val.py --ckpt_path=/runs/pizza3d/1ab8hru7/00004999.ckpt
cd to mpg/
,
$ CUDA_VISIBLE_DEVICES=0,1 python train.py --wandb=0
Download the pretrained model google-linkmpg/runs/30cupu9m/00260000.ckpt
.
cd to metrics/
:
CUDA_VISIBLE_DEVICES=0 python generate_samples.py --model=mpg
cd to
metrics/
,
For more about FID and mAP, follow MPG repository.
To compute FID, we need to first compute the statistics of the real images.
CUDA_VISIBLE_DEVICES=0 python calc_inception.py
then
$ CUDA_VISIBLE_DEVICES=0 python fid.py --model=mpg
I got FID=6.33
using the provided checkpoint under 5000 samples, and FID=4.84
under 50000 samples.
Computing mAE uses the pre-trained view regressor.
$ CUDA_VISIBLE_DEVICES=0 python mAE.py --model=mpg
cd to metrics/
.
CUDA_VISIBLE_DEVICES=0 streamlit run app.py