oneThousand1000 / Portrait3D

(SIGGRAPH 2024) Portrait3D: Text-Guided High-Quality 3D Portrait Generation Using Pyramid Representation and GANs Prior
148 stars 10 forks source link

No such file or directory: '../test_data/2/samples/2d_pose_result_hrnet.json' #5

Closed Rietchie0119 closed 5 months ago

Rietchie0119 commented 5 months ago

Hello, when I run

python preprocess_img_for_inversion.py --test_data_dir=$PROJECT_ROOT$/test_data

I get the following errors:

Traceback (most recent call last):
  File "tools/get_keypoints.py", line 264, in <module>
    main()
  File "tools/get_keypoints.py", line 248, in main
    with open(json_save_path, 'w') as f:
FileNotFoundError: [Errno 2] No such file or directory: '../test_data/2/samples/2d_pose_result_hrnet.json'

Looks like I'm missing json file but I followed everything as instruction says. How can I solve this problem?

oneThousand1000 commented 5 months ago

Hi, it seems there something wrong with your 2d pose extraction so that the json file is not generated.

Could you please do the following steps?

  1. Delete everything in the test/2 dir, except the prompt.txt
  2. Rerun the random image generation step and the preprocess_img_for_inversion step.
  3. Show me all errors you meet (especially the first one)
Rietchie0119 commented 5 months ago

Thanks for your response. I reran the code but I am still getting the same error. Does the following command supposed to create "../test_data/0/samples/2d_pose_result_hrnet.json" file?

python get_test_data_df.py --test_data_dir ../test_data --sample_num 6  --scale 5 --df_ckpt $PATH_of_Realistic_Vision_V5.1_noVAE$/realisticVisionV51_v51VAE.ckpt

By the way I noticed that I was using files from "SMPL_python_v.1.1.0.zip" and not from "SMPL_python_v.1.0.0.zip" I changed the files to correct ones but I still get the same error. Following is the full text when I run

python preprocess_img_for_inversion.py --test_data_dir=../test_data
/home/jeonguk/Portrait3D/data_processing
/home/jeonguk/Portrait3D/data_processing
python tools/get_keypoints.py  --cfg experiments/coco/higher_hrnet/w32_512_adam_lr1e-3.yaml  --input_dir ../test_data/0/samples TEST.MODEL_FILE models/pytorch/pose_coco/pose_higher_hrnet_w32_512.pth 
=> creating output/coco_kpt/pose_higher_hrnet/w32_512_adam_lr1e-3
=> creating log/coco_kpt/pose_higher_hrnet/w32_512_adam_lr1e-3_2024-06-01-08-28
Namespace(cfg='experiments/coco/higher_hrnet/w32_512_adam_lr1e-3.yaml', input_dir='../test_data/0/samples', opts=['TEST.MODEL_FILE', 'models/pytorch/pose_coco/pose_higher_hrnet_w32_512.pth'])
=> loading model from models/pytorch/pose_coco/pose_higher_hrnet_w32_512.pth
json_save_path ../test_data/0/samples/2d_pose_result_hrnet.json
meta_save_path ../test_data/0/samples/meta_data.json
0it [00:00, ?it/s]
Traceback (most recent call last):
  File "tools/get_keypoints.py", line 264, in <module>
    main()
  File "tools/get_keypoints.py", line 248, in main
    with open(json_save_path, 'w') as f:
FileNotFoundError: [Errno 2] No such file or directory: '../test_data/0/samples/2d_pose_result_hrnet.json'
python detect_head_bbox.py --weights crowdhuman_yolov5m.pt --source ../test_data/0/samples   --heads
Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.25, device='', exist_ok=False, heads=True, img_size=640, iou_thres=0.45, name='exp', person=False, project='runs/detect', save_conf=False, save_txt=False, source='../test_data/0/samples', update=False, view_img=False, weights=['crowdhuman_yolov5m.pt'])
Traceback (most recent call last):
  File "detect_head_bbox.py", line 294, in <module>
    detect()
  File "detect_head_bbox.py", line 26, in detect
    with open(skeleton_path) as f:
FileNotFoundError: [Errno 2] No such file or directory: '../test_data/0/samples/2d_pose_result_hrnet.json'
/home/jeonguk/Portrait3D/data_processing
Traceback (most recent call last):
  File "runmy.py", line 19, in <module>
    raise Exception('path or head_box_path not exists')
Exception: path or head_box_path not exists
/home/jeonguk/Portrait3D/data_processing
python new_crop_use_densepose.py --gpu 0  --input_dir  ../test_data/0/samples  --output_dir  ../test_data/0/samples_new_crop  --data_dir /home/jeonguk/Portrait3D/data_processing/data
output dir:  /home/jeonguk/Portrait3D/data_processing/main/../output/exp_06-01_08-29
exp_dir:  
>>> Using GPU: 0
/home/jeonguk/Portrait3D/data_processing/main/../common/utils/smplpytorch/smplpytorch/pytorch/smpl_layer.py:41: UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors. This means you can write to the underlying (supposedly non-writeable) NumPy array using the tensor. You may want to copy the array to protect its data or make it writeable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at  ../torch/csrc/utils/tensor_numpy.cpp:189.)
  torch.Tensor(smpl_data['betas'].r).unsqueeze(0))
>>>>>>> output_dir ../test_data/0/samples_new_crop
Traceback (most recent call last):
  File "new_crop_use_densepose.py", line 170, in <module>
    with open(result_json_path, 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: '../test_data/0/samples/result.json'
0it [00:00, ?it/s]
Rietchie0119 commented 5 months ago

Ok I found the problem. I passed relative path for the following command and it did not work.

python preprocess_img_for_inversion.py --test_data_dir=$PROJECT_ROOT$/test_data

After passing absolute path, it worked totally fine!