Giter Club home page Giter Club logo

car-detection's Introduction

car-detection

基于对YOLOv2的迁移学习构建的神经网络模型

训练集来自于drive.ai

项目图文介绍及核心代码见项目介绍

如无法打开,可参考以下文字介绍

以下对项目实现原理做一个简要介绍

这是我在coursera的深度学习课程上完成的一个项目的源代码,属于一个自动驾驶项目的一部分,用于检测道路上的车辆及其他障碍物

数据的采集是通过汽车前置摄像头拍摄,输入数据是一系列维度为(608,608,3)的RGB格式图片

输出是一个四维向量(19,19,5,85)的向量,最后一维结构为(p,x,y,h,w,c1,c2……c80):

  p表示图片上检测出目标物体的概率,取值为(0,1)

   x,y表示物体中心点坐标(这里需要注意的是这个坐标表示的是每个网格内的坐标而不是整个图片的)

h,w表示用于标记物体的方格的高度和宽度

  c1-c80表示可以识别的80种物体类型的概率,取值在(0,1),可以检测的物体类型在coco_classes.txt中

输入样例

这一个维度用于标记图片上识别出的一个物体,也就是画出一个格子

倒数第二个维度表示5个anchor box,也就是可以同时在一个单元格中检测五个物体

前两个维度表示输入图片被切割成19x19个网格,就像围棋棋盘一样,每个单元格分别检测物体

可以看出来,在一张图片里最多可以标记出19195=1805个格子,对于一个608x608的图片,显然太多了,当中包括很多错误的标记,所以通过设置threshold值定义一个长度为80的Mask用于过滤,

对于每个anchor box:   将Mask与p*[c1……c80]比较,仅保留概率大于threshold的格子(代码里设定的threshold值为0.6)

另一个关键问题在于,存在同一个物体被多次检测的情况,即多个格子标记的是同一个物体。

为了解决这个问题,可以定义一个过滤器,这里使用的是Non-max suppression(NMS)算法,通过定义Iou(两个格子的交集除以并集)函数,确定

Iou_threshold 作为阈值,具体步骤为

   1.选取从上一步得到的格子中概率最高的

   2.计算它与其他格子的Iou,去掉所有大于Iou_threshold的格子

   3.重复1,直到没有概率比当前格子更小的

    通过调整以上两个threshold值,能够在精确度和漏检率中取得平衡

car-detection's People

Contributors

zhuangzheng avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.