基于全卷积Fully-Convolutional-Siamese-Networks的目标跟踪仿真
目录
1.算法概述
2.仿真效果预览
3.核心MATLAB代码预览
4.完整MATLAB程序
1.算法概述
1.正确版本组合:Win7+Matlab R2015b+CUDA7.5+vs2013
CUDA7.5下载地址为:
http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_windows.exe
vs2013要专业版。
如下所示:
全部安装好之后,做如下操作:
2.CPU配置,运行CNN工具箱中的 ,然后再运行 可以完成CPP文件的编译。
3.编译成功后,会产生
这些必须在电脑上编译,否则别人的复制给你,如果配置不一样,可能会报错。
4.GPU配置:
安装cudnn:https://developer.nvidia.com/rdp/cudnn-archive,放到CNN工具箱中的新建local文件夹中,
然后mex -setup下,操作和CPU一样。
然后执行matlab程序:
vl_setupnn;
vl_compilenn('enableGpu', true,'cudaRoot', 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5','cudaMethod', 'nvcc', 'enableCudnn', 'true','cudnnRoot', 'E:\A_2016_FPGA_Test\FC_tracking\A_FC\matconvnet-1.0-beta20\local\cudnn');
红色部分为你的路径,不要有中文。
5.然后运行我给的程序 ,就可以自动运行了,原来程序的运行非常麻烦,我定义了这个程序,可以一步运行处结果。
2.仿真效果预览
Win7+Matlab R2015b+CUDA7.5+vs2013
运行后,如果可以出现如下结果:
3.核心MATLAB代码预览
% -------------------------------------------------------------------------------------------------
function bboxes = tracker(varargin)
%TRACKER
% is the main function that performs the tracking loop
% Default parameters are overwritten by VARARGIN
%
% Luca Bertinetto, Jack Valmadre, Joao F. Henriques, 2016
% -------------------------------------------------------------------------------------------------% These are the default hyper-params for SiamFC-3S% The ones for SiamFC (5 scales) are in params-5s.txtp.numScale = 3;p.scaleStep = 1.0375;p.scalePenalty = 0.9745;p.scaleLR = 0.59; % damping factor for scale updatep.responseUp = 16; % upsampling the small 17x17 response helps with the accuracyp.windowing = 'cosine'; % to penalize large displacementsp.wInfluence = 0.176; % windowing influence (in convex sum)p.net = '2016-08-17.net.mat';%% execution, visualization, benchmarkp.video = 'vot15_bag';p.visualization = false;p.gpus = 1;p.bbox_output = false;p.fout = -1;%% Params from the network architecture, have to be consistent with the trainingp.exemplarSize = 127; % input z sizep.instanceSize = 255; % input x size (search region)p.scoreSize = 17;p.totalStride = 8;p.contextAmount = 0.5; % context amount for the exemplarp.subMean = false;%% SiamFC prefix and idsp.prefix_z = 'a_'; % used to identify the layers of the exemplarp.prefix_x = 'b_'; % used to identify the layers of the instancep.prefix_join = 'xcorr';p.prefix_adj = 'adjust';p.id_feat_z = 'a_feat';p.id_score = 'score';% Overwrite default parameters with vararginp = vl_argparse(p, varargin);
% -------------------------------------------------------------------------------------------------% Get environment-specific default paths.p = env_paths_tracking(p);1% Load ImageNet Video statisticsif exist(p.stats_path,'file')stats = load(p.stats_path);elsewarning('No stats found at %s', p.stats_path);stats = [];end2% Load two copies of the pre-trained networknet_z = load_pretrained([p.net_base_path p.net], p.gpus);3net_x = load_pretrained([p.net_base_path p.net], []);4p.seq_base_pathp.video[imgFiles, targetPosition, targetSize] = load_video_info(p.seq_base_path, p.video);nImgs = numel(imgFiles);startFrame = 1;5% Divide the net in 2% exemplar branch (used only once per video) computes features for the targetremove_layers_from_prefix(net_z, p.prefix_x);remove_layers_from_prefix(net_z, p.prefix_join);remove_layers_from_prefix(net_z, p.prefix_adj);% instance branch computes features for search region x and cross-correlates with z features6remove_layers_from_prefix(net_x, p.prefix_z);zFeatId = net_z.getVarIndex(p.id_feat_z);scoreId = net_x.getVarIndex(p.id_score);% get the first frame of the videoim = gpuArray(single(imgFiles{startFrame}));% if grayscale repeat one channel to match filters sizeif(size(im, 3)==1)im = repmat(im, [1 1 3]);end% Init visualizationvideoPlayer = [];if p.visualization && isToolboxAvailable('Computer Vision System Toolbox')videoPlayer = vision.VideoPlayer('Position', [100 100 [size(im,2), size(im,1)]+30]);end7% get avg for paddingavgChans = gather([mean(mean(im(:,:,1))) mean(mean(im(:,:,2))) mean(mean(im(:,:,3)))]);wc_z = targetSize(2) + p.contextAmount*sum(targetSize);hc_z = targetSize(1) + p.contextAmount*sum(targetSize);s_z = sqrt(wc_z*hc_z);scale_z = p.exemplarSize / s_z;% initialize the exemplar[z_crop, ~] = get_subwindow_tracking(im, targetPosition, [p.exemplarSize p.exemplarSize], [round(s_z) round(s_z)], avgChans);if p.subMeanz_crop = bsxfun(@minus, z_crop, reshape(stats.z.rgbMean, [1 1 3]));endd_search = (p.instanceSize - p.exemplarSize)/2;pad = d_search/scale_z;s_x = s_z + 2*pad;% arbitrary scale saturationmin_s_x = 0.2*s_x;max_s_x = 5*s_x;switch p.windowingcase 'cosine'window = single(hann(p.scoreSize*p.responseUp) * hann(p.scoreSize*p.responseUp)');case 'uniform'window = single(ones(p.scoreSize*p.responseUp, p.scoreSize*p.responseUp));end% make the window sum 1window = window / sum(window(:));scales = (p.scaleStep .^ ((ceil(p.numScale/2)-p.numScale) : floor(p.numScale/2)));% evaluate the offline-trained network for exemplar z featuresnet_z.eval({'exemplar', z_crop});z_features = net_z.vars(zFeatId).value;z_features = repmat(z_features, [1 1 1 p.numScale]);bboxes = zeros(nImgs, 4);% start trackingtic;for i = startFrame:nImgsiif i>startFrame% load new frame on GPUim = gpuArray(single(imgFiles{i}));% if grayscale repeat one channel to match filters sizeif(size(im, 3)==1)im = repmat(im, [1 1 3]);endscaledInstance = s_x .* scales;scaledTarget = [targetSize(1) .* scales; targetSize(2) .* scales];% extract scaled crops for search region x at previous target positionx_crops = make_scale_pyramid(im, targetPosition, scaledInstance, p.instanceSize, avgChans, stats, p);% evaluate the offline-trained network for exemplar x features[newTargetPosition, newScale] = tracker_eval(net_x, round(s_x), scoreId, z_features, x_crops, targetPosition, window, p);targetPosition = gather(newTargetPosition);% scale damping and saturations_x = max(min_s_x, min(max_s_x, (1-p.scaleLR)*s_x + p.scaleLR*scaledInstance(newScale)));targetSize = (1-p.scaleLR)*targetSize + p.scaleLR*[scaledTarget(1,newScale) scaledTarget(2,newScale)];else% at the first frame output position and size passed as input (ground truth)endrectPosition = [targetPosition([2,1]) - targetSize([2,1])/2, targetSize([2,1])];% output bbox in the original frame coordinatesoTargetPosition = targetPosition; % .* frameSize ./ newFrameSize;oTargetSize = targetSize; % .* frameSize ./ newFrameSize;bboxes(i, :) = [oTargetPosition([2,1]) - oTargetSize([2,1])/2, oTargetSize([2,1])];% if p.visualizationif isempty(videoPlayer)figure(1), imshow(im/255);figure(1), rectangle('Position', rectPosition, 'LineWidth', 4, 'EdgeColor', 'y');drawnowfprintf('Frame %d\n', startFrame+i);elseim = gather(im)/255;im = insertShape(im, 'Rectangle', rectPosition, 'LineWidth', 4, 'Color', 'yellow');% Display the annotated video frame using the video player object.step(videoPlayer, im);end
% endif p.bbox_outputfprintf(p.fout,'%.2f,%.2f,%.2f,%.2f\n', bboxes(i, :));endendbboxes = bboxes(startFrame : i, :);end
A000
4.完整MATLAB程序
matlab源码说明_我爱C编程的博客-CSDN博客
V
基于全卷积Fully-Convolutional-Siamese-Networks的目标跟踪仿真相关推荐
- 自动驾驶系统进阶与项目实战(三)基于全卷积神经网络的点云三维目标检测和ROS实战
自动驾驶系统进阶与项目实战(三)基于全卷积神经网络的点云三维目标检测和ROS实战 前面入门系列的文章中我介绍了几种点云三维分割/目标检测模型,在做点云预处理上,有通过球面投射(SqueezeNet)得 ...
- 吴恩达 深度学习系列--卷积神经网络(Convolutional Neural Networks)-03(目标检测)
目标检测 3.1 目标定位(Object localization) 3.1.1概念 3.1.2 监督学习任务定义目标标签y 3.2 特征点检测(Landmark detection) 3.3 基于滑 ...
- [论文翻译]V-Net:Fully Convolutional Neural Networks for Volumetric Medical Image Segmentation
论文下载: 地址 V-Net: Fully Convolutional Neural Networks for Volumetric Medical Image Segmentation V-Net: ...
- 基于全卷积神经网络的前列腺磁共振图像分割
(本科毕业论文题目.摘要.关键词及相应的英文翻译,欢迎做前列腺分割的小伙伴可以加我qq:604395564一起交流呀) 基于全卷积神经网络的前列腺磁共振图像分割 目的研究从前列腺磁共振图像中自动分割的 ...
- Fully Convolutional Adaptation Networks for Semantic Segmentation
参考 论文解析之<Fully Convolutional Adaptation Networks for Semantic Segmentation> - 云+社区 - 腾讯云 论文网址 ...
- Extract Semantic Structure from Documents Using Multimodal Fully Convolutional Neural Networks阅读笔记
Learning to Extract Semantic Structure from Documents Using Multimodal Fully Convolutional Neural Ne ...
- 人群分割--Fully Convolutional Neural Networks for Crowd Segmentation
Fully Convolutional Neural Networks for Crowd Segmentation https://arxiv.org/abs/1411.4464 这里设计了一个全卷 ...
- 深度学习之卷积神经网络(Convolutional Neural Networks, CNN)
前面, 介绍了DNN及其参数求解的方法(深度学习之 BP 算法),我们知道DNN仍然存在很多的问题,其中最主要的就是BP求解可能造成的梯度消失和梯度爆炸.那么,人们又是怎么解决这个问题的呢?本节的卷积 ...
- 卷积神经网络Convolutional Neural Networks深度解析I
知识的广度来自知识的深度,学习如果不成体系那是多可怕的一件事儿,希望我们在未来的学习道路上坚守初心,不要给自己留下遗憾,以自己喜欢的方式生活,做自己喜欢做的事,宠爱自己,做一个独一无二的自己! 对于文 ...
- 《DeepLearning.ai》第十课:卷积神经网络(Convolutional Neural Networks)
第十课:卷积神经网络(Convolutional Neural Networks) 1.1 计算机视觉(Computer vision) 通常如果处理大图用传统的神经网络需要特别大的输入,因此需要大量 ...
最新文章
- AMD依然yes!官宣锐龙5000系列CPU,单核性能首次超越英特尔,苏妈:最好的游戏CPU!...
- 前端性能之回流与重绘(reflow repaint)
- 拼多多上架专供湖北平价口罩 每天300万只
- 序列化反序列化--Xstream的使用
- c语言高级程序设计第五版PDF,C语言高级编程.pdf
- Android:BaseAdapter简单应用
- Report Service中报 RSClientController 未定义
- 38.Linux/Unix 系统编程手册(下) -- 编写安全的特权程序
- atitit 点播系统 概览 v2 qb1.docx
- 小米路由器R1D改造记录-安装MIXBOX
- ad如何绘制拼版_ad 拼板
- 物联网项目设计 (七) 基于RT-thread的MQTT协议物联网辉光钟
- 利用Python将PDF转化为图片的方法
- 基于JSoup的网络爬虫爬取小说内容
- Spring + JedisCluster操作Redis(集群)
- ngx-echarts
- 如何使用KMS(2)
- 唯一ID生成算法剖析,看看这篇就够了
- 微信分享点击回到原APP却仍然留在微信的问题
- 医院网络部绩效考核指标具体方案