Skip to content

关于深度倒装的问题 #305

@Smezzdl1996

Description

@Smezzdl1996

Dear author, thank you for your great work. I tried to apply your method to self-supervised visual odometry in SLAM. However, when using your provided test script run.py, I found that the inferred depth seems to have smaller values for the farthest points. I verified this by visualizing the depth values on a heatmap, as shown in the figure.

Image

my test code is listed as
`import numpy as np
import matplotlib.pyplot as plt
import cv2
import os
def visualize_depth_maps(
npy_path,
output_dir="depth_visualizations",
colormap='magma',
show_values=False,
step=20
):
if not os.path.exists(output_dir):
os.makedirs(output_dir)
depth_maps = np.load(npy_path)
print(f"Loaded depth maps of shape {depth_maps.shape}")

for i in range(depth_maps.shape[0]):
    depth = depth_maps #[i]
    plt.figure(figsize=(8, 6))
    plt.imshow(depth, cmap=colormap)
    plt.colorbar(label='Depth (normalized)')
    plt.title(f'Depth Map {i+1}')
    plt.axis('off')
    if show_values:
        h, w = depth.shape
        for y in range(0, h, step):
            for x in range(0, w, step):
                plt.text(
                    x, y, f"{depth[y, x]:.2f}",
                    color='white',
                    fontsize=3,
                    ha='center', va='center',
                    bbox=dict(facecolor='black', alpha=0.3, lw=0)
                )
    output_path = os.path.join(output_dir, f'depth_map_{i+1}.png')
    plt.savefig(output_path, bbox_inches='tight', pad_inches=0.05, dpi=300)
    plt.close()
    print(f"Saved: {output_path}")

if name == "main":
npy_path = "aaa.npy"
visualize_depth_maps(
npy_path,
output_dir="depth_visualizations",
colormap='magma',
show_values=True,
step=100
)
`
I would like to know what caused this issue and I’m really looking forward to your reply. Alternatively, is there any way to fix this problem? I actually only need disp for fine-tuning in self-supervised visual odometry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions