kunkk commited on
Commit
6e4f6fe
·
verified ·
1 Parent(s): 944f056

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -8
app.py CHANGED
@@ -448,9 +448,7 @@ class ImageProcessor:
448
 
449
  time_end = time.time()
450
  inference_time = time_end - time_start
451
-
452
- # 确保转换为float32类型
453
- # 确保转换为float32类型
454
  # 确保转换为float32类型并保持原始显著性值
455
  res = res.to(torch.float32).sigmoid().cpu().numpy().squeeze()
456
 
@@ -484,9 +482,6 @@ class ImageProcessor:
484
  # 使用原始显著性值生成分析图表
485
  analysis_plot = self.generate_analysis_plots(res_resized_original) # 使用未归一化的原始值
486
 
487
- # 生成分析图表
488
- analysis_plot = self.generate_analysis_plots(res_resized)
489
-
490
  # 计算统计信息
491
  contours = cv2.findContours(binary_mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)[0]
492
  total_area = w * h
@@ -496,8 +491,8 @@ class ImageProcessor:
496
  stats = {
497
  "处理分辨率": f"{w}x{h}",
498
  "检测到对象数": str(len(contours)),
499
- "平均置信度": f"{np.mean(res_resized):.2%}",
500
- "最大置信度": f"{np.max(res_resized):.2%}",
501
  "覆盖率": f"{coverage_ratio:.2%}",
502
  "处理时间": f"{inference_time:.3f}秒"
503
  }
 
448
 
449
  time_end = time.time()
450
  inference_time = time_end - time_start
451
+
 
 
452
  # 确保转换为float32类型并保持原始显著性值
453
  res = res.to(torch.float32).sigmoid().cpu().numpy().squeeze()
454
 
 
482
  # 使用原始显著性值生成分析图表
483
  analysis_plot = self.generate_analysis_plots(res_resized_original) # 使用未归一化的原始值
484
 
 
 
 
485
  # 计算统计信息
486
  contours = cv2.findContours(binary_mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)[0]
487
  total_area = w * h
 
491
  stats = {
492
  "处理分辨率": f"{w}x{h}",
493
  "检测到对象数": str(len(contours)),
494
+ "平均置信度": f"{np.mean(res_resized_original):.2%}", # 使用原始值
495
+ "最大置信度": f"{np.max(res_resized_original):.2%}", # 使用原始值
496
  "覆盖率": f"{coverage_ratio:.2%}",
497
  "处理时间": f"{inference_time:.3f}秒"
498
  }