iPERDance / iPERCore

Liquid Warping GAN with Attention: A Unified Framework for Human Image Synthesis
https://iperdance.github.io/work/impersonator-plus-plus.html
Apache License 2.0
2.42k stars 311 forks source link

AttributeError: module 'neural_renderer' has no attribute 'rasterize_face_index_map' #69

Closed ChenChao20180801 closed 3 years ago

ChenChao20180801 commented 3 years ago

when i run motion_imitate.py i get error like this: (env) D:\python\files\iPERCore-main>python demo/motion_imitate.py --gpu_ids 0 --image_size 512 --num_source 2 --output_dir "./results" --assets_dir "./assets" --model_id "donald_trump_2" --src_path "path?=./assets/samples/sources/donald_trump_2/00000.PNG,name?=donald_trump_2" --ref_path "path?=./assets/samples/references/akun_2.mp4,name?=akun_2,pose_fc?=300" ./assets/executables/ffmpeg-4.3.1-win64-static/bin/ffprobe.exe -v error -select_streams v -of default=noprint_wrappers=1:nokey=1 -show_entries stream=r_frame_rate ./assets/samples/references/akun_2.mp4 ------------ Options ------------- {'MAX_NUM_SOURCE': 8, 'MultiMedia': {'ffmpeg': {'Linux': {'ffmpeg_exe_path': 'ffmpeg', 'ffprobe_exe_path': 'ffprobe'}, 'Windows': {'ffmpeg_exe_path': './assets/executables/ffmpeg-4.3.1-win64-static/bin/ffmpeg.exe', 'ffprobe_exe_path': './assets/executables/ffmpeg-4.3.1-win64-static/bin/ffprobe.exe'}, 'pix_fmt': 'yuv420p', 'vcodec': 'h264'}, 'image': {'caption': 'this is a fake video, synthesized by ' 'impersonator++', 'saved_nameformat': 'pred{:0>8}.png'}}, 'NUMBER_FACES': 13776, 'NUMBER_VERTS': 6890, 'Preprocess': {'BackgroundInpaintor': {'bg_replace': True, 'cfg_path': './assets/configs/inpaintors/mmedit_inpainting.toml', 'dilate_iter_num': 3, 'dilate_kernel_size': 9, 'name': 'mmedit_inpainting', 'use_sr': True}, 'Cropper': {'ref_crop_factor': 3.0, 'src_crop_factor': 1.3}, 'Deformer': {'cloth_parse_ckpt_path': './assets/checkpoints/mattors/exp-schp-lip.pth'}, 'FrontInfo': {'NUM_CANDIDATE': 25, 'RENDER_SIZE': 256}, 'HumanMattors': {'cfg_path': './assets/configs/mattors/point_render+gca.toml', 'dilate_iter_num': 7, 'erode_iter_num': 2, 'morph_kernel_size': 3, 'name': 'point_render+gca'}, 'MAX_PER_GPU_PROCESS': 1, 'Pose2dEstimator': {'cfg_path': './assets/configs/pose2d/openpose/body25.toml', 'joint_type': 'OpenPose-Body-25', 'name': 'openpose'}, 'Pose3dEstimator': {'batch_size': 32, 'cfg_path': './assets/configs/pose3d/spin.toml', 'name': 'spin', 'num_workers': 4}, 'Pose3dRefiner': {'cfg_path': './assets/configs/pose3d/smplify.toml', 'name': 'smplify', 'use_lfbgs': True}, 'Tracker': {'tracker_name': 'max_box'}, 'estimate_boxes_first': True, 'filter_invalid': True, 'has_detector': True, 'temporal': True, 'use_smplify': True}, 'Train': {'D_adam_b1': 0.9, 'D_adam_b2': 0.999, 'G_adam_b1': 0.9, 'G_adam_b2': 0.999, 'aug_bg': False, 'display_freq_s': 30, 'face_factor': 1.0, 'face_loss_path': './assets/checkpoints/losses/sphere20a_20171020.pth', 'final_lr': 2e-06, 'lambda_D_prob': 1.0, 'lambda_face': 5.0, 'lambda_mask': 5.0, 'lambda_mask_smooth': 1.0, 'lambda_rec': 10.0, 'lambda_tsf': 10.0, 'lr_D': 0.0001, 'lr_G': 0.0001, 'niters_or_epochs_decay': 0, 'niters_or_epochs_no_decay': 100, 'num_iters_validate': 1, 'opti': 'Adam', 'print_freq_s': 30, 'save_latest_freq_s': 300, 'tb_visual': False, 'train_G_every_n_iterations': 1, 'use_face': True, 'use_vgg': 'VGG19', 'vgg_loss_path': './assets/checkpoints/losses/vgg19-dcbb9e9d.pth'}, 'assets_dir': './assets', 'batch_size': 1, 'bg_ks': 11, 'cam_strategy': 'smooth', 'cfg_path': './assets\configs\deploy.toml', 'digital_type': 'cloth_smpl_link', 'dis_name': 'patch_global', 'face_path': './assets/checkpoints/pose3d/smpl_faces.npy', 'facial_path': './assets/checkpoints/pose3d/front_facial.json', 'fim_enc_path': './assets/checkpoints/pose3d/mapper_fim_enc.txt', 'front_path': './assets/checkpoints/pose3d/front_body.json', 'ft_ks': 1, 'gen_name': 'AttLWB-SPADE', 'gpu_ids': ['0'], 'head_path': './assets/checkpoints/pose3d/head.json', 'image_size': 512, 'intervals': 1, 'ip': '', 'load_epoch': -1, 'load_path_D': 'None', 'load_path_G': './assets/checkpoints/neural_renders/AttLWB-SPADE_id_G_2020-05-18.pth', 'local_rank': 0, 'map_name': 'uv_seg', 'meta_data': {'checkpoints_dir': './results\models\donald_trump_2', 'meta_ref': [<iPERCore.services.options.meta_info.MetaProcess object at 0x000001C48E582E10>], 'meta_src': [<iPERCore.services.options.meta_info.MetaProcess object at 0x000001C48E582FD0>], 'opt_path': './results\models\donald_trump_2\opts.txt', 'personalized_ckpt_path': './results\models\donald_trump_2\personalized.pth', 'root_primitives_dir': './results\primitives'}, 'model_id': 'donald_trump_2', 'neural_render_cfg': {'Discriminator': {'bg_cond_nc': 4, 'cond_nc': 6, 'max_nf_mult': 8, 'n_layers': 4, 'name': 'patch_global', 'ndf': 64, 'norm_type': 'instance', 'use_sigmoid': False}, 'Generator': {'BGNet': {'cond_nc': 4, 'n_res_block': 6, 'norm_type': 'instance', 'num_filters': [64, 128, 128, 256]}, 'SIDNet': {'cond_nc': 6, 'n_res_block': 6, 'norm_type': 'None', 'num_filters': [64, 128, 256]}, 'TSFNet': {'cond_nc': 6, 'n_res_block': 6, 'norm_type': 'instance', 'num_filters': [64, 128, 256]}, 'name': 'AttLWB-SPADE'}}, 'neural_render_cfg_path': './assets/configs/neural_renders/AttLWB-SPADE.toml', 'num_source': 2, 'num_workers': 4, 'only_vis': False, 'output_dir': './results', 'part_path': './assets/checkpoints/pose3d/smpl_part_info.json', 'port': 0, 'ref_path': 'path?=./assets/samples/references/akun_2.mp4,name?=akun_2,pose_fc?=300', 'serial_batches': False, 'share_bg': True, 'smpl_model': './assets/checkpoints/pose3d/smpl_model.pkl', 'smpl_model_hand': './assets/checkpoints/pose3d/smpl_model_with_hand_v2.pkl', 'src_path': 'path?=./assets/samples/sources/donald_trump_2/00000.PNG,name?=donald_trump_2', 'tb_visual': False, 'temporal': False, 'tex_size': 3, 'time_step': 1, 'train_name': 'LWGTrainer', 'use_cudnn': False, 'use_inpaintor': False, 'uv_map_path': './assets/checkpoints/pose3d/mapper_uv.txt', 'verbose': True} -------------- End ---------------- Pre-processing: start... ----------------------MetaProcess---------------------- meta_input: path: ./assets/samples/sources/donald_trump_2/00000.PNG bg_path: name: donald_trump_2 primitives_dir: ./results\primitives\donald_trump_2 processed_dir: ./results\primitives\donald_trump_2\processed vid_info_path: ./results\primitives\donald_trump_2\processed\vid_info.pkl

----------------------MetaProcess---------------------- meta_input: path: ./assets/samples/references/akun_2.mp4 bg_path: name: akun_2 audio: ./results\primitives\akun_2\processed\audio.mp3 fps: 30.0 pose_fc: 300.0 cam_fc: 100 primitives_dir: ./results\primitives\akun_2 processed_dir: ./results\primitives\akun_2\processed vid_info_path: ./results\primitives\akun_2\processed\vid_info.pkl

    1.1 Preprocessing, running Preprocessor to detect the human boxes of ./results\primitives\donald_trump_2\processed\orig_images...

100%|█████████████████████████████████████████████████████████ 100%|█████████████████████████████████████████████████████████ ███████████████████████████| 1/1 [00:00<00:00, 1.29it/s] 1.1 Preprocessing, finish detect the human boxes of ./results\primitives\donald_trump_2\processed\orig_images ... 1.2 Preprocessing, cropping all images in ./results\primitives\donald_trump_2\processed\orig_images by estimated boxes ... 1it [00:01, 1.56s/it] 1.2 Preprocessing, finish crop the human by boxes, and save them in ./results\primitives\donald_trump_2\processed\images ... 1.3 Preprocessing, running Preprocessor to 3D pose estimation of all images in./results\primitives\donald_trump_2\processed\images ... 100%|█████████████████████████████████████████████████████████ 100%|█████████████████████████████████████████████████████████ ███████████████████████████| 1/1 [00:02<00:00, 2.52s/it] 1.3 Preprocessing, finish 3D pose estimation successfully .... 1.4 Preprocessing, running Preprocessor to find 25 candidates front images in ./results\primitives\donald_trump_2\processed\images ... 0%| | 0/1 [00:00<?, ?it/s] Process PreprocessConsumer_0: Traceback (most recent call last): File "d:\python\files\ipercore-main\iPERCore\services\preprocess.py", line 79, in run visual=True, File "d:\python\files\ipercore-main\iPERCore\tools\processors\base_preprocessor.py", line 114, in execute self._execute_post_find_front(processed_info, num_candidate, render_size) File "d:\python\files\ipercore-main\iPERCore\tools\processors\preprocessors.py", line 291, in _execute_post_find_front _fim = set(render.render_fim(_cams, _verts).long()[0].unique()[1:].cpu().numpy()) File "d:\python\files\ipercore-main\iPERCore\tools\human_digitalizer\renders\nmr.py", line 316, in render_fim fim = nr.rasterize_face_index_map(faces, self.image_size, False) AttributeError: module 'neural_renderer' has no attribute 'rasterize_face_index_map'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "c:\users\chenchao\anaconda3\Lib\multiprocessing\process.py", line 258, in _bootstrap self.run() File "d:\python\files\ipercore-main\iPERCore\services\preprocess.py", line 82, in run except Exception("model error!") as e: TypeError: catching classes that do not inherit from BaseException is not allowed Pre-processing: digital deformation start... Process HumanDigitalDeformConsumer_0: Traceback (most recent call last): File "d:\python\files\ipercore-main\iPERCore\services\preprocess.py", line 138, in run prepared_inputs = self.prepare_inputs_for_run_cloth_smpl_links(process_info) File "d:\python\files\ipercore-main\iPERCore\services\preprocess.py", line 212, in prepare_inputs_for_run_cloth_smpl_links src_infos = process_info.convert_to_src_info(self.opt.num_source) File "d:\python\files\ipercore-main\iPERCore\services\options\process_info.py", line 142, in convert_to_src_info src_infos = read_src_infos(self.vid_infos, num_source) File "d:\python\files\ipercore-main\iPERCore\services\options\process_info.py", line 235, in read_src_infos pad_ids = np.random.choice(src_ids, need_pad) File "mtrand.pyx", line 908, in numpy.random.mtrand.RandomState.choice ValueError: 'a' cannot be empty unless no samples are taken

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "c:\users\chenchao\anaconda3\Lib\multiprocessing\process.py", line 258, in _bootstrap self.run() File "d:\python\files\ipercore-main\iPERCore\services\preprocess.py", line 155, in run except Exception("model error!") as e: TypeError: catching classes that do not inherit from BaseException is not allowed Pre-processing: digital deformation completed... the current number of sources are 1, while the pre-defined number of sources are 2. Pre-processing: failed...

piaozhx commented 3 years ago

Do not install other versions of neural_renderer(e.g. official version). The version of neural_renderer in our project has been modified in many places.

ChenChao20180801 commented 3 years ago

@piaozhx thanks for your reminder , the problem as been solved.

Vyogami commented 3 years ago

@ChenChao20180801 what's the solution?