• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

利用Matlab自带的深度学习工具进行车辆区域检测与车型识别【Github更新!!!】(三) ...

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

前言

对前面的东西更新了一下。地方包括:
1、GUI的更新,更友好的用户界面
2、支持用手直接画车辆区域,并且识别出来
3、将proposal、detect、fine-grained classification三个步骤分离
4、在传入Classification Net的时候,不再循环传入分类,而是将检测出的proposal一起截取形成一个image4d,共同传入alexnet。此举是为了加速。

Github

https://github.com/ChenJoya/Vehicle_Detection_Recognition

效果

直接看看吧!
1、四个步骤:
载入图像:

区域推荐:(只显示了一部分)

区域精细化:

分类:

2、可以直接截取车辆区域:

3、视频中的检测与识别:

4、支持自己载入模型:

程序设计

采用CarProphet类进行接口设计,供GUI中不同的回调函数调用。

声明

global Predictor;
Predictor=CarProphet(\'Model/cifar10NetRCNN.mat\',\'Model/AlexNet_New.mat\',\'Model/cars_meta.mat\');

采用全局变量的形式,让GUI能够调用其中的成员变量和函数。

三个关键函数:

 function [Proposal,Scores]=selective_search(Predictor)
            [Proposal,Scores]=Predictor.RCNNModel.cifar10NetRCNN.RegionProposalFcn(Predictor.Mat);
        end


        function RealRegion=rcnn_forward(Predictor)
           [bboxes, scores, ~]= Predictor.RCNNModel.cifar10NetRCNN.detect(Predictor.Mat);
           CarScores=scores(:,1);
           HighProbROI_Index=find(CarScores>Predictor.Threshold);
           RealRegion=bboxes(HighProbROI_Index,:);
        end


        function [rois,classes]=classify(Predictor)
            size_=size(Predictor.RealRegion);
            length_=size_(1);
            img_batch4d=zeros(227,227,3,length_);
            for i=1:length_
              crop_roi=Predictor.RealRegion(i,:);
              img_single=imcrop(Predictor.Mat,crop_roi);
              img_single=imresize(img_single,[227 227]);
              img_batch4d(:,:,:,i)=img_single; % Constructing 4d-array images
            end
              if(~isempty(img_batch4d))
                  label_nums=Predictor.ClassifyModel.AlexNet_New.classify(img_batch4d);
                  %draw labels in picture
                  classes=Predictor.class_array.class_names(label_nums);
                  rois=Predictor.RealRegion;
              end
        end

用于显示的:

core_func文件夹下:

        function DrawMat=draw(DrawMat,HighScoreProposals)
            %draw box
            size_=size(HighScoreProposals);
            length_=size_(1);
            for i=1:length_
                     SingleBox_=HighScoreProposals(i,:);
                     DrawMat=insertObjectAnnotation(DrawMat, \'rectangle\', SingleBox_, \'\',\'LineWidth\',1);
            end
        end
 function DrawMat=draw_roi_class(DrawMat,rois,classes)
            %draw box
            size_=size(rois);
            length_=size_(1);
            for i=1:length_
                     SingleBox_=rois(i,:);
                     DrawMat=insertObjectAnnotation(DrawMat, \'rectangle\', SingleBox_, classes{i},\'LineWidth\',1);
            end
        end

       function HighScoreProposals=get_highscore_proposals(Proposals,Scores)
%score 归一化
 score_0_1_=mapminmax(Scores\',0,1);

 %选择阈值
 score_more_index=find(score_0_1_>0.5);

 %得到得分高的proposals
 HighScoreProposals=Proposals(score_more_index,:);
end 

直接在https://github.com/ChenJoya/Vehicle_Detection_Recognitionx下载吧!

注意:模型没有重新训练。有时间我再训练新的:)


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
ASCII 码新表 - 包含 Delphi 2009 的 TUnicodeCategory 分类发布时间:2022-07-18
下一篇:
Delphi:解决重绘造成的窗体闪烁问题发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap