KeyuWu-CS / MonoHair

Code of MonoHair: High-Fidelity Hair Modeling from a Monocular Video
Other
100 stars 4 forks source link

Same issues still in perpare_data about model_tsfm.dat #16

Open ShiningorDying opened 3 months ago

ShiningorDying commented 3 months ago

i know there are already Issues about this 9and15,But the question seem still exist when run on mydata.(seems @LaurentGarcia also stuck in this still)

  • uncomment the code for data process in multiview_optimization.py(Line 868)
  • recheck DATA file structure as the example given
  • set fit_bust set to True in "***.yaml"(which is set in base.yaml already)

during the test i try example given in project the problem also rised.

existing options file found (identical)
name: jenya2
Traceback (most recent call last):
  File "/root/autodl-tmp/MonoHair/multiview_optimization.py", line 883, in <module>
    dataset = NerfDataset(args, given_imagepath_list = imagepath_list)
  File "/root/autodl-tmp/MonoHair/multiview_optimization.py", line 102, in __init__
    assert len(self.data) > 0, "Can't find data; make sure you specify the path to your dataset"
AssertionError: Can't find data; make sure you specify the path to your dataset
If you are not running wig hair, please first run bust fitting. 
Traceback (most recent call last):
  File "/root/autodl-tmp/MonoHair/prepare_data.py", line 136, in <module>
    shutil.copyfile(os.path.join(args.data.root,'optimize','model_tsfm.dat'),os.path.join(args.data.root,'model_tsfm.dat'))
  File "/root/miniconda3/envs/MonoHair/lib/python3.10/shutil.py", line 254, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: 'data/jenya2/optimize/model_tsfm.dat'

as far as i know iris seem run properly, but landmark2d alwasys empty.

data/my*/
├──  iris              <--- have files
├── landmark2d         <--- empty
├── colmap
├── face_parsing
├── ....

i found that those file was created by: dataprocess.py:

        if ignore_existing or not os.path.exists(os.path.join(savepath, 'matting')):
            generate_matting_MODNet(os.path.join(savepath, 'capture_images'), os.path.join(savepath, 'matting'))

        #  landmarks
        if ignore_existing or not os.path.exists(os.path.join(savepath, 'landmark2d')):
            generate_landmark2d(os.path.join(savepath, 'capture_images'), os.path.join(savepath, 'landmark2d'), vis=vis)

        if ignore_existing or not os.path.exists(os.path.join(savepath, 'iris')):
            generate_iris(os.path.join(savepath, 'capture_images'), os.path.join(savepath, 'iris'), vis=vis)

        #  face parsing

        if ignore_existing or not os.path.exists(os.path.join(savepath, 'face_parsing')):
            generate_face_parsing(os.path.join(savepath, 'matting'), os.path.join(savepath, 'face_parsing'), vis=vis)

and multiview_optimization.py: dataprocess.run(args.subject_path,args.ignore_existing) so, i update base.yaml : ignore_existing: True still not work

will updata this issue if i process something

KeyuWu-CS commented 3 months ago

I guess you should check if generate_landmark2d run succssfully. There are some bug in this step, When you fail to execute this step first time, it is possible that the landmark2d folder is still created. But when you run it again, it detects that the folder already exists so it skips it. I have fixed this bug . You can have a try, and you need to make sure each step is executed successfully.

0mil commented 3 months ago

@KeyuWu-CS I also experienced similar issue like this with the new commit code. In my case, l ran the preprocessing steps completely from scratch using the code you newly provided. I also created a new empty directory and proceeded with the prepare_data.py step.

I believe the error that occurred next is due to the .txt files from the landmark2d directory not being present in the iris directory. It has been confirmed that the .txt files in landmark2d mistakenly identified non-eye areas. I am curious about your advice on which part of the process might be causing this issue.

error message:

 72%|██████████████████████████████████████████████████                   | 29/40 [00:04<00:01,  7.10it/s]Empty iris landmarks
