资源简介
基于深度学习的实时车辆检测代码,详情见博客:http://blog.csdn.net/adamshan/article/details/79193775
代码片段和文件信息
# code based on:
# YAD2K https://github.com/allanzelener/YAD2K
# darkflow https://github.com/thtrieu/darkflow
# Darknet.keras https://github.com/sunshineatnoon/Darknet.keras
import numpy as np
import cv2
# def load_weights(model yolo_weight_file):
# data = np.fromfile(yolo_weight_file np.float32)
# data = data[4:]
#
# index = 0
# for layer in model.layers:
# shape = [w.shape for w in layer.get_weights()]
# if shape != []:
# kshape bshape = shape
# bia = data[index:index + np.prod(bshape)].reshape(bshape)
# index += np.prod(bshape)
# ker = data[index:index + np.prod(kshape)].reshape(kshape)
# index += np.prod(kshape)
# layer.set_weights([ker bia])
def load_weights(model yolo_weight_file):
tiny_data = np.fromfile(yolo_weight_file np.float32)[4:]
index = 0
for layer in model.layers:
weights = layer.get_weights()
if len(weights) > 0:
filter_shape bias_shape = [w.shape for w in weights]
if len(filter_shape) > 2: # For convolutional layers
filter_shape_i = filter_shape[::-1]
bias_weight = tiny_data[index:index + np.prod(bias_shape)].reshape(bias_shape)
index += np.prod(bias_shape)
filter_weight = tiny_data[index:index + np.prod(filter_shape_i)].reshape(filter_shape_i)
filter_weight = np.transpose(filter_weight (2 3 1 0))
index += np.prod(filter_shape)
layer.set_weights([filter_weight bias_weight])
else: # For regular hidden layers
bias_weight = tiny_data[index:index + np.prod(bias_shape)].reshape(bias_shape)
index += np.prod(bias_shape)
filter_weight = tiny_data[index:index + np.prod(filter_shape)].reshape(filter_shape)
index += np.prod(filter_shape)
layer.set_weights([filter_weight bias_weight])
class Box:
def __init__(self):
self.x self.y = float() float()
self.w self.h = float() float()
self.c = float()
self.prob = float()
def overlap(x1 w1 x2 w2):
l1 = x1 - w1 / 2.
l2 = x2 - w2 / 2.
left = max(l1 l2)
r1 = x1 + w1 / 2.
r2 = x2 + w2 / 2.
right = min(r1 r2)
return right - left
def box_intersection(a b):
w = overlap(a.x a.w b.x b.w)
h = overlap(a.y a.h b.y b.h)
if w < 0 or h < 0: return 0
area = w * h
return area
def box_union(a b):
i = box_intersection(a b)
u = a.w * a.h + b.w * b.h - i
return u
def box_iou(a b):
return box_intersection(a b) / box_union(a b)
def yolo_net_out_to_car_boxes(net_out threshold=0.2 sqrt=1.8 C=20 B=2 S=7):
class_num = 6
boxes = []
SS = S * S # number of grid cells
prob_size = SS * C # class probabilities
conf_size = SS * B # confidences for each grid cell
probs = net_out[0: prob_size]
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-01-29 01:40 test_images\
文件 232093 2018-01-29 01:40 test_images\test6.jpg
文件 243874 2018-01-29 01:40 test_images\test5.jpg
文件 201192 2018-01-29 01:40 test_images\test4.jpg
文件 147583 2018-01-29 01:40 test_images\test3.jpg
文件 174209 2018-01-29 01:40 test_images\test2.jpg
文件 217239 2018-01-29 01:40 test_images\test1.jpg
目录 0 2018-01-29 01:42 utils\
文件 4867 2018-01-29 01:40 utils\utils.py
文件 140 2018-01-29 01:42 utils\__init__.pyc
文件 4629 2018-01-29 01:42 utils\utils.pyc
文件 21 2018-01-29 01:40 utils\__init__.py
文件 1002237 2018-01-29 03:59 car_detection.ipynb
文件 11389950 2018-01-29 02:12 cartail0.avi
相关资源
- AI圣经《深度学习中文版》 高清.pdf版
- eyeriss项目组的深度学习加速器的总结
- 深度学习word2vector测试语料text8
- 深度学习高清中文完整版 PDF
- 神经网络与深度学习(中文+英文原版
- 吴恩达深度学习deeplearning第五课第一
- [免费完整版]Neural Networks Tricks of the
- keras实现歌词的自动生成 所需的歌词
- 《超智能体》
- Hands-on-Machine-Learning-with-Scikit-高清带书
- vgg16_reducedfc.pth
- 神经网络与深度学习应用实战
- 动手学深度学习Pytorch版.zip
- 《深度学习Deep Learning 》中文版 高清
- PyTorch深度学习.pdf
- github上tensorflow-master源码
- 深度学习之PyTorch实战计算机视觉
- 中文翻译版Neural Networks and Deep Learni
- 车辆检测负样本
- 车辆检测样本图片
- 李宏毅-一天搞懂深度学习 - pdf-有目录
- 深度学习DeepLearning
- 《神经网络与深度学习》源代码
- 深度学习基础网络模型(mnist手写体识
- 吴恩达UFLDL教程
- 深度学习:智能时代的核心驱动力量
- Deep Learning with R
- 深度学习基础(Fundamentals of Deep Lear
- 使用tensorflow实现CNN-RNN-GAN代码
- 金融股票深度学习论文整理
评论
共有 条评论