VOT测试自己的数据集
导入环境:
# 导入docker镜像 vot_toolkit.tar 路径在/nas_dataset/docker_images/vot_toolkit.tar docker load --input vot_toolkit.tar # 根据docker镜像建立容器sudo docker run --gpus all --shm-size=60g -it -v /你的本地项目路径:/test -w /test vot_toolkit
生成配置文件
在该目录下生成三个文件trackers.ini:
[TRACKALL] # <tracker-name> label = TRACKALL protocol = traxpythoncommand = tracker_vot# Specify a path to trax python wrapper if it is not visible (separate by ; if using multiple paths) paths = /test# Additional environment paths env_PATH = <additional-env-paths>;${PATH}
tracker-name(中括号那个),label,根据自己跟踪器情况而定。
paths:运行文件所在目录
command:运行跟踪器的启动文件(需要在上面的paths下有command.py这个文件。在上面这个例子就是需要在 文件目录 下面有tracker_vot.py这个文件。
然后参照官方调试用跟踪器的示例文件,修改自己的跟踪器的启动文件,添加trax等通信代码。
tracker_vot.py:
模仿官方的tracker的输入输出去写即可class NCCTracker(object):def __init__(self, image, region):"""image: np.array->[h,w,3]region: bbox"""# 帧的初始化在init中完成 self.window = max(region.width, region.height) * 2left = max(region.x, 0)top = max(region.y, 0)right = min(region.x + region.width, image.shape[1] - 1)bottom = min(region.y + region.height, image.shape[0] - 1)self.template = image[int(top):int(bottom), int(left):int(right)]self.position = (region.x + region.width / 2, region.y + region.height / 2)self.size = (region.width, region.height)def track(self, image):left = max(round(self.position[0] - float(self.window) / 2), 0)top = max(round(self.position[1] - float(self.window) / 2), 0)right = min(round(self.position[0] + float(self.window) / 2), image.shape[1] - 1)bottom = min(round(self.position[1] + float(self.window) / 2), image.shape[0] - 1)if right - left < self.template.shape[1] or bottom - top < self.template.shape[0]:return vot.Rectangle(self.position[0] + self.size[0] / 2, self.position[1] + self.size[1] / 2, self.size[0], self.size[1])cut = image[int(top):int(bottom), int(left):int(right)]matches = cv2.matchTemplate(cut, self.template, cv2.TM_CCOEFF_NORMED)min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(matches)self.position = (left + max_loc[0] + float(self.size[0]) / 2, top + max_loc[1] + float(self.size[1]) / 2)# 返回 (x_0,y_0,w,h) 和置信值return vot.Rectangle(left + max_loc[0], top + max_loc[1], self.size[0], self.size[1]), max_val```
vot.py:
import sys import copy import collections try:import trax except ImportError:raise Exception('TraX support not found. Please add trax module to Python path.')Rectangle = collections.namedtuple('Rectangle', ['x', 'y', 'width', 'height']) Point = collections.namedtuple('Point', ['x', 'y']) Polygon = collections.namedtuple('Polygon', ['points'])class VOT(object):""" Base class for Python VOT integration """def __init__(self, region_format, channels=None):""" ConstructorArgs:region_format: Region format options"""assert(region_format in [trax.Region.RECTANGLE, trax.Region.POLYGON])if channels is None:channels = ['color']elif channels == 'rgbd':channels = ['color', 'depth']elif channels == 'rgbt':channels = ['color', 'ir']elif channels == 'ir':channels = ['ir']else:raise Exception('Illegal configuration {}.'.format(channels))self._trax = trax.Server([region_format], [trax.Image.PATH], channels)request = self._trax.wait()assert(request.type == 'initialize')if isinstance(request.region, trax.Polygon):self._region = Polygon([Point(x[0], x[1]) for x in request.region])else:self._region = Rectangle(*request.region.bounds())self._image = [x.path() for k, x in request.image.items()]if len(self._image) == 1:self._image = self._image[0]self._trax.status(request.region)def region(self):"""Send configuration message to the client and receive the initializationregion and the path of the first imageReturns:initialization region"""return self._regiondef report(self, region, confidence = None):"""Report the tracking results to the clientArguments:region: region for the frame"""assert(isinstance(region, Rectangle) or isinstance(region, Polygon))if isinstance(region, Polygon):tregion = trax.Polygon.create([(x.x, x.y) for x in region.points])else:tregion = trax.Rectangle.create(region.x, region.y, region.width, region.height)properties = {}if not confidence is None:properties['confidence'] = confidenceself._trax.status(tregion, properties)def frame(self):"""Get a frame (image path) from clientReturns:absolute path of the image"""if hasattr(self, "_image"):image = self._imagedel self._imagereturn imagerequest = self._trax.wait()if request.type == 'frame':image = [x.path() for k, x in request.image.items()]if len(image) == 1:return image[0]return imageelse:return Nonedef quit(self):if hasattr(self, '_trax'):self._trax.quit()def __del__(self):self.quit()
安装vot工具包(docker 中使用可跳过已自带):
pip install git+https://github.com/votchallenge/vot-toolkit-python初始化vot workspace
在这一步的时候需要导入数据集 如果没有的话会自行下载
也可以自行导入数据集目录为 /sequences 格式如下# 如果自行导入数据集可以在后面选择 增加–nodownload参数 vot initialize votlt2019 --workspace /test
跑测试
# TRACKALL -> <tracker-name> vot evaluate --workspace /test TRACKALL
测试结果保存在 result 文件夹,测试会默认在项目目录下寻找result
生成计算指标
# vot analysis --workspace 实验存放目录 NCCPython(跟踪器名称,即上面中括号的名称) --format {html,json等}vot analysis --workspace /test TRACKALL --format json
跑分结果保存在 analysis/运行日期的文件夹/
遇到过的问题:
下载数据集时速度慢,容易断:
1. 预先解析出图像包的下载链接,通过其他下载器预先下载好,并放置到对应的位置。如无法跳过时,可以参考将执行的源码文件中下载图片的代码,注释掉已跳过对应的下载步骤,并后期通过手动加入。此方法本人实验有效,但是操作时建议多写资料以便后期维护,仅供参考。将shell的http链接通过指定端口进行下载。
VOT测试自己的数据集相关推荐
- Pytorch系列(四):猫狗大战1-训练和测试自己的数据集
Pytorch猫狗大战系列: 猫狗大战1-训练和测试自己的数据集 猫狗大战2-AlexNet 猫狗大战3-MobileNet_V1&V2 猫狗大战3-MobileNet_V3 TensorFl ...
- Windows下使用Yolov3(GPU)训练+测试自己的数据集
Windows下使用Yolov3(GPU)训练+测试自己的数据集 1.配置Yolov3 参考:Windows下使用darknet.exe跑通Yolov3 Window10+VS2017+CUDA10. ...
- 基于深度学习的三维重建(一):三维重建简介、patchmatchNet环境部署、用colmap如何测试自己的数据集
目录 1.什么是三维重建 2.MVS是什么 3.传统MVS的局限性和为什么基于深度学习的MVS性能好于传统三维重建 4.基础概念 5. patchmatchNet环境配置 6.如何测试自己的数据集(位 ...
- 如何查找论文中的代码、测试集或数据集
如何查找论文中的代码.测试集或数据集 1. 文中的链接 2.知名会议 3. paperswithcode 4. 学者主页 5. GitHub 6. 相关文献 7. 相关比赛 1. 文中的链接 有的论文 ...
- iris数据集 测试集_IRIS数据集的探索性数据分析
iris数据集 测试集 Let's explore one of the simplest datasets, The IRIS Dataset which basically is a data a ...
- 【MMDetection3D】环境搭建,使用PointPillers训练测试可视化KITTI数据集
文章目录 前言 3D目标检测概述 KITTI数据集简介 MMDetection3D 环境搭建 数据集准备 训练 测试及可视化 绘制损失函数曲线 参考资料 前言 2D卷不动了,来卷3D,之后更多地工作会 ...
- MMAction2学习笔记 使用C3D训练测试自己的数据集
新手上路,记录一下自己的学习过程,希望也能对你有所帮助. 1.数据集准备 参考官网给出的数据集准备教程 https://github.com/open-mmlab/mmaction2/blob/mas ...
- HiAGM模型源码测试【原始数据集+中文数据集】
论文链接:Hierarchy-Aware Global Model for Hierarchical Text Classification github代码链接:HiAGM HiAGM模型源码测试 ...
- 详细实现yolov5测试丶自己数据集训练测试丶Tensorrt加速优化(完 结 !)+ 跟踪(补充)
参考文献:[yolov5系列]yolov5 v6.0 环境配置.图片视频测试.模型可视化.v6.0的更新内容 Jeston AGX Orin安装Pytorch1.11.0+torchvision0 ...
- linux下yolact算法的实现,测试自己的数据集
** 环境 Ubuntu16.0 pytorch1.3.0 pycharm 代码链接:https://github.com/dbolya/yolact 下载anaconda cudnn 均为最新版 下 ...
最新文章
- Code Sign error: Provisioning profile 'xxxxxxxxxxxxxxxxxxxxxxxxx'
- Day02,Python条件判断及循环
- 亿科影视管理系统1.2.0版以及1.0版本均有后门
- sunny底层android,Android网络通信概述
- 一步步学习SPD2010--第九章节--使用可重用工作流和工作流表单
- while语句,do-while与for循环的介绍
- 跟我一起学docker(九)--持续系统集成了解下git
- CVE-2021-40444 Microsoft MSHTML RCE简单复现
- 数据处理中的过采样、下采样、联合采样和集成采样
- python身份证系统_(二)Python GUI实战:身份证信息校验系统
- 【华为云·云筑2020】AI考卷答案
- c语言查看cpu温度代码_C语言获取CPU核心温度
- FA-PEG-NHS 叶酸PEG活性酯
- 选型宝分享什么是没有基因缺陷的信息安全体系?
- Android如何避免抓包
- 走进量子计算的大门——使用量桨PaddleQuantum创建单量子比特门
- 【对学习现状的总结和思考】
- 【系统分析师之路】第三章 复盘企业信息化战略(DSS,ERP,CRM,PDM)
- #离散#SSL 1231 VIJOS 1238 容易的网络游戏
- 领英精灵安全吗?附LinkedIn领英开发客户的关键点