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

网站整合推广电子产品网站建设分析的摘要

网站整合推广,电子产品网站建设分析的摘要,自己服务器建设网站,医疗行业企业网站建设文章目录 参考链接步骤认识正确的instances_val2017.json文件格式 代码#xff08;mogui_tococo.py#xff0c;用于我自己的数据集#xff09; 参考链接 需要先在环境中安装pycocotools pip install pycocotools魔鬼面具的代码#xff1a;objectdetection-tricks/tricks_… 文章目录 参考链接步骤认识正确的instances_val2017.json文件格式 代码mogui_tococo.py用于我自己的数据集 参考链接 需要先在环境中安装pycocotools pip install pycocotools魔鬼面具的代码objectdetection-tricks/tricks_4.py 相关视频教学tricks_4 用于yolov5和v7中的yolo格式转换coco格式的脚本.(如何在v5和v7中输出ap_small,ap_middle,ap_large coco指标) 一些概念上的了解通过pycocotools获取每个类别的COCO指标 步骤 步骤很简单但难在第一步 得到待检测的数据集的instances_val2017.json文件参考魔鬼面具代码和视频即可我直接使用起来有错应该是因为数据集分布的问题在test.py里面定位到anno_json 然后指明1得到的instances_val2017.json文件的位置我是像下面那样直接指明的绝对位置 anno_json rG:\pycharmprojects\autodl-yolov7\yolov7-main-biyebase\TXTOCOCO\instances_val2017.json在test.py中定位到--save-json, actionstore_true,然后加上defaultTrue,加上就能检测大中小尺寸了就算json文件格式不对也不会直接报错终止但是不会出现结果 认识正确的instances_val2017.json文件格式 圈起来的就是正确信息如果annotations为0 items的话那就说明转出来的json文件内容有误下图格式是在AutoDL云服务器上看的看起来比较清楚本地上看就比较杂乱。之前一直我运行一直有错就是因为没有转正确我的image_id的value值写成了test/Czech_000037有了test/就报错了 instances_val2017.json和best_predictions.json对比 代码mogui_tococo.py用于我自己的数据集 参考魔鬼面具的应该会没有错以下是我针对我的数据集进行的一代你代码改动留作备份 import os import cv2 import json from tqdm import tqdm from sklearn.model_selection import train_test_split import argparseparser argparse.ArgumentParser() parser.add_argument(--root_dir, default/home/hjj/Desktop/dataset/dataset_seaship, typestr, helproot path of images and labels, include ./images and ./labels and classes.txt) parser.add_argument(--save_path, typestr, defaultinstances_val2017.json, helpif not split the dataset, give a path to a json file)arg parser.parse_args()def yolo2coco(arg):with open(rG:\pycharmprojects\autodl-yolov7\yolov7-main-biyebase\TXTOCOCO\classes.txt, r) as f:classes list(map(lambda x: x.strip(), f.readlines()))# --------------- lwd ---------------- #cities [Czech, India, Japan]indexes []for city in cities:city_imagedir fF:/A_Publicdatasets/RDD2020-1202/train_valid/{city}/images/testfor file in os.listdir(city_imagedir):indexes.append(f{city_imagedir}/{file})# --------------- lwd ---------------- #dataset {categories: [], annotations: [], images: []}for i, cls in enumerate(classes, 0):dataset[categories].append({id: i, name: cls, supercategory: mark})# 标注的idann_id_cnt 0for k, index in enumerate(tqdm(indexes)):# 支持 png jpg 格式的图片。txtPath index.replace(images, labels).replace(.jpg, .txt)# 读取图像的宽和高im cv2.imread(index)imageFile index.split(/)[-1] # img.jpgheight, width, _ im.shape# 添加图像的信息if not os.path.exists(txtPath):# 如没标签跳过只保留图片信息。continuedataset[images].append({file_name: imageFile,id: int(imageFile[:-4]) if imageFile[:-4].isnumeric() else imageFile[:-4],width: width,height: height})with open(txtPath, r) as fr:labelList fr.readlines()for label in labelList:label label.strip().split()x float(label[1])y float(label[2])w float(label[3])h float(label[4])# convert x,y,w,h to x1,y1,x2,y2H, W, _ im.shapex1 (x - w / 2) * Wy1 (y - h / 2) * Hx2 (x w / 2) * Wy2 (y h / 2) * H# 标签序号从0开始计算, coco2017数据集标号混乱不管它了。cls_id int(label[0])width max(0, x2 - x1)height max(0, y2 - y1)dataset[annotations].append({area: width * height,bbox: [x1, y1, width, height],category_id: cls_id,id: ann_id_cnt,image_id: int(imageFile[:-4]) if imageFile[:-4].isnumeric() else imageFile[:-4],iscrowd: 0,# mask, 矩形是从左上角点按顺时针的四个顶点segmentation: [[x1, y1, x2, y1, x2, y2, x1, y2]]})ann_id_cnt 1# 保存结果with open(arg.save_path, w) as f:json.dump(dataset, f)print(Save annotation to {}.format(arg.save_path))if __name__ __main__:yolo2coco(arg)
http://www.zqtcl.cn/news/641268/

相关文章:

  • 建筑网站设计大全wordpress模板死循环
  • 网站优化排名软件泌阳网站建设
  • 网站反向绑定域名企业网站的建立网络虚拟社区时对于企业
  • 重庆大渡口网站建设解决方案梓潼 网站建设 有限公司
  • 高端平面网站东营住房和城乡建设厅网站
  • 品牌网站建设e小蝌蚪易时代网站
  • 做搜狗手机网站点击软网站建设有哪些种类
  • 想自学做网站太原要做网站的公司
  • 站内seo优化淘宝网站推广策划方案
  • 福建建设执业注册中心网站网址格式怎么写
  • 网站开发外包公司坑襄垣城乡建设管理局的网站
  • 网络公司怎么做网站常州新北区网站建设
  • 扬州专业外贸网站建设推广做详情页上什么网站找素材
  • 北京做网站设计招聘深圳市住房和建设局官网平台
  • 冻品网站建设网站头图设计
  • 手机网站分辨率做多大h5微网站建设多少钱
  • 网站制作软件下载公司怎么注册邮箱帐号
  • 做婚纱网站的图片园林设计
  • 濮阳公司建站淮北城市住建网
  • 建设银行网站打不开 显示停止工作专门做地图的网站
  • 有没有人一起做网站app网站建设方案
  • 洛阳网站建设兼职企业网站建设文案
  • 动漫制作贵州seo策略
  • asp网站建设项目实训该怎么跟程序员谈做网站
  • 网站软件资源iis不能新建网站
  • 网站设计的发展趋势西安市建设工程交易网
  • 做外贸收费的服装网站武钢建设公司网站
  • wordpress 全文搜索企业网站优化策略
  • 犀牛云做网站如何网站备案需要什么东西
  • wordpress星座网站建设与优化计入什么科莫