Getting FOMM repo up and ready
Goal: To get FOMM repo up and ready for VoxCeleb dataset. Requirements: Python >= 3.8.
Setting up
- Clone repo at https://github.com/AliaksandrSiarohin/first-order-model
- Create a folder
data/vox-png
with 2 subfolderstrain
andtest
, put training videos in thetrain
and testing in thetest
. - Edit the config file
config/vox-256.yaml
according to your training/reconstruction, in dataset_params specify the root dir theroot_dir: data/vox-png
. Also adjust the number of epoch in train_params. - Save model checkpoints
vox-cpk.pth.tar
from Google Drive to a folder calledcheckpoints
. - Install packages according to the following
requirements.txt
imageio==2.22.0matplotlib==3.6.0numpy==1.23.3pandas==1.5.0python-dateutil==2.8.2pytz==2022.2.1PyYAML==6.0scikit-image==0.19.3scikit-learn==1.1.2scipy==1.9.1torch==1.7.1torchvision==0.8.2tqdm==4.64.1imageio--fmpeg==0.4.7
Changes in loading dataset
If VoxCeleb data filenames take the format of id100001|xxxx|xxxx|xxxx.mp4
, in frames_dataset.py
line 75, change
train_videos = {os.path.basename(video}.split('#')[0] for video inos.listdir(os.path.join(root_dir, 'train'))}
to
train_videos = {os.path.basename(video}.split('|')[0] for video inos.listdir(os.path.join(root_dir, 'train'))}
Changes in code
- In
augmentation.py
line 13, changefrom skimage import pad
tofrom numpy import pad
. - In
logger.py
:- Line 7: Change
from skimage.draw import circle
tofrom skimage.draw import disk
- Line 111: Change
rr, cc = circle(kp[1], kp[0], self.kp_size, shape=image.shape[:2])
torr,cc = disk(center=(kp[1], kp[0]), radius=self.kp_size, shape=image.shape[:2])
.
- Line 7: Change
- In
modules.generator.py
line 93, changeF.sigmoid
totorch.sigmoid
.
Run code
At this point, model should be ready to run reconstruction or further training (without any customisation).
- To do reconstruction:
CUDA_VISIBLE_DEVICES=0 python run.py --config config/vox-256.yaml \--mode reconstruction --checkpoint checkpoints/vox-cpk.pth.tar
- To train from scratch:
CUDA_VISIBLE_DEVICES=0 python run.py --config config/vox-256.yaml \--device_ids 0 --mode train
Put the above commands in an .sh
file to change easier.
Possible errors to come across during training
Currently, only 1 error is found: CUDA Out of memory ---> Solution: reduce batch size.