Skip to content

训练过程中,为什么要同时加载所有的图片进入内存??? #73

Description

@xing-xing448
    for idx, frame in tqdm(enumerate(frames)):
        cam_name = os.path.join(path, 'gt_imgs', str(frame["img_id"]) + extension)

        # NeRF 'transform_matrix' is a camera-to-world transform
        c2w = np.array(frame["transform_matrix"])
        # change from OpenGL/Blender camera axes (Y up, Z back) to COLMAP (Y down, Z forward)
        c2w[:3, 1:3] *= -1

        # get the world-to-camera transform and set R, T
        w2c = np.linalg.inv(c2w)
        R = np.transpose(w2c[:3,:3])  # R is stored transposed due to 'glm' in CUDA code
        T = w2c[:3, 3]

        image_path = os.path.join(path, cam_name)
        image_name = Path(cam_name).stem
        image = Image.open(image_path)
        w, h = image.size[0], image.size[1]
        image = np.array(image.convert("RGB"))

        torso_img_path = os.path.join(path, 'torso_imgs', str(frame['img_id']) + '.png')
        torso_img = np.array(Image.open(torso_img_path).convert("RGBA")) * 1.0
        bg = torso_img[..., :3] * torso_img[..., 3:] / 255.0 + bg_img * (1 - torso_img[..., 3:] / 255.0)
        bg = bg.astype(np.uint8)

不能使用的时候在加载吗???内存放不下,直接卡死了

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions