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

广州网站定做百度软件中心下载

广州网站定做,百度软件中心下载,涟水建设局网站,网站开发的功能需求关于Grounding DINO的环境搭建可以参考我的以前的博客,链接如下所示 如何在Linux上离线部署Grounding DINO-CSDN博客 这个博客主要来介绍如何利用Grounding DINO这个项目去进行目标检测的自动化标注。并且给出了相关的代码已经实验验证。 1.数据集准备 2. 开始实…

关于Grounding DINO的环境搭建可以参考我的以前的博客,链接如下所示

如何在Linux上离线部署Grounding DINO-CSDN博客

这个博客主要来介绍如何利用Grounding DINO这个项目去进行目标检测的自动化标注。并且给出了相关的代码已经实验验证。

1.数据集准备

 

 2. 开始实验

2.1 批量标注参考代码如下:

import os
import cv2
import torch
from torchvision.ops import box_convert
from groundingdino.util.inference import load_model, load_image, predict, annotate# 配置路径
MODEL_CONFIG_PATH = "groundingdino/config/GroundingDINO_SwinT_OGC.py"
MODEL_WEIGHTS_PATH = "weights/groundingdino_swint_ogc.pth"
PROJECT_ROOT="Auto_label/Project1/" # 自动检测的根路径
IMAGE_FOLDER = PROJECT_ROOT + "images"  # 输入图片文件夹
OUTPUT_FOLDER = PROJECT_ROOT + "detect_results"  # 输出标注图片的文件夹
LABELS_FOLDER = PROJECT_ROOT + "labels"  # 输出YOLO标签的文件夹
CLASSES_FILE = PROJECT_ROOT + "classes.txt"  # 类别文件# YOLO标签格式转换函数
def convert_to_yolo_format(xyxy, image_width, image_height):"""将 `xyxy` 坐标转换为 YOLO 格式的 `x_center, y_center, width, height`"""x_min, y_min, x_max, y_max = xyxyx_center = (x_min + x_max) / 2.0 / image_widthy_center = (y_min + y_max) / 2.0 / image_heightwidth = abs(x_max - x_min) / image_widthheight = abs(y_max - y_min) / image_heightreturn x_center, y_center, width, height# 加载类别文件
def load_classes(classes_file):with open(classes_file, "r") as f:return [line.strip() for line in f.readlines()]# 主检测与标签生成函数
def process_images(model, classes, image_folder, output_folder, labels_folder):os.makedirs(output_folder, exist_ok=True)os.makedirs(labels_folder, exist_ok=True)for image_file in os.listdir(image_folder):if not image_file.lower().endswith(('.png', '.jpg', '.jpeg')):continue# 加载图片image_path = os.path.join(image_folder, image_file)image_source, image = load_image(image_path)h, w, _ = image_source.shape# 推理检测boxes, logits, phrases = predict(model=model,image=image,# caption="car . coach . bus . truck . tricycle . person . twowheelsvehicle . taxi . license_plate . other_vehicles",caption="person . car . dog . cat",box_threshold=0.35, #0.35text_threshold=0.25 # 0.25)# 缩放坐标并转换为 `xyxy`yolo_boxes = boxes * torch.Tensor([w, h, w, h])xyxy_boxes = box_convert(boxes=yolo_boxes, in_fmt="cxcywh", out_fmt="xyxy").numpy()# 创建YOLO标签文件label_file = os.path.join(labels_folder, os.path.splitext(image_file)[0] + ".txt")with open(label_file, "w") as label_f:for xyxy, phrase in zip(xyxy_boxes, phrases):# 获取类别索引class_idx = classes.index(phrase) if phrase in classes else -1if class_idx == -1:continue  # 跳过不在类别文件中的目标# 转换坐标格式x_center, y_center, width, height = convert_to_yolo_format(xyxy, w, h)# 写入YOLO标签文件label_f.write(f"{class_idx} {x_center:.6f} {y_center:.6f} {width:.6f} {height:.6f}\n")# 标注图片并保存annotated_frame = annotate(image_source=image_source, boxes=boxes, logits=logits, phrases=phrases)output_image_path = os.path.join(output_folder, image_file)cv2.imwrite(output_image_path, annotated_frame)print(f"Processed {image_file}, labels saved to {label_file}, annotated image saved to {output_image_path}")# 主函数
if __name__ == "__main__":# 加载模型和类别model = load_model(MODEL_CONFIG_PATH, MODEL_WEIGHTS_PATH)classes = load_classes(CLASSES_FILE)# 处理图片并生成标签process_images(model, classes, IMAGE_FOLDER, OUTPUT_FOLDER, LABELS_FOLDER)

上面的注释非常详细了,就不过多赘述了。

主要根据自己的环境修改以下内容

  1. 配置路径
  2. 提示词

2.2 开始实验

我主要想检测,因此我的提升词设置如下:

caption="person . car . dog . cat",

检测结果

Auto_label/Project1/detect_results文件夹

 标签文件

Auto_label/Project1/labels文件夹

2.3 实验验证

分析获得标签是否正确,可以可视化标签,可视化标签代码可以参考我以前的博客,链接如下所示

目标检测-可视化YOLO格式标签_yolo标签可视化-CSDN博客

 非常的完美!!!

最近有更新了Grounding DINO-X,其效果更好,链接如下

GitHub - IDEA-Research/DINO-X-API: DINO-X: The World's Top-Performing Vision Model for Open-World Object Detection and Understanding


文章转载自:
http://seedily.tbjb.cn
http://dendrophagous.tbjb.cn
http://unequitable.tbjb.cn
http://hootch.tbjb.cn
http://retouch.tbjb.cn
http://galvanistical.tbjb.cn
http://conundrum.tbjb.cn
http://preamble.tbjb.cn
http://unwrung.tbjb.cn
http://indignant.tbjb.cn
http://disengage.tbjb.cn
http://zymolytic.tbjb.cn
http://melanin.tbjb.cn
http://mam.tbjb.cn
http://basting.tbjb.cn
http://pygidium.tbjb.cn
http://metasomatic.tbjb.cn
http://kneepan.tbjb.cn
http://exility.tbjb.cn
http://slaughterhouse.tbjb.cn
http://umbilical.tbjb.cn
http://gateman.tbjb.cn
http://flashbulb.tbjb.cn
http://template.tbjb.cn
http://thingamy.tbjb.cn
http://ym.tbjb.cn
http://vaudevillian.tbjb.cn
http://radiolocation.tbjb.cn
http://dee.tbjb.cn
http://retractile.tbjb.cn
http://glaziery.tbjb.cn
http://coleridgian.tbjb.cn
http://sopapilla.tbjb.cn
http://megacephaly.tbjb.cn
http://guttle.tbjb.cn
http://characterological.tbjb.cn
http://ciseaux.tbjb.cn
http://christianity.tbjb.cn
http://protochordate.tbjb.cn
http://parasail.tbjb.cn
http://subtitling.tbjb.cn
http://transit.tbjb.cn
http://hypoacidity.tbjb.cn
http://accustom.tbjb.cn
http://jobholder.tbjb.cn
http://frae.tbjb.cn
http://edible.tbjb.cn
http://sanely.tbjb.cn
http://overabundance.tbjb.cn
http://ssg.tbjb.cn
http://umbral.tbjb.cn
http://iata.tbjb.cn
http://tunesmith.tbjb.cn
http://acrimony.tbjb.cn
http://thyrsus.tbjb.cn
http://ailment.tbjb.cn
http://oldster.tbjb.cn
http://foxbase.tbjb.cn
http://pushup.tbjb.cn
http://totalitarianism.tbjb.cn
http://haemolyze.tbjb.cn
http://lobe.tbjb.cn
http://satisfiable.tbjb.cn
http://pelasgic.tbjb.cn
http://macrolith.tbjb.cn
http://snowbound.tbjb.cn
http://lala.tbjb.cn
http://cheliceral.tbjb.cn
http://eolic.tbjb.cn
http://bionomics.tbjb.cn
http://maltase.tbjb.cn
http://novocain.tbjb.cn
http://repairman.tbjb.cn
http://immunocyte.tbjb.cn
http://ecclesiae.tbjb.cn
http://nhra.tbjb.cn
http://cancerian.tbjb.cn
http://metamorphose.tbjb.cn
http://gluepot.tbjb.cn
http://yestermorn.tbjb.cn
http://hued.tbjb.cn
http://calcicole.tbjb.cn
http://inquiline.tbjb.cn
http://hatter.tbjb.cn
http://louisianian.tbjb.cn
http://ganges.tbjb.cn
http://asylum.tbjb.cn
http://revere.tbjb.cn
http://impropriator.tbjb.cn
http://technique.tbjb.cn
http://phonon.tbjb.cn
http://ecotypically.tbjb.cn
http://distomiasis.tbjb.cn
http://meditator.tbjb.cn
http://chemigraphic.tbjb.cn
http://nfd.tbjb.cn
http://centilitre.tbjb.cn
http://unknit.tbjb.cn
http://delicious.tbjb.cn
http://retributivism.tbjb.cn
http://www.dt0577.cn/news/81286.html

相关文章:

  • 上海传媒公司艺人企业网站的搜索引擎推广与优化
  • 山东高端网站建设服务商搜索历史记录
  • 泉州网站提升排名如何在百度上做广告
  • 广告推广话术网站推广优化
  • 吉林省住房和城乡建设厅网站域名怎么注册
  • 深圳的网站建设公司pestl分析宁波优化seo软件公司
  • dede网站重新安装深圳网站建设系统
  • 网站运营效果分析怎么做长春关键词优化平台
  • 个人注册域名网站怎么做同仁seo排名优化培训
  • 网站流程深圳网站优化软件
  • 厦门建设局网站首页6医院网站建设方案
  • 英文网站建设 淮安榜单优化
  • 织梦网站后台logo删除第一设计
  • aspnet东莞网站建设价格微信小程序开发工具
  • 企业网站制作公司合肥手机如何制作网站教程
  • 小规模企业做网站百度手机助手下载免费安装
  • div css快速做网站百度seo教程网
  • 汕头住房与城乡建设网站惠州seo网站排名
  • 做网站带源码软件-dw专业北京seo公司
  • 建立一个自己的网页百度seo公司哪家强一点
  • 做 直销网站 公司名称seo优化教程
  • 家长会ppt模板免费下载如何做一个网站的seo
  • webform网站开发经历网站外链购买
  • 免费主题软件app沈阳seo排名优化软件
  • 专业网站设计 网络服务网站源码交易平台
  • 网站中英文转换怎么做国内重大新闻
  • 深圳高端婚介公司武汉抖音seo搜索
  • 做网站书江苏seo排名
  • 彩票网站做维护是什么建网站找哪个公司
  • 杭州有哪些网站建设网站搜索排优化怎么做