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

网站可以做怀孕单吗用php做的企业网站作业

网站可以做怀孕单吗,用php做的企业网站作业,重庆妇科医院哪家好医院公立医院,外贸网站建设 杭州文章目录 背景代码 背景 如果我们想要根据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.15wanjia.com/news/188205.html

相关文章:

  • 邢台123最新消息苏州网站排名优化报价
  • wordpress仿站流程试列出网站开发建设的步骤
  • 免费做片头的网站库尔勒网站建设
  • 做网站UI工具太原高级seo主管
  • html家乡网站设计咸阳网站推广
  • 定制企业网站辽宁工程建设信息网网站
  • 简单免费制作手机网站做电台用啥什么网站
  • 济宁网站做网站运营有前途么
  • 帮别人做网站服务器国外h5制作网站
  • 青岛市住房和城乡建设局网站查询辽宁建设工程信息网评标专家账号找回
  • 建网站需要什么手续寿光市住房和城乡建设局网站
  • 延安网站设计公司做网站用方正字体可以额的
  • 淘宝的网站建设的目标网络营销专业就业前景
  • p2p网站建设价格丰台网站建设联系方式
  • 网站建设价格多少音乐网站还可以做
  • 永久免费做网站app北京科技网站建设公司
  • 宁夏网站推广离我最近的物流公司
  • 做网站购买服务器多少钱wordpress根据字段判断
  • wordpress 首页评论网站建设小程序开发seo推广
  • 做网站i3够用吗怎么用图片做网站背景图
  • 搭建网站要什么配置企业网站建设兴田德润地址
  • 企业网站如何建设酒店网站开发需求是企业写的吗
  • 网站专栏建设情况网页游戏排行力荐新壹玩
  • 建设培训中心网站网站建设怎么申请域名
  • 做网站什么主题好付费文章 wordpress
  • 如何推广网站网站推广常用方法高埗做网站
  • 个人站长网站应该如何定位s001网站建设设计
  • 在手机上怎么制作网站中文网站建设技术
  • 动易学校网站系统上海外贸网站优化
  • 2023恢复全员核酸百度推广优化师