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

企业网站升级做三年网站需要多少钱

企业网站升级,做三年网站需要多少钱,公益广告设计图片,电商论坛将分割的mask转换为分割标签通常涉及将每个像素的类别标识#xff08;在mask中以不同的灰度值或颜色表示#xff09;转换为整数标签。这些标签通常用于机器学习或深度学习模型的训练、验证和测试阶段。 使用方式#xff0c;控制台或者命令行使用以下命令#xff1a; pyth…将分割的mask转换为分割标签通常涉及将每个像素的类别标识在mask中以不同的灰度值或颜色表示转换为整数标签。这些标签通常用于机器学习或深度学习模型的训练、验证和测试阶段。 使用方式控制台或者命令行使用以下命令 python polygon_mask_conversion.py --img_path xxx_folder --mask_path xxx_folder --mode mask2poly 转换代码来自X_anyLabeling的tool文件夹下的转换文件。 import argparse import json import os import time import cv2from PIL import Image from tqdm import tqdm from datetime import dateimport numpy as np import matplotlib as pltimport syssys.path.append(./) from anylabeling.app_info import __version__# Usage # # # # -------------------------------------------------------------------- mask2poly ----------------------------------------------------------------------# # python tools/polygon_mask_conversion.py --img_path xxx_folder --mask_path xxx_folder --mode mask2poly # # # # -------------------------------------------------------------------- poly2mask ----------------------------------------------------------------------# # [option1] python tools/polygon_mask_conversion.py --img_path xxx_folder --mask_path xxx_folder --mode poly2mask # # [option2] python tools/polygon_mask_conversion.py --img_path xxx_folder --mask_path xxx_folder --json_path xxx_folder --mode poly2mask # # # # Usage #VERSION __version__ IMG_FORMATS [.bmp,.dng,.jpeg,.jpg,.mpo,.png,.tif,.tiff,.webp,.pfm, ]class PolygonMaskConversion:def __init__(self, epsilon_factor0.001):self.epsilon_factor epsilon_factordef reset(self):self.custom_data dict(versionVERSION,flags{},shapes[],imagePath,imageDataNone,imageHeight-1,imageWidth-1,)def get_image_size(self, image_file):with Image.open(image_file) as img:width, height img.sizereturn width, heightdef mask_to_polygon(self, img_file, mask_file, json_file):self.reset()binary_mask cv2.imread(mask_file, cv2.IMREAD_GRAYSCALE)contours, _ cv2.findContours(binary_mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)for contour in contours:epsilon self.epsilon_factor * cv2.arcLength(contour, True)approx cv2.approxPolyDP(contour, epsilon, True)if len(approx) 5:continueshape {label: object,text: ,points: [],group_id: None,shape_type: polygon,flags: {},}for point in approx:x, y point[0].tolist()shape[points].append([x, y])self.custom_data[shapes].append(shape)image_width, image_height self.get_image_size(img_file)self.custom_data[imagePath] os.path.basename(img_file)self.custom_data[imageHeight] image_heightself.custom_data[imageWidth] image_widthwith open(json_file, w, encodingutf-8) as f:json.dump(self.custom_data, f, indent2, ensure_asciiFalse)def polygon_to_mask(self, img_file, mask_file, json_file):with open(json_file, r) as f:data json.load(f)polygons []for shape in data[shapes]:points shape[points]polygon []for point in points:x, y pointpolygon.append((x, y))polygons.append(polygon)image_width, image_height self.get_image_size(img_file)image_shape (image_height, image_width)binary_mask np.zeros(image_shape, dtypenp.uint8)for polygon_points in polygons:np_polygon np.array(polygon_points, np.int32)np_polygon np_polygon.reshape((-1, 1, 2))cv2.fillPoly(binary_mask, [np_polygon], color255)cv2.imwrite(mask_file, binary_mask)def main():parser argparse.ArgumentParser(descriptionPolygon Mask Conversion)parser.add_argument(--img_path, helpPath to image directory)parser.add_argument(--mask_path, helpPath to mask directory)parser.add_argument(--json_path, default, helpPath to json directory)parser.add_argument(--epsilon_factor,default0.001,typefloat,helpControl the level of simplification when converting a polygon contour to a simplified version,)parser.add_argument(--mode,choices[mask2poly, poly2mask],requiredTrue,helpChoose the conversion mode what you need,)args parser.parse_args()print(fStarting conversion to {args.mode}...)start_time time.time()converter PolygonMaskConversion(args.epsilon_factor)if args.mode mask2poly:file_list os.listdir(args.mask_path)for file_name in tqdm(file_list, descConverting files, unitfile, colourblue):img_file os.path.join(args.img_path, file_name)mask_file os.path.join(args.mask_path, file_name)json_file os.path.join(args.img_path, os.path.splitext(file_name)[0] .json)converter.mask_to_polygon(img_file, mask_file, json_file)elif args.mode poly2mask:# Only binary mask transformations are supported.os.makedirs(args.mask_path, exist_okTrue)file_list os.listdir(args.img_path)for file_name in tqdm(file_list, descConverting files, unitfile, colourblue):base_name, suffix os.path.splitext(file_name)if suffix.lower() not in IMG_FORMATS:continueimg_file os.path.join(args.img_path, file_name)if not args.json_path:json_file os.path.join(args.img_path, base_name .json)else:json_file os.path.join(args.json_path, base_name .json)mask_file os.path.join(args.mask_path, base_name .png)converter.polygon_to_mask(img_file, mask_file, json_file)end_time time.time()print(fConversion completed successfully!)print(fConversion time: {end_time - start_time:.2f} seconds)if __name__ __main__:main()
http://www.w-s-a.com/news/310239/

相关文章:

  • 织梦做社交网站合适吗网站的市场如何制作
  • 阳曲网站建设价格多少四川佳和建设工程网站
  • 免费注册店铺位置sem seo什么意思
  • 建筑网站搜图电子商务网站建设渠道
  • 学校网站内容四川手机网站开发
  • 网站制作公司违法商业网站运营成本
  • 显示佣金的网站是怎么做的广告设计主要做哪些
  • 做阿里网站的分录济南seo网站排名关键词优化
  • 北京建设银行纪念钞预定官方网站wordpress中文优化版
  • 宝安做棋牌网站建设找哪家效益快创意设计师个人网站
  • 做线上网站需要多少钱系统开发板价格
  • 建筑企业登录哪个网站wordpress feed地址
  • 网站建设流程百科提升seo搜索排名
  • 杭州网站建设 巴零做销售怎么和客户聊天
  • 北京自己怎样做网站wordpress oauth2插件
  • 上海800做网站wordpress建站的好处
  • 婚纱摄影网站设计模板如何做好网站内容
  • cdn网站加速招商计划书模板ppt
  • 我在某网站网站做代理开发小程序外包
  • 设计网站国外商城网站的建设费用
  • 网站开发工作需要什么专业学做网站游戏教程
  • 电子商务网站规划 分析 设计杭州网站优化平台
  • 汕头企业自助建站系统网站后台登陆验证码无法显示
  • 宁波网站制作服务做外贸推广自己网站
  • php 微信 网站开发青岛网站互联网公司
  • 网站软件免费下载大全网站建设开发价格高吗
  • asp网站制作软件上海做网站制作
  • 福田区住房和建设局网站好搜搜索引擎
  • 平面设计师看的网站济南机场建设
  • 俄文网站开发翻译平台页面设计模板