nerf需要colmap先解出每张图片中的相机位姿和相机的内参。
我在跑instant-ngp的colmap2nerf.py时,会出现如下报错:
1. WARNING: Your current options use the maximum number of threads on the machine to extract features. Exracting SIFT features on the CPU can consume a lot of RAM per thread for large images. Consider reducing the maximum image size and/or the first octave or manually limit the number of extraction threads. Ignore this warning, if your machine has sufficient memory for the current settings
==============================================================================
Feature extraction
FATAL: command failed`
导致这个问题的原因,如warning’中所示,
我参考了github issue 中给出的解决方案,成功解决了这个问题:
将该代码的123、124行替换为:
do_system(f"{colmap_binary} feature_extractor --ImageReader.camera_model {args.colmap_camera_model} --ImageReader.camera_params \"{args.colmap_camera_params}\" --ImageReader.single_camera 1 --database_path {db} --image_path {images}")
match_cmd = f"{colmap_binary} {args.colmap_matcher}_matcher --SiftMatching.guided_matching=true --database_path {db}"
2. [ WARN:0@20.410] global loadsave.cpp:248 findDecoder imread_(‘./train/36_231015-0329190652.png’): can’t open/read file: check file path/integrity Traceback (most recent call last): File “…/…/…/scripts/colmap2nerf.py”, line 344, in
后来发现这大概率是因为我的图片名字中有空格导致的。
可以使用下面这个免费的图片批量重命名网站,快速给图片改名
https://webrename.cn/
去掉名字中的空格后,问题解决。