feat 代码整理

fix
This commit is contained in:
zhouchengrong
2024-09-25 11:13:25 +08:00
parent 9b940c9cf8
commit e62b35a721
4 changed files with 19 additions and 23 deletions

View File

@@ -48,9 +48,9 @@ class Segmentation:
file_path = f"{SEG_CACHE_PATH}{image_id}.npy"
try:
np.save(file_path, seg_result)
print("保存成功", os.path.abspath(file_path))
logging.info("保存成功", os.path.abspath(file_path))
except Exception as e:
print(f"保存失败: {e}")
logger.error(f"保存失败: {e}")
@staticmethod
def load_seg_result(image_id):
@@ -60,8 +60,8 @@ class Segmentation:
seg_result = np.load(file_path)
return True, seg_result
except FileNotFoundError:
print("文件不存在")
logger.warning("文件不存在")
return False, None
except Exception as e:
print(f"加载失败: {e}")
logger.error(f"加载失败: {e}")
return False, None

View File

@@ -53,9 +53,9 @@ class Segmentation(object):
file_path = f"{SEG_CACHE_PATH}{image_id}.npy"
try:
np.save(file_path, seg_result)
print("保存成功", os.path.abspath(file_path))
logger.info("保存成功", os.path.abspath(file_path))
except Exception as e:
print(f"保存失败: {e}")
logger.error(f"保存失败: {e}")
@staticmethod
def load_seg_result(image_id):
@@ -64,8 +64,8 @@ class Segmentation(object):
seg_result = np.load(file_path)
return True, seg_result
except FileNotFoundError:
print("文件不存在")
logger.warning("文件不存在")
return False, None
except Exception as e:
print(f"加载失败: {e}")
logger.error(f"加载失败: {e}")
return False, None

View File

@@ -51,9 +51,9 @@ class Segmentation:
file_path = f"{SEG_CACHE_PATH}{image_id}.npy"
try:
np.save(file_path, seg_result)
print("保存成功", os.path.abspath(file_path))
logger.info("保存成功", os.path.abspath(file_path))
except Exception as e:
print(f"保存失败: {e}")
logger.error(f"保存失败: {e}")
@staticmethod
def load_seg_result(image_id):
@@ -63,8 +63,8 @@ class Segmentation:
seg_result = np.load(file_path)
return True, seg_result
except FileNotFoundError:
print("文件不存在")
logger.warning("文件不存在")
return False, None
except Exception as e:
print(f"加载失败: {e}")
logger.error(f"加载失败: {e}")
return False, None