zhyever / PatchFusion

[CVPR 2024] An End-to-End Tile-Based Framework for High-Resolution Monocular Metric Depth Estimation

Home Page:https://zhyever.github.io/patchfusion/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some load model error question

zhangmo123 opened this issue · comments

Hello, I have a question to ask. When I execute model inference, I used the example you provided. However, an error occurred when loading the model.
model_name = 'Zhyever/patchfusion_depth_anything_vitl14'
DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'
model = PatchFusion.from_pretrained(model_name).to(DEVICE).eval()

The error message is:
File "PatchFusion/estimator/models/zoedepth/models/base_models/midas.py", line 335, in build
raise ValueError(
ValueError: Invalid model type: vitl. Must be one of ['DPT_BEiT_L_384', 'DPT_BEiT_L_512', 'DPT_BEiT_B_384', 'DPT_SwinV2_L_384', 'DPT_SwinV2_B_384', 'DPT_SwinV2_T_256', 'DPT_Large', 'DPT_Hybrid', 'MiDaS_small']

I downloaded the missing module from PatchFusion and Zoedepth directly, then placed the corresponding model folder into the models directory. Is there a problem with this step? Looking forward to your reply.

Could you please check if

export PYTHONPATH="${PYTHONPATH}:/path/to/the/folder/PatchFusion"
export PYTHONPATH="${PYTHONPATH}:/path/to/the/folder/PatchFusion/external"

are correctly executed? Is it possible that you set this path to some other folders?

The path PatchFusion/estimator/models/zoedepth/models/base_models/midas.py is kind of weird to me. The file is not existed in this repo.

It would also be helpful to run

python ./tools/test_single_forward.py

to have a simple test.

@zhyever

The path PatchFusion/estimator/models/zoedepth/models/base_models/midas.py is kind of weird to me. The file is not existed in this repo. It would be helpful to run...

That's because it's not made clear to us that zoedepth, torchhub, and depth_anything modules are located in the directory "external".

@zhangmo123 , They're not missing, they exist in this repository as it currently presents--it's just not made apparent. Look in directory

/PatchFusion/external

and you'll find your missing modules there lol. I have been working on getting this repo functional for the ENTIRE past weekend. If you'd like me to share the command and other MISSING information, please let me know.

Sorry for any confusion. I was working on refactoring this repo to extend flexibility and it's possible that there are some bugs and weird things. I will add some explanations about this in the readme then. Thank you for pointing them out!

@zhyever Put the sad cry face away. If you have the tenacity to make little faces and respond so quickly, you should have the tenacity and patience to double check your entries for consistency and accuracy. Your work is vastly impressive--but you seem a bit lazy with details. It's like, you've done all the REALLY hard work, and wish to share, but can't seem to focus in on details that are important for people who, you know, aren't inside of your brilliant mind, and so cannot just infer how to run inference just by looking at the code.

Hah, okay. Thanks anyway. I was really busy with another project which was just finished weeks ago... So now, I have time to re-organize this repo. Sooorry for the inconvenience.

Thank you! Your work is appreciated, I really do mean that! Good day!

tumblr_plmwmcWjZH1xlv8m3o10_540

@zhyever

The path PatchFusion/estimator/models/zoedepth/models/base_models/midas.py is kind of weird to me. The file is not existed in this repo. It would be helpful to run...

That's because it's not made clear to us that zoedepth, torchhub, and depth_anything modules are located in the directory "external".

@zhangmo123 , They're not missing, they exist in this repository as it currently presents--it's just not made apparent. Look in directory

/PatchFusion/external

and you'll find your missing modules there lol. I have been working on getting this repo functional for the ENTIRE past weekend. If you'd like me to share the command and other MISSING information, please let me know.

thank you very much!!!i will try to get the module from external.

Could you please check if

export PYTHONPATH="${PYTHONPATH}:/path/to/the/folder/PatchFusion"
export PYTHONPATH="${PYTHONPATH}:/path/to/the/folder/PatchFusion/external"

are correctly executed? Is it possible that you set this path to some other folders?

The path PatchFusion/estimator/models/zoedepth/models/base_models/midas.py is kind of weird to me. The file is not existed in this repo.

It would also be helpful to run

python ./tools/test_single_forward.py

to have a simple test.

Thank you for your work and response!!! I will continue to consult you if I have any questions.