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

医院手机网站建设网站导航app

医院手机网站建设,网站导航app,昆明网站制作前十,选择网站做友情链接的标准一般是现在有一系列的图片#xff0c;图片之间可以按照z轴方向进行排列。图片经过了目标检测#xff0c;输出了一系列的检测框#xff0c;现在的需求是将检测框按类别进行合成#xff0c;以在3维上生成检测结果。 思路#xff1a;将图片按照z轴方向排列#xff0c;以z轴索引作…现在有一系列的图片图片之间可以按照z轴方向进行排列。图片经过了目标检测输出了一系列的检测框现在的需求是将检测框按类别进行合成以在3维上生成检测结果。 思路将图片按照z轴方向排列以z轴索引作为检测框的z值。等同于输入为x, y, w, h, z, class_id可以计算得到每个检测框的中心点来标定这个框x_center, y_center, z, class_id。 然后可以通过聚类算法在4维空间上进行聚类最后取出聚类出的每一类的点的xyz的最大值与最小值和class_id来生成聚类结果[x_min, y_min, z_min, x_max, y_max, z_max, class_id]。 代码展示 from sklearn.cluster import DBSCAN import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import numpy as npclass BBoxClusterv3:def __init__(self, bbox_list):self.bbox_list bbox_listself.clustering None# self.color_map plt.cm.get_cmap(hsv, len(set([bbox[5] for bbox in bbox_list])))def cluster(self, eps100, min_samples2):X [[bbox[0]bbox[2]/2, bbox[1]bbox[3]/2, bbox[4], bbox[5]] for bbox in self.bbox_list] # 中心点的xyz坐标和类别ID# breakpoint()self.clustering DBSCAN(epseps, min_samplesmin_samples).fit(X)def get_new_bbox_list(self):# self.cluster()labels self.clustering.labels_print(聚类出的类别,labels)new_bbox_list []for label in set(labels):if label ! -1: # Ignore noiseidxs np.where(labels label)[0]print(每一类的bboxes索引: ,idxs)bboxes np.array(self.bbox_list)[idxs]print(每一类的bboxes集合: ,bboxes)x_min np.min(bboxes[:, 0])y_min np.min(bboxes[:, 1])x_max np.max(bboxes[:, 0] bboxes[:, 2])y_max np.max(bboxes[:, 1] bboxes[:, 3])z_min np.min(bboxes[:, 4])z_max np.max(bboxes[:, 4])class_id bboxes[0, 5]new_bbox_list.append([x_min, y_min, z_min, x_max, y_max, z_max, class_id])return new_bbox_listdef draw_bbox_2d(self, bbox, ax):x_min, y_min, w, h, z, class_id bboxcolor self.color_map(class_id)# print(color)for xi in [x_min, x_minw]:for yi in [y_min, y_minh]:ax.plot([xi, xi], [yi, yi], [z, z], colorcolor, linestyledashed)for xi in [x_min, x_minw]:ax.plot([xi, xi], [y_min, y_minh], [z, z], colorcolor, linestyledashed)for yi in [y_min, y_minh]:ax.plot([x_min, x_minw], [yi, yi], [z, z], colorcolor, linestyledashed)def draw_bbox_3d(self, bbox, ax):x_min, y_min, z_min, x_max, y_max, z_max, class_id bboxcolor self.color_map(class_id)for xi in [x_min, x_max]:for yi in [y_min, y_max]:ax.plot([xi, xi], [yi, yi], [z_min, z_max], colorcolor)for xi in [x_min, x_max]:for zi in [z_min, z_max]:ax.plot([xi, xi], [y_min, y_max], [zi, zi], colorcolor)for yi in [y_min, y_max]:for zi in [z_min, z_max]:ax.plot([x_min, x_max], [yi, yi], [zi, zi], colorcolor)def visualize(self, bbox_listNone, new_bbox_listNone):fig plt.figure()ax fig.add_subplot(111, projection3d)for bbox in bbox_list:self.draw_bbox_2d(bbox, ax)for bbox in new_bbox_list:self.draw_bbox_3d(bbox, ax)plt.show()def draw(self):new_bbox_list self.get_new_bbox_list()print(bbox_list,new_bbox_list)self.visualize(bbox_list, new_bbox_list)def color_map(self, class_id):# 假设这里使用映射字典将类别 ID 映射到不同的颜色color_mapping {0: red, 1: blue, 2: green}return color_mapping.get(class_id, black) # 默认为黑色if __name__ __main__:bbox_list [#-------------------------##[x, y, w, h, z, class_id]##-------------------------#[100, 200, 50, 50, 0, 0],[110, 210, 50, 50, 1, 0],[120, 220, 50, 50, 2, 0],[130, 230, 50, 50, 3, 0],[140, 240, 50, 50, 4, 0],[200, 300, 60, 60, 0, 1],[210, 310, 60, 60, 1, 1],[220, 320, 60, 60, 2, 1],[300, 400, 70, 70, 6, 0],[310, 410, 70, 70, 7, 0],[320, 420, 70, 70, 8, 0],[400, 500, 80, 80, 9, 1],[410, 510, 80, 80, 10, 1],[420, 520, 80, 80, 11, 2]]bbox_cluster BBoxClusterv3(bbox_list)bbox_cluster.cluster()bbox_cluster.draw()假如有以下几类框 最终聚类效果
http://www.hkea.cn/news/14516629/

相关文章:

  • 深圳建设工程协会网站网络系统建设方案
  • 图片网站模板下载wordpress上传与安装包
  • 重庆做网站电话制作英文网站多少钱
  • 网站维护的作用深圳网络营销策划
  • 2017网站开发兼职普宁旅游网站设计方案
  • 买个网站空间安卓优化大师新版
  • 深圳宝安区住房和建设局网站官网WORDPRESS如何播放视频
  • 集团网站建设招标wordpress网页慢
  • 网络及建设公司网站解析软件的网站
  • 绿色环保材料网站模板下载免费网站制作手机软件的app
  • 小九自助建站网站图片大小优化
  • 一个网站如何创建多个页面wordpress网页播放器插件
  • 做网站的公司那家好。长沙视频制作公司
  • 茂名做网站的公司怎么做二维码转到网站
  • 遵义创意网站设计各大电商购物网站转化率报表
  • 建设电商网站需要多少钱营销型网站建设公司电话
  • 山东做网站的公司中国有几大电商平台
  • 梅州做网站多少钱广州站停运最新消息
  • 猪八戒网站开发合同内江市建设信息网站
  • 做经营性的网站备案条件建设手机网站大概要多少钱
  • 建设168网站广西网站建设服务好
  • 环球设计官网网站wordpress的登录界面
  • 呼和浩特网站优化公司茶山镇仿做网站
  • 没有后台的网站怎么做排名做自媒体需要哪些网站
  • 淄博哪家公司做网站最好3d动画制作软件下载
  • 个人做淘宝客网站不能备案吗中小企业管理软件下载
  • 松岗建设网站易企秀类似的软件
  • 官方网站app最新下载wordpress 页面内分页
  • 北京好网站制作公司哪家好支付网站怎么设计的
  • 泉州网站建设公司首选公司合肥建站