ActiveVisionLab / nope-nerf

(CVPR 2023) NoPe-NeRF: Optimising Neural Radiance Field with No Pose Prior
https://nope-nerf.active.vision/
MIT License
372 stars 30 forks source link

Failed to write depth data to png file #11

Closed hzhshok closed 1 year ago

hzhshok commented 1 year ago

Hi, It happened exception when saving depth data into png file, the details is as the following,

Errors: File "D:\xxx\proj\windows\3d\nope-nerf\model**training.py", line 138, in render_visdata imageio.imwrite(input_path, depth_pred_out) File "C:\Users\xxx\anaconda3\envs\nope-nerf\lib\site-packages\imageio\v2.py", line 397, in imwrite return file.write(im, kwargs) File "C:\Users\jinshui\anaconda3\envs\nope-nerf\lib\site-packages\imageio\core\v3_plugin_api.py", line 367, in exit self.close() File "C:\Users\xxx\anaconda3\envs\nope-nerf\lib\site-packages\imageio\plugins\pillow.py", line 123, in close self._flush_writer() File "C:\Users\xxx\anaconda3\envs\nope-nerf\lib\site-packages\imageio\plugins\pillow.py", line 457, in _flush_writer primary_image.save(self._request.get_file(), **self.save_args) File "C:\Users\xxx\anaconda3\envs\nope-nerf\lib\site-packages\PIL\Image.py", line 2353, in save save_handler(self, fp, filename) File "C:\Users\xxx\anaconda3\envs\nope-nerf\lib\site-packages\PIL\PngImagePlugin.py", line 1280, in _save raise OSError(f"cannot write mode {mode} as PNG") from e OSError: cannot write mode F as PNG

The error is caused by the depth data(float) when saving to png file, just now i don't know if the idea of depth file is using float, but, i pass the error after converting the float to uint8.

The similar as the following. depth_pred_out = depth_pred_out * 255 depth_pred_out = depth_pred_out.astype(np.uint8)

Regards

bianwenjing commented 1 year ago

Hi, thanks for your interest in the work. I have modified the code, please refer to #12 for further questions.