当前位置: 首页 > news >正文

网站域名备案查询系统网站开发软件有哪些

网站域名备案查询系统,网站开发软件有哪些,专业营销型网站建设公司,教程图像分割是计算机视觉中的重要任务,用于将图像中的不同区域分割成具有语义意义的区域。以下是几种常用的图像分割评价指标以及它们的代码实现示例(使用Python和常见的计算机视觉库): 1. IoU (Intersection over Union) 与目标检…

图像分割是计算机视觉中的重要任务,用于将图像中的不同区域分割成具有语义意义的区域。以下是几种常用的图像分割评价指标以及它们的代码实现示例(使用Python和常见的计算机视觉库):

1. IoU (Intersection over Union)

与目标检测中的IoU类似,用于衡量预测分割区域与真实分割区域之间的重叠程度。

def calculate_iou(mask_true, mask_pred):intersection = np.logical_and(mask_true, mask_pred)union = np.logical_or(mask_true, mask_pred)iou = np.sum(intersection) / np.sum(union)return iou#e.g.import cv2
import numpy as npmask_true=cv2.imread("round_meter_421.png",0)
mask_pred=cv2.imread("round_meter_423.png",0)mask_true=cv2.resize(mask_true,(512,512),interpolation = cv2.INTER_LINEAR)
mask_pred=cv2.resize(mask_pred,(512,512),interpolation = cv2.INTER_LINEAR)
def calculate_iou(mask_true, mask_pred):intersection = np.logical_and(mask_true, mask_pred)union = np.logical_or(mask_true, mask_pred)iou = np.sum(intersection) / np.sum(union)return iouprint(calculate_iou(mask_true,mask_pred))
#结果0.6660

2. Dice Coefficient

用于衡量预测分割区域与真实分割区域的重叠程度。

def calculate_dice_coefficient(mask_true, mask_pred):intersection = np.logical_and(mask_true, mask_pred)dice_coeff = (2.0 * np.sum(intersection)) / (np.sum(mask_true) + np.sum(mask_pred))return dice_coeff#e.g.import cv2
import numpy as npmask_true=cv2.imread("round_meter_421.png",0)
mask_pred=cv2.imread("round_meter_423.png",0)mask_true=cv2.resize(mask_true,(512,512),interpolation = cv2.INTER_LINEAR)
mask_true = np.where(mask_true != 0, 1, mask_true)
mask_pred=cv2.resize(mask_pred,(512,512),interpolation = cv2.INTER_LINEAR)
mask_pred = np.where(mask_pred != 0, 1, mask_pred)
def calculate_dice_coefficient(mask_true, mask_pred):intersection = np.logical_and(mask_true, mask_pred)dice_coeff = (2.0 * np.sum(intersection)) / (np.sum(mask_true) + np.sum(mask_pred))return dice_coeffprint(calculate_dice_coefficient(mask_true,mask_pred))
#结果是 0.7995

3. Pixel Accuracy:

计算正确预测的像素数量占总像素数量的比例。

def calculate_pixel_accuracy(mask_true, mask_pred):correct_pixels = np.sum(mask_true == mask_pred)total_pixels = mask_true.sizepixel_accuracy = correct_pixels / total_pixelsreturn pixel_accuracy#e.g.import cv2
import numpy as npmask_true=cv2.imread("round_meter_421.png",0)
mask_pred=cv2.imread("round_meter_423.png",0)mask_true=cv2.resize(mask_true,(512,512),interpolation = cv2.INTER_LINEAR)
mask_true = np.where(mask_true != 0, 1, mask_true)
mask_pred=cv2.resize(mask_pred,(512,512),interpolation = cv2.INTER_LINEAR)
mask_pred = np.where(mask_pred != 0, 1, mask_pred)
def calculate_pixel_accuracy(mask_true, mask_pred):correct_pixels = np.sum(mask_true == mask_pred)total_pixels = mask_true.sizepixel_accuracy = correct_pixels / total_pixelsreturn pixel_accuracyprint(calculate_pixel_accuracy(mask_true,mask_pred))
#结果是 0.9914

4. Mean Intersection over Union (mIoU)

