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

海南省建设执业中心网站站长工具精品

海南省建设执业中心网站,站长工具精品,贸易公司做网站怎么样,网站建设j介绍ppt《Keras 3 :使用 Vision Transformers 进行物体检测》 作者:Karan V. Dave 创建日期:2022 年 3 月 27 日最后修改时间:2023 年 11 月 20 日描述:使用 Vision Transformer 进行对象检测的简单 Keras 实现。 (i) 此示例使用 Keras 3 在 Colab 中查看 GitHub 源 介绍 A…

《Keras 3 :使用 Vision Transformers 进行物体检测》

作者:Karan V. Dave
创建日期:2022 年 3 月 27
日最后修改时间:2023 年 11 月 20
日描述:使用 Vision Transformer 进行对象检测的简单 Keras 实现。

(i) 此示例使用 Keras 3

 在 Colab 中查看 

 GitHub 源


介绍

Alexey Dosovitskiy 等人的文章 Vision Transformer (ViT) 架构。 表明直接应用于图像序列的纯 transformer 补丁可以在对象检测任务中表现良好。

在这个 Keras 示例中,我们实现了一个对象检测 ViT 我们在加州理工学院 101 数据集上对其进行训练,以检测给定图像中的飞机。


导入和设置

import osos.environ["KERAS_BACKEND"] = "jax"  # @param ["tensorflow", "jax", "torch"]import numpy as np
import keras
from keras import layers
from keras import ops
import matplotlib.pyplot as plt
import numpy as np
import cv2
import os
import scipy.io
import shutil

准备数据集

我们使用加州理工学院 101 数据集。

# Path to images and annotations
path_images = "./101_ObjectCategories/airplanes/"
path_annot = "./Annotations/Airplanes_Side_2/"path_to_downloaded_file = keras.utils.get_file(fname="caltech_101_zipped",origin="https://data.caltech.edu/records/mzrjq-6wc02/files/caltech-101.zip",extract=True,archive_format="zip",  # downloaded file formatcache_dir="/",  # cache and extract in current directory
)
download_base_dir = os.path.dirname(path_to_downloaded_file)# Extracting tar files found inside main zip file
shutil.unpack_archive(os.path.join(download_base_dir, "caltech-101", "101_ObjectCategories.tar.gz"), "."
)
shutil.unpack_archive(os.path.join(download_base_dir, "caltech-101", "Annotations.tar"), "."
)# list of paths to images and annotations
image_paths = [f for f in os.listdir(path_images) if os.path.isfile(os.path.join(path_images, f))
]
annot_paths = [f for f in os.listdir(path_annot) if os.path.isfile(os.path.join(path_annot, f))
]image_paths.sort()
annot_paths.sort()image_size = 224  # resize input images to this sizeimages, targets = [], []# loop over the annotations and images, preprocess them and store in lists
for i in range(0, len(annot_paths)):# Access bounding box coordinatesannot = scipy.io.loadmat(path_annot + annot_paths[i])["box_coord"][0]top_left_x, top_left_y = annot[2], annot[0]bottom_right_x, bottom_right_y = annot[3], annot[1]image = keras.utils.load_img(path_images + image_paths[i],)(w, h) = image.size[:2]# resize imagesimage = image.resize((image_size, image_size))# convert image to array and append to listimages.append(keras.utils.img_to_array(image))# apply relative scaling to bounding boxes as per given image and append to listtargets.append((float(top_left_x) / w,float(top_left_y) / h,float(bottom_right_x) / w,float(bottom_right_y) / h,))# Convert the list to numpy array, split to train and test dataset
(x_train), (y_train) = (np.asarray(images[: int(len(images) * 0.8)]),np.asarray(targets[: int(len(targets) * 0.8)]),
)
(x_test), (y_test) = (np.asarray(images[int(len(images
http://www.dtcms.com/wzjs/146239.html

相关文章:

  • 未备案的网站做网页用什么软件好
  • 微信小程序联盟网站无锡seo公司
  • 阅文集团旗下哪个网站做的最好google官方版下载
  • 深圳建设行业网站百度推广竞价技巧
  • 线上推广工作是做什么的长沙seo推广
  • 武汉网站开发费用郑州网站建设最便宜
  • 苍山网站建设做网络推广有哪些平台
  • 今天重大新闻50字谷歌seo新规则
  • 南宁哪里做网站新手怎么入行seo
  • 做网络网站需要三证么百度网站首页网址
  • 如何写软文推广产品宁波seo快速优化公司
  • c 做网站性能怎么样衡阳网站建设公司
  • 室内设计网站导航今日国际新闻10条
  • 网站视觉规范制作网页设计公司
  • 鲜花网站建设规划书站长统计app下载大全
  • 一级做a爱免费网站网络推广外包加手机蛙软件
  • 简述制作网站的流程如何推广一个品牌
  • 怎样做pdf电子书下载网站seo技术分享博客
  • 做百度推广送网站2022小说排行榜百度风云榜
  • 保定公司做网站杭州百度快照优化排名推广
  • 做时时彩网站赚钱吗网络营销是什么课程
  • 北京通州个人网站建设兰州搜索引擎优化
  • 南宁网站建设推广优化哪个平台可以免费打广告
  • 成都网站排名优化app网站
  • 南京市住房和城乡建设委员会网站网页设计怎么做
  • 深圳分销网站建设手机自动排名次的软件
  • 微信小程序h5开发宁波seo运营推广平台排名
  • 做医院网站公司文件外链生成网站
  • 海尔建设网站的目的产品营销策略
  • 网站邮件推送企业查询免费