资源简介
基于深度学习开发的自主避障算法
代码片段和文件信息
import tensorflow as tf
import numpy as np
import os
import sys
import gflags
from keras.callbacks import ModelCheckpoint
from keras import optimizers
import logz
import cnn_models
import utils
import log_utils
from common_flags import FLAGS
def getModel(img_width img_height img_channels output_dim weights_path):
“““
Initialize model.
# Arguments
img_width: Target image widht.
img_height: Target image height.
img_channels: Target image channels.
output_dim: Dimension of model output.
weights_path: Path to pre-trained model.
# Returns
model: A Model instance.
“““
model = cnn_models.resnet8(img_width img_height img_channels output_dim)
if weights_path:
try:
model.load_weights(weights_path)
print(“Loaded model from {}“.format(weights_path))
except:
print(“Impossible to find weight path. Returning untrained model“)
return model
def trainModel(train_data_generator val_data_generator model initial_epoch):
“““
Model training.
# Arguments
train_data_generator: Training data generated batch by batch.
val_data_generator: Validation data generated batch by batch.
model: Target image channels.
initial_epoch: Dimension of model output.
“““
# Initialize loss weights
model.alpha = tf.Variable(1 trainable=False name=‘alpha‘ dtype=tf.float32)
model.beta = tf.Variable(0 trainable=False name=‘beta‘ dtype=tf.float32)
# Initialize number of samples for hard-mining
model.k_mse = tf.Variable(FLAGS.batch_size trainable=False name=‘k_mse‘ dtype=tf.int32)
model.k_entropy = tf.Variable(FLAGS.batch_size trainable=False name=‘k_entropy‘ dtype=tf.int32)
optimizer = optimizers.Adam(decay=1e-5)
# Configure training process
model.compile(loss=[utils.hard_mining_mse(model.k_mse)
utils.hard_mining_entropy(model.k_entropy)]
optimizer=optimizer loss_weights=[model.alpha model.beta])
# Save model with the lowest validation loss
weights_path = os.path.join(FLAGS.experiment_rootdir ‘weights_{epoch:03d}.h5‘)
writeBestModel = ModelCheckpoint(filepath=weights_path monitor=‘val_loss‘
save_best_only=True save_weights_only=True)
# Save model every ‘log_rate‘ epochs.
# Save training and validation losses.
logz.configure_output_dir(FLAGS.experiment_rootdir)
saveModelAndLoss = log_utils.MyCallback(filepath=FLAGS.experiment_rootdir
period=FLAGS.log_rate
batch_size=FLAGS.batch_size)
# Train model
steps_per_epoch = int(np.ceil(train_data_generator.samples / FLAGS.batch_size))
validation_steps = int(np.ceil(val_data_generator.samples / FLAGS.batch_size))
model.fit_generator(train_data_generator
epochs=FLAGS
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1610372 2019-03-20 15:41 Dronet.pdf
文件 2077111 2019-03-20 15:26 RAL18_Loquercio.pdf
目录 0 2018-05-24 17:59 rpg_public_dronet-master\
文件 6455 2018-05-24 17:59 rpg_public_dronet-master\cnn.py
文件 3043 2018-05-24 17:59 rpg_public_dronet-master\cnn_models.py
文件 1645 2018-05-24 17:59 rpg_public_dronet-master\common_flags.py
文件 31 2018-05-24 17:59 rpg_public_dronet-master\constants.py
目录 0 2018-05-24 17:59 rpg_public_dronet-master\data_preprocessing\
文件 2012 2018-05-24 17:59 rpg_public_dronet-master\data_preprocessing\time_stamp_matching.py
目录 0 2018-05-24 17:59 rpg_public_dronet-master\drone_control\
目录 0 2018-05-24 17:59 rpg_public_dronet-master\drone_control\dronet\
目录 0 2018-05-24 17:59 rpg_public_dronet-master\drone_control\dronet\configs\
文件 1228 2018-05-24 17:59 rpg_public_dronet-master\drone_control\dronet\configs\outdoor.yaml
目录 0 2018-05-24 17:59 rpg_public_dronet-master\drone_control\dronet\dronet_control\
文件 191 2018-05-24 17:59 rpg_public_dronet-master\drone_control\dronet\dronet_control\CMakeLists.txt
目录 0 2018-05-24 17:59 rpg_public_dronet-master\drone_control\dronet\dronet_control\include\
目录 0 2018-05-24 17:59 rpg_public_dronet-master\drone_control\dronet\dronet_control\include\dronet_control\
文件 1960 2018-05-24 17:59 rpg_public_dronet-master\drone_control\dronet\dronet_control\include\dronet_control\deep_navigation.h
目录 0 2018-05-24 17:59 rpg_public_dronet-master\drone_control\dronet\dronet_control\launch\
文件 507 2018-05-24 17:59 rpg_public_dronet-master\drone_control\dronet\dronet_control\launch\deep_navigation.launch
文件 533 2018-05-24 17:59 rpg_public_dronet-master\drone_control\dronet\dronet_control\package.xm
目录 0 2018-05-24 17:59 rpg_public_dronet-master\drone_control\dronet\dronet_control\src\
文件 3619 2018-05-24 17:59 rpg_public_dronet-master\drone_control\dronet\dronet_control\src\deep_navigation.cpp
目录 0 2018-05-24 17:59 rpg_public_dronet-master\drone_control\dronet\dronet_perception\
文件 0 2018-05-24 17:59 rpg_public_dronet-master\drone_control\dronet\dronet_perception\__init__.py
文件 466 2018-05-24 17:59 rpg_public_dronet-master\drone_control\dronet\dronet_perception\CMakeLists.txt
目录 0 2018-05-24 17:59 rpg_public_dronet-master\drone_control\dronet\dronet_perception\launch\
文件 1066 2018-05-24 17:59 rpg_public_dronet-master\drone_control\dronet\dronet_perception\launch\bebop_launch.launch
文件 856 2018-05-24 17:59 rpg_public_dronet-master\drone_control\dronet\dronet_perception\launch\dronet_launch.launch
文件 1881 2018-05-24 17:59 rpg_public_dronet-master\drone_control\dronet\dronet_perception\launch\full_perception_launch.launch
目录 0 2018-05-24 17:59 rpg_public_dronet-master\drone_control\dronet\dronet_perception\models\
............此处省略29个文件信息
相关资源
- 012345手势识别神经网络代码
- 深度学习(SPOT-RNA)
- 深度学习YOLOv3分类算法
- Deep Learning Cookbook_ practical recipes to g
- 深度学习视频中的行为识别
- deep learning with python 中文版
- python小波包文档及论文.zip
- 一种基于邻域依赖的彩色图像非线性
- 吴恩达深度学习超参数调制完整程序
- 深度学习入门 基于python理论与实现
- Python-基于深度学习的语音增强使用
- 《深度学习Deep Learning with Python 2017》
- MyEpoch论文降重系统-LCG.zip
- 深度学习进阶:自然语言处理
- 基于Python的网络爬虫系统的设计与实
- 基于Python的分布式网络爬虫系统的设
- 基于深度学习堆栈自动编码器模型的
- 基于微信小程序的商业旅游系统开发
- 基于Python网络爬虫毕业论文.doc
- 基于Python智联招聘牌爬虫+本科毕业论
- 深度学习入门:基于python的理论与实
- 吴恩达深度学习1-21-31-42-1编程作业线
- 基于Python的深度学习
- 安全帽检测detect.7z
- deep_learning_with_python.pdf(Jason Brownlee)
- 人脸识别python代码187268
- Make Your Own Neural Network - 搭建自己的神
- BrownLee Better Deep Learning
- python 直方图规定化代码
- 简单粗暴 TensorFlow
评论
共有 条评论