计算在不同类别上的平均IoU值。

def calculate_miou(class_iou_list):return np.mean(class_iou_list)

5. Boundary F1-score:

用于衡量分割区域的边界的预测质量。

def calculate_boundary_f1(mask_true, mask_pred):# Calculate true positive, false positive, and false negative boundary pixelstrue_positive = np.sum(np.logical_and(mask_true, mask_pred))false_positive = np.sum(np.logical_and(np.logical_not(mask_true), mask_pred))false_negative = np.sum(np.logical_and(mask_true, np.logical_not(mask_pred)))precision = true_positive / (true_positive + false_positive)recall = true_positive / (true_positive + false_negative)f1_score = 2 * (precision * recall) / (precision + recall)return f1_score#e.g.import cv2
import numpy as npmask_true=cv2.imread("round_meter_421.png",0)
mask_pred=cv2.imread("round_meter_423.png",0)mask_true=cv2.resize(mask_true,(512,512),interpolation = cv2.INTER_LINEAR)
mask_true = np.where(mask_true != 0, 1, mask_true)
mask_pred=cv2.resize(mask_pred,(512,512),interpolation = cv2.INTER_LINEAR)
mask_pred = np.where(mask_pred != 0, 1, mask_pred)
def calculate_boundary_f1(mask_true, mask_pred):# Calculate true positive, false positive, and false negative boundary pixelstrue_positive = np.sum(np.logical_and(mask_true, mask_pred))false_positive = np.sum(np.logical_and(np.logical_not(mask_true), mask_pred))false_negative = np.sum(np.logical_and(mask_true, np.logical_not(mask_pred)))precision = true_positive / (true_positive + false_positive)recall = true_positive / (true_positive + false_negative)f1_score = 2 * (precision * recall) / (precision + recall)return f1_scoreprint(calculate_boundary_f1(mask_true,mask_pred))
#结果是 0.7995

这些代码示例提供了基本的评价指标计算方法,实际应用中可能会涉及更多的细节和优化。使用深度学习框架(如TensorFlow、PyTorch)和计算机视觉库(如OpenCV、Scikit-image)可以更方便地计算这些评价指标,因为它们提供了丰富的内置函数和工具来处理图像分割任务。

http://www.ds6.com.cn/news/67633.html

相关文章:

  • 西宁市城市道路建设规划网站自助建站网
  • wap手机网站源码足球比赛直播2021欧冠决赛
  • 给个网址2021年能看的廊坊seo网络推广
  • 网站代做多长时间网站seo是什么意思
  • 中国招标机构哪个网站做的好seo网络营销课程
  • 做公司简介网站许昌seo公司
  • 网站建设需要服务器么seo基础入门免费教程
  • 电视剧下载网站免费糖醋蒜怎样做b站推出的短视频app哪个好
  • 360安全浏览器做网站测试减少缓存设置黄页大全
  • 建网站多少钱一个月站长平台工具
  • 能自己做网站接业务吗b站好看的纪录片免费
  • 如何直到网站是用什么模板做的黄冈网站推广软件费用是多少
  • 广告公司电话广东网站seo营销
  • 工信部查网站备案自制网站教程
  • 东莞网站建设(信科分公司)百度推广步骤
  • 如何做网站电话工具刷网站排刷排名软件
  • 如何把省市县三级下拉菜单弄到网站的在线表单内企业网站制作要求
  • 哪些网站是动态搜索引擎优化的特点
  • 做企业网站有哪些好处seo管理工具
  • 找人做网站 网站定制开发国外seo工具
  • 电子商务网站建设与管理a线上营销模式
  • 网站想做个链接怎么做青岛网站建设运营推广
  • 那个网站可免费做推广爱战网官网
  • 韩都衣舍网站建设ppt必应搜索引擎下载
  • 东莞哪种网站推广好seo百度seo排名优化软件
  • 石家庄做的好的网站淘宝seo对什么内容优化
  • 做暧暖ox免费视频网站深圳seo网站推广方案
  • ugc网站开发seo优化外链平台
  • 做网站公司汉狮团队苏州网站维护
  • 观音桥网站建设网站建设北京搜索引擎优化主管