资源简介
无人驾驶原理与实践书籍中代码-part1
代码片段和文件信息
import numpy as np
import math
from keras.initializations import normal identity
from keras.models import model_from_json
from keras.models import Sequential Model
from keras.engine.training import collect_trainable_weights
from keras.layers import Dense Flatten Input merge Lambda
from keras.optimizers import Adam
import tensorflow as tf
import keras.backend as K
HIDDEN1_UNITS = 300
HIDDEN2_UNITS = 600
class ActorNetwork(object):
def __init__(self sess state_size action_size BATCH_SIZE TAU LEARNING_RATE):
self.sess = sess
self.BATCH_SIZE = BATCH_SIZE
self.TAU = TAU
self.LEARNING_RATE = LEARNING_RATE
K.set_session(sess)
#Now create the model
self.model self.weights self.state = self.create_actor_network(state_size action_size)
self.target_model self.target_weights self.target_state = self.create_actor_network(state_size action_size)
self.action_gradient = tf.placeholder(tf.float32[None action_size])
self.params_grad = tf.gradients(self.model.output self.weights -self.action_gradient)
grads = zip(self.params_grad self.weights)
self.optimize = tf.train.AdamOptimizer(LEARNING_RATE).apply_gradients(grads)
self.sess.run(tf.initialize_all_variables())
def train(self states action_grads):
self.sess.run(self.optimize feed_dict={
self.state: states
self.action_gradient: action_grads
})
def target_train(self):
actor_weights = self.model.get_weights()
actor_target_weights = self.target_model.get_weights()
for i in xrange(len(actor_weights)):
actor_target_weights[i] = self.TAU * actor_weights[i] + (1 - self.TAU)* actor_target_weights[i]
self.target_model.set_weights(actor_target_weights)
def create_actor_network(self state_sizeaction_dim):
print(“Now we build the model“)
S = Input(shape=[state_size])
h0 = Dense(HIDDEN1_UNITS activation=‘relu‘)(S)
h1 = Dense(HIDDEN2_UNITS activation=‘relu‘)(h0)
Steering = Dense(1activation=‘tanh‘init=lambda shape name: normal(shape scale=1e-4 name=name))(h1)
Acceleration = Dense(1activation=‘sigmoid‘init=lambda shape name: normal(shape scale=1e-4 name=name))(h1)
Brake = Dense(1activation=‘sigmoid‘init=lambda shape name: normal(shape scale=1e-4 name=name))(h1)
V = merge([SteeringAccelerationBrake]mode=‘concat‘)
model = Model(input=Soutput=V)
return model model.trainable_weights S
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 779336 2016-10-11 22:25 book_code_01\chapter_10\DDPG-Keras-Torcs-master\actormodel.h5
文件 2682 2016-10-11 22:25 book_code_01\chapter_10\DDPG-Keras-Torcs-master\actormodel.json
文件 2606 2016-10-11 22:25 book_code_01\chapter_10\DDPG-Keras-Torcs-master\ActorNetwork.py
文件 206 2016-10-11 22:25 book_code_01\chapter_10\DDPG-Keras-Torcs-master\autostart.sh
文件 2232192 2016-10-11 22:25 book_code_01\chapter_10\DDPG-Keras-Torcs-master\criticmodel.h5
文件 2916 2016-10-11 22:25 book_code_01\chapter_10\DDPG-Keras-Torcs-master\criticmodel.json
文件 2438 2016-10-11 22:25 book_code_01\chapter_10\DDPG-Keras-Torcs-master\CriticNetwork.py
文件 5962 2016-10-11 22:25 book_code_01\chapter_10\DDPG-Keras-Torcs-master\ddpg.py
文件 12208354 2016-10-11 22:25 book_code_01\chapter_10\DDPG-Keras-Torcs-master\fast.gif
文件 11140 2016-10-11 22:25 book_code_01\chapter_10\DDPG-Keras-Torcs-master\gym_torcs.py
文件 159 2016-10-11 22:25 book_code_01\chapter_10\DDPG-Keras-Torcs-master\OU.py
文件 614 2016-10-11 22:25 book_code_01\chapter_10\DDPG-Keras-Torcs-master\README.md
文件 1119 2016-10-11 22:25 book_code_01\chapter_10\DDPG-Keras-Torcs-master\ReplayBuffer.py
文件 23823 2016-10-11 22:25 book_code_01\chapter_10\DDPG-Keras-Torcs-master\snakeoil3_gym.py
文件 3062 2018-04-11 14:19 book_code_01\chapter_2\HuskyPractice-master\CMakeLists.txt
文件 437 2018-04-11 14:19 book_code_01\chapter_2\HuskyPractice-master\include\husky_high_level_controller\husky_controller.hpp
文件 471 2018-04-11 14:19 book_code_01\chapter_2\HuskyPractice-master\launch\high_controller.launch
文件 2808 2018-04-11 14:19 book_code_01\chapter_2\HuskyPractice-master\package.xm
文件 129 2018-04-11 14:19 book_code_01\chapter_2\HuskyPractice-master\README.md
文件 1059 2018-04-11 14:19 book_code_01\chapter_2\HuskyPractice-master\src\husky_controller.cpp
文件 403 2018-04-11 14:19 book_code_01\chapter_2\HuskyPractice-master\src\husky_high_level_controller_node.cpp
文件 30 2018-07-31 17:01 book_code_01\chapter_3\NDT_PCL_demo\.idea\.name
文件 1775 2018-07-31 17:01 book_code_01\chapter_3\NDT_PCL_demo\.idea\codest
文件 137 2018-07-31 17:01 book_code_01\chapter_3\NDT_PCL_demo\.idea\misc.xm
文件 276 2018-07-31 17:01 book_code_01\chapter_3\NDT_PCL_demo\.idea\modules.xm
文件 97 2018-07-31 17:01 book_code_01\chapter_3\NDT_PCL_demo\.idea\NDT_PCL_demo.iml
文件 13412 2018-07-31 19:18 book_code_01\chapter_3\NDT_PCL_demo\.idea\workspace.xm
文件 3620143 2018-07-31 17:39 book_code_01\chapter_3\NDT_PCL_demo\build\cloud3.pcd
文件 47246 2018-07-31 17:33 book_code_01\chapter_3\NDT_PCL_demo\build\CMakeCache.txt
文件 2002 2018-07-31 17:33 book_code_01\chapter_3\NDT_PCL_demo\build\CMakeFiles\3.5.1\CMakeCCompiler.cmake
............此处省略94个文件信息
相关资源
- 无人驾驶车辆模型预测控制.pdf
- 无人驾驶地图构建和高精度定位论文
- 无人驾驶汽车的路径规划与跟随控制
- 基于STM32的GPS导航无人驾驶小车
- 无人驾驶原理与实践的书籍中的代码
- 无人驾驶车辆模型预测控制 pdf
- 无人驾驶汽车概论.pdf
- 无人驾驶车辆模型预测控制 书本+源程
- 智能车辆先进技术丛书无人驾驶车辆
- 无人驾驶车辆模型预测控制by龚建伟
- 无人驾驶车辆模型预测控制
- 无人驾驶车辆模型预测控制pdf
- 智东西-自动驾驶系列课第5课课件-激
- 《无人驾驶车辆模型预测控制》原书
- 无人驾驶车辆智能行为及其测试与评
- 无人驾驶.rar
- 第一本无人驾驶技术书(By 刘少山)
- 第一本无人驾驶技术书.刘少山(高清
- 第一本无人驾驶技术书
- 无人驾驶车辆模型预测控制+自动驾驶
- 智慧交通中智慧道路无人驾驶国内外
- 无人驾驶汽车路径识别算法
- 无人驾驶车辆模型预测控制-龚建伟
- 随机快速扩展树RRT路径规划算法代码
- 矿用卡车无人驾驶系统实现方式及效
- 无人驾驶汽车关键技术
- 无人驾驶入门--Autoware使用手册
- 无人驾驶汽车的发展现状及方向.pdf
- 无人驾驶车辆模型预测控制 龚建伟
- 《无人驾驶车辆 模型预测控制》随书
评论
共有 条评论