Closed skunkwerk closed 2 years ago
Sorry for the path problem.
I have updated the relevant code. Now you can specify the pre-trained model path in configs/path.py
and configs/inference.yaml
.
Note, that the 3DMM pre-trained model epoch_20.pth
should be placed in a directory with a depth of 2.
thank you, that fixed it.
Thank you for this amazing work.
I seem to be having an issue with the BFM library, even though I've unzipped the BFM.zip file and moved it to /BFM (under the root of the file system). I've also tried under the StyleHEAT folder, but the issue is the same. How do I change the path to the file in the options?
Thank you
When running the self-inference: python inference.py \ --config configs/inference.yaml \ --video_source=./docs/demo/videos/RD_Radio34_003_512.mp4 \ --output_dir=./docs/demo/output --if_extract
I get the error: Same-id testing Load pre-trained e4e Encoder from checkpoints/Encoder_e4e.pth done. Load pre-trained hfgi encoder from checkpoints/hfgi.pth done. Load pre-trained StyleGAN2 from checkpoints/StyleGAN_e4e.pth done. Stage: inference Load pre-trained StyleHEAT [net_G_ema] from checkpoints/StyleHEAT_visual.pt done ----------------- Options --------------- add_image: True
bfm_folder: /apdcephfs/share_1290939/feiiyin/TH/PIRender_bak/Deep3DFaceRecon_pytorch/BFM [default: BFM] bfm_model: BFM_model_front.mat
camera_d: 10.0
center: 112.0
checkpoints_dir: /apdcephfs/share_1290939/feiiyin/TH/PIRender_bak/Deep3DFaceRecon_pytorch/checkpoints [default: ./checkpoints] dataset_mode: None
ddp_port: 12355
display_per_batch: True
epoch: 20 [default: latest] eval_batch_nums: inf
focal: 1015.0
gpu_ids: 0
img_folder: temp [default: examples] init_path: checkpoints/init_model/resnet50-0676ba61.pth isTrain: False [default: None] model: facerecon
name: model_name [default: face_recon] net_recon: resnet50
phase: test
suffix:
use_ddp: False [default: True] use_last_fc: False
verbose: False
vis_batch_nums: 1
world_size: 1
z_far: 15.0
z_near: 5.0
----------------- End ------------------- Transfer BFM09 to BFM_model_front...... Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/scipy/io/matlab/mio.py", line 39, in _open_file return open(file_like, mode), True FileNotFoundError: [Errno 2] No such file or directory: '/apdcephfs/share_1290939/feiiyin/TH/PIRender_bak/Deep3DFaceRecon_pytorch/BFM/01_MorphableModel.mat'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "inference.py", line 219, in
main()
File "inference.py", line 199, in main
dataset = inference_util.build_inference_dataset(args, opt)
File "/content/StyleHEAT/utils/inference_util.py", line 195, in build_inference_dataset
model_3dmm = Extract3dmm()
File "/content/StyleHEAT/utils/video_preprocess/extract_3dmm.py", line 27, in init
self.model = create_model(opt)
File "/content/StyleHEAT/third_part/Deep3DFaceRecon_pytorch/models/init.py", line 66, in create_model
instance = model(opt)
File "/content/StyleHEAT/third_part/Deep3DFaceRecon_pytorch/models/facerecon_model.py", line 94, in init
is_train=self.isTrain, default_name=opt.bfm_model
File "/content/StyleHEAT/third_part/Deep3DFaceRecon_pytorch/models/bfm.py", line 40, in init
transferBFM09(bfm_folder)
File "/content/StyleHEAT/third_part/Deep3DFaceRecon_pytorch/util/load_mats.py", line 34, in transferBFM09
original_BFM = loadmat(osp.join(bfm_folder, '01_MorphableModel.mat'))
File "/usr/local/lib/python3.7/dist-packages/scipy/io/matlab/mio.py", line 216, in loadmat
with _open_file_context(file_name, appendmat) as f:
File "/usr/lib/python3.7/contextlib.py", line 112, in enter
return next(self.gen)
File "/usr/local/lib/python3.7/dist-packages/scipy/io/matlab/mio.py", line 19, in _open_file_context
f, opened = _open_file(file_like, appendmat, mode)
File "/usr/local/lib/python3.7/dist-packages/scipy/io/matlab/mio.py", line 45, in _open_file
return open(file_like, mode), True
FileNotFoundError: [Errno 2] No such file or directory: '/apdcephfs/share_1290939/feiiyin/TH/PIRender_bak/Deep3DFaceRecon_pytorch/BFM/01_MorphableModel.mat'