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

网站做权重的好处网络营销主要做些什么工作

网站做权重的好处,网络营销主要做些什么工作,wordpress 主题 更改,海南在线分类信息平台文章目录 背景代码 背景 如果我们想要根据json标注文件,获取里面的指定目标的裁剪区域,那么我们可以根据以下代码来实现(也可以校验标注情况)。 代码 from tqdm import tqdm import os, json, cv2, copy import numpy as npdef…

文章目录

  • 背景
  • 代码

背景

如果我们想要根据json标注文件,获取里面的指定目标的裁剪区域,那么我们可以根据以下代码来实现(也可以校验标注情况)。

代码

from tqdm import tqdm
import os, json, cv2, copy
import numpy as npdef get_all_images(path, flags):result_list, filenames = [], []for root, dirs, files in os.walk(path):for file in files:filename, file_extension = os.path.splitext(file)if file_extension.lower() in flags:result_list.append(os.path.join(root, file))filenames.append(file)return result_list, filenamesdef get_labelme_info(label_file, target):anno = json.load(open(label_file, "r", encoding="utf-8"))shapes = anno['shapes']image_path = os.path.basename(anno['imagePath'])labels = []boxes = []for s in shapes:pts = s['points']x1, y1 = pts[0]x2, y2 = pts[1]label = s['label']if label in target:labels.append(label)boxes.append([x1, y1, x2, y2])return image_path, boxes, labelsdef plot_one_ori(image, boxs, label, color, mask_alpha=0.4):[x1, y1, x2, y2] = boxsmask_img = copy.deepcopy(image) # 1ori_img = copy.deepcopy(mask_img) # 1cropped_image = ori_img[y1:y2, x1:x2]img_height, img_width = image.shape[:2]size = min([img_height, img_width]) * 0.0006text_thickness = int(min([img_height, img_width]) * 0.001)cv2.rectangle(image, (x1, y1), (x2, y2), color, 3)caption = f'{"原标签-"}{label}'(tw, th), _ = cv2.getTextSize(text=caption, fontFace=cv2.FONT_HERSHEY_SIMPLEX,fontScale=size, thickness=text_thickness)th = int(th * 1.2)cv2.rectangle(image, (x1, y2),(x1 + tw, y2 + th), color, -1)cv2.rectangle(mask_img, (x1, y2),(x1 + tw, y2 + th), color, -1)cv2.putText(image, caption, (x1, y2 + th), cv2.FONT_HERSHEY_SIMPLEX, size, (255, 255, 255), text_thickness, cv2.LINE_AA)cv2.putText(mask_img, caption, (x1, y2 + th), cv2.FONT_HERSHEY_SIMPLEX, size, (255, 255, 255), text_thickness, cv2.LINE_AA)image = cv2.addWeighted(mask_img, mask_alpha, image, 1 - mask_alpha, 0)return image, cropped_imagedef cv_imread(filePath):cv_img = cv2.imdecode(np.fromfile(filePath, dtype=np.uint8), flags=cv2.IMREAD_COLOR)return cv_imgif __name__ == "__main__":img_folder = r"\\DSJ_NAS_90*******" # 原图和JSON文件位置save_target_path = r"\\DSJ_NA************" # 保存位置target = ["red_face"] # 获取指定目标,可传多个os.makedirs(save_target_path, exist_ok=True)img_list, filenames = get_all_images(img_folder, flags=[".jpg", ".png", ".jpeg"])print(filenames)for filename in filenames:fn, file_extension = os.path.splitext(filename)image_path = os.path.join(img_folder, filename)  # 图片名json_path = os.path.join(img_folder, "{}.json".format(fn))  # 标签文件名save_path = os.path.join(save_target_path, "{}.jpg".format(fn))_, ori_boxes, ori_labels = get_labelme_info(json_path, target)for box, label in zip(ori_boxes, ori_labels):x1, y1, x2, y2 = list(map(int, box))image = cv_imread(image_path)image, crop_image = plot_one_ori(image, [x1, y1, x2, y2], label, color=(0,0,255))# cv2.imshow("1",crop_image)# cv2.waitKey(1)cv2.imencode('.jpg', crop_image)[1].tofile(save_path)
http://www.mmbaike.com/news/103110.html

相关文章:

  • c 网站开发论文seo排名资源
  • 网站建设内部流程图重庆seo排名电话
  • 外贸行业网站建设公司免费建站的平台
  • 网站如何做数据分析报告黄山seo推广
  • avada做网站推广引流渠道有哪些
  • 网站栏目描述首页关键词排名
  • app开发公司前十名国内seo服务商
  • 个人做 网站2019如何免费自己创建网站
  • eclipse开发动态网站开发产品营销策划方案
  • 东莞做公众号的网站seo推广论坛
  • 潼关县住房和城乡建设局网站百度竞价推广价格
  • 园林景观设计案例网站谷歌seo外链平台
  • 网站建设公司使用图片侵权使用者有无责任百度知道首页官网
  • 网站如何做镜像百度指数搜索热度排行
  • 无锡专业做网站建设百度竞价开户流程
  • 在线做txt下载网站山东济南最新事件
  • 网络规划设计师含金量高吗网站优化网站优化
  • 利用海康威视做直播网站嘉兴网站建设制作
  • 临沂网站制作价格网络推广营销技巧
  • drupal 网站建设浏阳廖主任打人案
  • 网站版块设计是什么意思搜索引擎优化入门
  • 网站域名和空间费用免费的网站域名查询565wcc
  • 生活做爰网站网络推广是以企业产品或服务
  • 帮彩票网站做流量提升网站技术外包公司
  • 可以直接进入的网站正能量大豆网上海最新政策
  • 公司注册资金可以乱写吗重庆百度快照优化
  • 网站设计模版app用户量排名
  • 首商网官网关键词seo排名优化如何
  • axure做的购物网站crm软件
  • 在网上做翻译的网站深圳网站关键词