MaGNet icon indicating copy to clipboard operation
MaGNet copied to clipboard

Error During F-Net Training

Open malteprinzler opened this issue 3 years ago • 1 comments

When I try to run

python train_FNet.py train_scripts/fnet/scannet.txt

I get the following error:

Traceback (most recent call last): File "MaGNet/venv/lib/python3.8/site-packages/torch/multiprocessing/spawn.py", line 69, in _wrap fn(i, *args) File "MaGNet/train_FNet.py", line 238, in main_worker train(model, args, device=args.gpu) File "MaGNet/train_FNet.py", line 130, in train utils.visualize_F(args, ref_img, gt_dmap, gt_dmap_mask, pred_dmap, total_iter) File "MaGNet/utils/utils.py", line 286, in visualize_F pred_emap = np.abs(pred_dmap - gt_dmap) ValueError: operands could not be broadcast together with shapes (480,640) (120,160)

I think the problem is caused by this line: https://github.com/baegwangbin/MaGNet/blob/d916ec69db4c84d3cd062760c6892606aafe4076/utils/utils.py#L266 resizing the predicted depth to the image dimensions (which have a 4 times higher resolution than the ground truth depth).

I removed the respective line as a workaround. Does that make sense or am I missing some logic?

malteprinzler avatar Jul 07 '22 16:07 malteprinzler

Hi, sorry for the delayed response.

Yes, this should be fixed.

You can either remove that line or add a line gt_dmap = F.interpolate(gt_dmap, size=[img.shape[2], img.shape[3]], mode='nearest')

FYI, they are for visualization purposes only. You can either visualize them in (120,160) or (480,640).

baegwangbin avatar Jul 12 '22 14:07 baegwangbin