data/test_keyuwu/capture_images/3696.png
 75%|███████████████████████████████████████████████████▊                 | 30/40 [00:04<00:01,  7.23it/s]Empty iris landmarks
 78%|█████████████████████████████████████████████████████▍               | 31/40 [00:04<00:01,  7.15it/s]Empty iris landmarks
 80%|███████████████████████████████████████████████████████▏             | 32/40 [00:04<00:01,  7.13it/s]Empty iris landmarks
 90%|██████████████████████████████████████████████████████████████       | 36/40 [00:05<00:00,  4.11it/s]Empty iris landmarks
data/test_keyuwu/capture_images/90.png
 95%|█████████████████████████████████████████████████████████████████▌   | 38/40 [00:06<00:00,  4.16it/s]Empty iris landmarks
data/test_keyuwu/capture_images/96.png
100%|█████████████████████████████████████████████████████████████████████| 40/40 [00:06<00:00,  5.87it/s]
2024-08-14 03:42:01.053 | INFO     | dataprocess:generate_face_parsing:454 - generae face parsing
100%|█████████████████████████████████████████████████████████████████████| 40/40 [00:18<00:00,  2.20it/s]
Traceback (most recent call last):
  File "/MonoHair/multiview_optimization.py", line 879, in <module>
    dataset = NerfDataset(args, given_imagepath_list = imagepath_list)
  File "/MonoHair/multiview_optimization.py", line 102, in __init__
    assert len(self.data) > 0, "Can't find data; make sure you specify the path to your dataset"
AssertionError: Can't find data; make sure you specify the path to your dataset
If you are not running wig hair, please first run bust fitting.
Traceback (most recent call last):
  File "/MonoHair/prepare_data.py", line 130, in <module>
    shutil.copyfile(os.path.join(args.data.root,'optimize','model_tsfm.dat'),os.path.join(args.data.root,'model_tsfm.dat'))
  File "/usr/lib/python3.10/shutil.py", line 254, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: 'data/test_keyuwu/optimize/model_tsfm.dat'

landmarks2d:

landmark2d/
├── 1236.png
└── 1236.txt

iris:

iris/
├── 2442.png
├── 2442.txt
├── 2856.png
├── 2856.txt
├── 2952.png
├── 2952.txt
├── 624.png
├── 624.txt
├── 756.png
├── 756.txt
├── 846.png
├── 846.txt
├── 948.png
├── 948.txt
├── 960.png
└── 960.txt

1236.png:

image
KeyuWu-CS commented 3 months ago

As you see, the landmark2d detection of face_alignment package not always correct. So we only select views where both iris and landmark can be detected. When iris can be detected, the landmark will be more accurate. But it's weird, why only one image (1236.png) can detect the 2D landmark in your given example? How many views incapture_images folder?

0mil commented 3 months ago

@KeyuWu-CS Here is the list of capture_images directory generated. There are 40 .png files included 1246.png file!

MonoHair/data/test_keyuwu/cpature_images
├── 1140.png
├── 1236.png
├── 1284.png
├── 1404.png
├── 1452.png
├── 1554.png
├── 1722.png
├── 1812.png
├── 1872.png
├── 1926.png
├── 2082.png
├── 2142.png
├── 2244.png
├── 2394.png
├── 240.png
├── 2442.png
├── 2556.png
├── 2670.png
├── 2706.png
├── 2856.png
├── 2952.png
├── 3048.png
├── 3162.png
├── 318.png
├── 3210.png
├── 3288.png
├── 3378.png
├── 3474.png
├── 3594.png
├── 3696.png
├── 3750.png
├── 474.png
├── 486.png
├── 624.png
├── 756.png
├── 846.png
├── 90.png
├── 948.png
├── 960.png
└── 96.png
KeyuWu-CS commented 3 months ago

I just tested again. Among these 40 images, 1236.png is not the only one that can detect landmarks. For example 756.png 756 So, check are there any bugs?

0mil commented 2 months ago

@ShiningorDying I encountered the same issue. In my case, the problem was due to the permission. Check the permission of your entire project directory, especially for the capture_images.

0mil commented 1 day ago

@ShiningorDying Hello, are you still there?

Currently, I have tried to execute this project on Windows and also encountered the same issue as you. From what I can infer, if you met this issue while running on Windows, your errors might be due to the Windows path format. To resolve this, you have to modify several codes related to path handling, such as replacing path.split('/') with path.split(os.sep), to make the code independent of OS.