Caoang327 / HexPlane

Official code for CVPR 2023 Paper, HexPlane: A Fast Representation for Dynamic Scenes
MIT License
274 stars 29 forks source link

DataSamplerType #8

Open cjfcsjt opened 1 year ago

cjfcsjt commented 1 year ago

Thanks for you great work!

I try to set datasampler_type: str = "images" in config.py instead of "rays" for HexPlanSlim, but it results in tensor shape error.

I found that the rays_train and frame_time has the shape [B, H W, 6] and [B, H W, 1] (I guess that the first dim denotes batch), should I first reshape the tensor?

Caoang327 commented 1 year ago

Hi. Sorry for the error. Which configure are you using? I will re-produce it.

cjfcsjt commented 1 year ago

Hi, sorry for the late reply. I use the nerf_slim.yaml, and set the datasampler_type: str = "images" in config.py. The command I use is python main.py config=config/dnerf_slim.yaml

The error happened at hexplane/render/trainer.py

elif self.cfg.data.datasampler_type == "images": 
            img_i = self.sampler.nextids()
            data = train_dataset[img_i]
            rays_train, rgb_train, frame_time = (
                data["rays"],
                data["rgbs"].to(self.device).view(-1, 3),
                data["time"],
            )

I fix the code to the following and the code will run successfully:

rays_train, rgb_train, frame_time = (
                data["rays"].to(self.device).view(-1, 6),
                data["rgbs"].to(self.device).view(-1, 3),
                data["time"].to(self.device).view(-1, 1),
            )