TensorFlow实现简单的车辆检测

数据集:

UIUC Image Database for Car Detection。下载解压之后文件目录如图所示,这里我们所需的是TrainImages这个文件夹和TestImages文件夹。
这里写图片描述
The download package contains the following:

  1. 1050 training images (550 car and 500 non-car images)
  2. 170 single-scale test images, containing 200 cars at roughly the same scale as in the training images
  3. 108 multi-scale test images, containing 139 cars at various scales
  4. Evaluation files
  5. README file

The images are all grey-scale and are available in raw PGM format.

算法模型

采用的是CNN网络,各层参数如下所示。输入是一幅40*100*1的灰度图片,经过多次卷积和池化之后得到1*1*1的结果。

input : [None, 40, 100, 1]
conv-pool1 :
    f : 5*5
    strides : 1
    nc : 6
    padding : VALID
    maxpool : 2

conv-pool2:
    f : 5*5
    strides : 1
    nc : 16
    padding : VALID
    maxpool : 2

conv3:
    f : 5*5
    strides : 1
    nc : 32
    padding : VALID

conv4:
    f : 3*18
    strides : 1
    nc : 64
    padding : VALID

conv5:
    f : 1*1
    strides : 1
    nc : 1
    padding : VALID

output : [None, 1, 1, 1]
代码
我的文件目录组织结构:
    -CarDetect
          --CarDetect.py
          --datas
              ---CarData
          --models
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt

#定义加载数据的函数,注意训练数据的存储位置
def load_carDats
  • 4
    点赞
  • 37
    收藏
    觉得还不错? 一键收藏
  • 7
    评论
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值