修改bug
This commit is contained in:
parent
f48018a0b0
commit
4681f18085
14
main.py
14
main.py
@ -47,6 +47,7 @@ class ProcessConfig:
|
||||
class ODM_Plugin:
|
||||
def __init__(self, config: ProcessConfig):
|
||||
self.config = config
|
||||
self.logger = setup_logger(config.output_dir)
|
||||
|
||||
# 检查磁盘空间
|
||||
# TODO 现在输入目录的磁盘空间也需要检查
|
||||
@ -62,7 +63,6 @@ class ODM_Plugin:
|
||||
self.project_path = self.config.image_dir
|
||||
|
||||
# 初始化其他组件
|
||||
self.logger = setup_logger(config.output_dir)
|
||||
self.gps_points = None
|
||||
self.grid_points = None
|
||||
self.visualizer = FilterVisualizer(config.output_dir)
|
||||
@ -71,9 +71,9 @@ class ODM_Plugin:
|
||||
"""清理输出目录"""
|
||||
try:
|
||||
shutil.rmtree(self.config.output_dir)
|
||||
print(f"已清理输出目录: {self.config.output_dir}")
|
||||
self.logger.info(f"已清理输出目录: {self.config.output_dir}")
|
||||
except Exception as e:
|
||||
print(f"清理输出目录时发生错误: {str(e)}")
|
||||
self.logger.info(f"清理输出目录时发生错误: {str(e)}")
|
||||
raise
|
||||
|
||||
def _setup_output_dirs(self):
|
||||
@ -88,9 +88,9 @@ class ODM_Plugin:
|
||||
# 创建日志目录
|
||||
os.makedirs(os.path.join(self.config.output_dir, 'logs'))
|
||||
|
||||
print(f"已创建输出目录结构: {self.config.output_dir}")
|
||||
self.logger.info(f"已创建输出目录结构: {self.config.output_dir}")
|
||||
except Exception as e:
|
||||
print(f"创建输出目录时发生错误: {str(e)}")
|
||||
self.logger.info(f"创建输出目录时发生错误: {str(e)}")
|
||||
raise
|
||||
|
||||
def _get_directory_size(self, path):
|
||||
@ -161,7 +161,7 @@ class ODM_Plugin:
|
||||
final_images_path = project_dir / "images"
|
||||
shutil.move(str(images_path), str(final_images_path))
|
||||
|
||||
print(f"符合标准输入的文件夹结构已经创建好了,{final_images_path}")
|
||||
self.logger.info(f"符合标准输入的文件夹结构已经创建好了,{final_images_path}")
|
||||
|
||||
return final_images_path
|
||||
|
||||
@ -227,7 +227,7 @@ class ODM_Plugin:
|
||||
|
||||
self.logger.info("拷贝正射影像至输出目录")
|
||||
orthophoto_tif_path = os.path.join(
|
||||
self.project_path, "odm_orthophoto", "odm_orthophoto.tif")
|
||||
self.project_path, "project", "odm_orthophoto", "odm_orthophoto.tif")
|
||||
shutil.copy(orthophoto_tif_path, self.config.output_dir)
|
||||
# if self.config.mode == "三维模式":
|
||||
# self.convert_obj()
|
||||
|
6
run.py
6
run.py
@ -10,11 +10,11 @@ def parse_args():
|
||||
# parser.add_argument('--image_dir', required=True, help='输入图片目录路径')
|
||||
# parser.add_argument('--output_dir', required=True, help='输出目录路径')
|
||||
parser.add_argument(
|
||||
'--image_dir', default=r'E:\datasets\UAV\199', help='输入图片目录路径')
|
||||
'--image_dir', default=r'E:\datasets\UAV\134', help='输入图片目录路径')
|
||||
parser.add_argument(
|
||||
'--output_dir', default=r'G:\ODM_output\test2', help='输出目录路径')
|
||||
'--output_dir', default=r'G:\ODM_output\134', help='输出目录路径')
|
||||
# 可选参数
|
||||
parser.add_argument('--mode', default='三维模式',
|
||||
parser.add_argument('--mode', default='快拼模式',
|
||||
choices=['快拼模式', '三维模式'], help='处理模式')
|
||||
parser.add_argument('--accuracy', default='medium',
|
||||
choices=['high', 'medium', 'low'], help='精度')
|
||||
|
@ -13,7 +13,7 @@ class DockerRunner:
|
||||
project_path (str): 项目路径,将挂载到 Docker 容器中
|
||||
"""
|
||||
self.project_path = project_path
|
||||
self.logger = logging.getLogger("DockerRunner")
|
||||
self.logger = logging.getLogger("UAV_Preprocess.DockerRunner")
|
||||
self.docker_client = docker.from_env()
|
||||
|
||||
def run_odm_container(self):
|
||||
|
Loading…
Reference in New Issue
Block a user