droid_metric icon indicating copy to clipboard operation
droid_metric copied to clipboard

An error occurred after changing the weight of metric3d

Open wza527 opened this issue 7 months ago • 1 comments

Hello, thank you for your excellent work. After I changed the metric weight from metric_depth_vit_giant2_800k.pth to metric_depth_vit_large_800k.pth, the image tensor dimension was wrong.

Traceback (most recent call last): File "D:\Project\reconstruction\droid_metric\reconstruct.py", line 108, in reconstruct_from_images(args) File "D:\Project\reconstruction\droid_metric\reconstruct.py", line 47, in reconstruct_from_images depth.main( File "D:\Project\reconstruction\droid_metric\depth.py", line 40, in main depth = metric(rgb_image=image, intrinsic=intr, d_max=d_max) File "D:\anaconda3\envs\droid_metric\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs) File "D:\Project\reconstruction\droid_metric\modules\metric.py", line 66, in call pred_depth, pred_depth_scale, scale, output = get_prediction( File "D:\Project\reconstruction\droid_metric\modules\metric3d\mono\utils\do_test.py", line 155, in get_prediction
pred_depth, confidence, output_dict = model.module.inference(data) File "D:\Project\reconstruction\droid_metric\modules\metric3d\mono\model\monodepth_model.py", line 12, in inference
pred_depth, confidence, output_dict = self.forward(data) File "D:\Project\reconstruction\droid_metric\modules\metric3d\mono\model\model_pipelines_base_model_.py", line 13, in forward output = self.depth_model(**data) File "D:\anaconda3\envs\droid_metric\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl return forward_call(*args, **kwargs) File "D:\Project\reconstruction\droid_metric\modules\metric3d\mono\model\model_pipelines\dense_pipeline.py", line 14, in forward features = self.encoder(input) File "D:\anaconda3\envs\droid_metric\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl return forward_call(*args, **kwargs) File "D:\Project\reconstruction\droid_metric\modules\metric3d\mono\model\backbones\ViT_DINO_reg.py", line 1091, in forward ret = self.forward_features(*args, **kwargs) File "D:\Project\reconstruction\droid_metric\modules\metric3d\mono\model\backbones\ViT_DINO_reg.py", line 981, in forward_features B, C, H, W = x.size() ValueError: not enough values to unpack (expected 4, got 3)

wza527 avatar Apr 17 '25 13:04 wza527

Hi, It seems that the problem comes from metric3d. I'm not sure if it works well with metric_depth_vit_giant2_800k.pth on your device. If that weights work, you can check the code for the backbone and adjust for the new weights, where nothoing is modified by this project.

Jianxff avatar Apr 17 '25 14:04 Jianxff