当前位置: 首页 > news >正文

seo短视频网页入口石家庄seo按天扣费

seo短视频网页入口,石家庄seo按天扣费,衣服货源怎么找厂家拿,那种直播软件从哪里下载限时开放#xff0c;猛戳订阅#xff01; #x1f449; 《一起玩蛇》#x1f40d; #x1f4ad; 写在前面#xff1a; 本篇是关于多伦多大学自动驾驶专业项目的博客。GYM-Box2D CarRacing 是一种在 OpenAI Gym 平台上开发和比较强化学习算法的模拟环境。它是流行的 Box2…    限时开放猛戳订阅  《一起玩蛇》 写在前面 本篇是关于多伦多大学自动驾驶专业项目的博客。GYM-Box2D CarRacing 是一种在 OpenAI Gym 平台上开发和比较强化学习算法的模拟环境。它是流行的 Box2D 物理引擎的一个版本经过修改以支持模拟汽车在赛道上行驶的物理过程。模块化组件 (Modular Pipeline) 分为 低层次感知与场景解析、路径训练 和车辆控制本章我们要讲解的内容是 路径训练 (Path training) 部分。 多伦多大学自动驾驶专项课程Motion Planning for Self-Driving Cars | Coursera Gym Car Racing 文档Car Racing - Gym Documentation Ⅰ. 前置知识Antecedent 0x00 规划与决策 问题 ➢ 目标寻找并遵循一条从这里到目的地的路径需要考虑静态基础设施和动态物体➢ 输入车辆和感知的周围环境状态➢ 输出将路径或轨迹解析给车辆控制器难点 ➢ 驾驶情况和行为是非常复杂的➢ 因此很难将其作为一个单一的优化问题来建模然而要考虑的东西可远不止这些…… 思路 将规划问题分解成更简单的问题的层次结构。每个问题都根据其范围和抽象程度进行调整。在这个层次结构中越前意味着抽象程度越高。每个优化问题都会有约束条件和目标函数。 路线规划通过道路网络的路线。行为层面响应环境的运动规范。运动规划解决一个完成规范的可行路径。反馈控制调整执行变量以纠正执行路径中的错误。 0x01 路径规划Route Planning 以有向图表示道路网络边缘权重对应于路段长度或旅行时间问题转化为一个最小成本的图网络问题推理算法狄克斯特拉算法A∗ 算法……0x02 行为层Behavioral Layer 根据当前车辆 / 环境状态选择驾驶行为。 例如在停车线停车观察其他交通参与者穿行。 通常通过有限状态机进行建模过渡由感知控制。 可以通过概率建模例如使用马尔科夫决策过程MDPs。 运动规划 找到可行、舒适、安全和快速的车辆路径 / 轨迹。 在大多数情况下精确解在计算上难以处理。因此通常使用数值近似。 方法变分法、图搜索、基于增量树 。 本地反馈控制 反馈控制器执行来自运动规划器的 路径 / 轨迹 修正了因车辆模型不准确而产生的错误 注重耐用性、稳定性和舒适性 车辆动力学与控制  路径算法 自动驾驶文献中使用的规划算法有很多本章我们只关注其中的几个即可。 道路网络图 路径规划算法 0x03 行为规划Behavior Planning 简单车辆行为的有限状态机在驾驶过程中汽车需要各种机动动作减速、停车、沿车道行驶等。将汽车行为离散化为原子机动开发人员为每个机动设计一个运动规划器。 处理多种情况 0x04 运动规划Motion Planning 变分优化分析Variational Optimization变分法最小化一个函数以一个函数作为输入函数 变分优化的例子 图形搜索方法将动作空间离散化以绕过变分优化 增量搜索技术Incremental Search Techniques 逐步建立配置空间的越来越细的离散化。 快速探索随机树RRT和 RRT* 算法。 RRT 符合 A* 的算法 Ⅱ. 实验说明Experiment 0x00 模板提供 实现模块化管道的简化版本了解基本概念并获得开发简单自动驾驶应用程序的经验。 提供模板 1. waypoint_prediction.py  import numpy as np import matplotlib.pyplot as plt from scipy.signal import find_peaks from scipy.interpolate import splprep, splev from scipy.optimize import minimize import time import sysdef normalize(v):norm np.linalg.norm(v,axis0) 0.00001return v / norm.reshape(1, v.shape[1])def curvature(waypoints):##### TODO #####Curvature as the sum of the normalized dot product between the way elementsImplement second term of the smoothin objective.args: waypoints [2, num_waypoints] !!!!!Example)norm_diff normalize(arguments)norm_diff.shape : (2, num_waypoints)curvature example:3.9999937500073246return curvaturedef smoothing_objective(waypoints, waypoints_center, weight_curvature40):Objective for path smoothingargs:waypoints [2 * num_waypoints] !!!!!waypoints_center [2 * num_waypoints] !!!!!weight_curvature (default40)# mean least square error between waypoint and way point centerls_tocenter np.mean((waypoints_center - waypoints)**2)# derive curvaturecurv curvature(waypoints.reshape(2,-1))return -1 * weight_curvature * curv ls_tocenterdef waypoint_prediction(roadside1_spline, roadside2_spline, num_waypoints6, way_type smooth):##### TODO #####Predict waypoint via two different methods:- center- smooth args:roadside1_splineroadside2_splinenum_waypoints (default6)parameter_bound_waypoints (default1)waytype (defaultsmoothed)if way_type center:##### TODO ###### create spline argumentsExample)t np.linspace(arguments)t.shape : (num_waypoints,)# derive roadside points from splineExample)roadside1_points np.array(splev(arguments))roadside2_points np.array(splev(arguments))roadside1_points.shape : (2, num_waypoints)roadside2_points.shape : (2, num_waypoints)roadside1_points example :array([[37. , 37. , 37. , 37. , 37. , 37. ],[ 0. , 12.8, 25.6, 38.4, 51.2, 64. ]])roadside2_points example :array([[58. , 58. , 58. , 58. , 58. , 58. ],[ 0. , 12.8, 25.6, 38.4, 51.2, 64. ]])# derive center between corresponding roadside pointsExample)way_points np.array( {derive center between corresponding roadside points} )way_points.shape : (2, num_waypoints)way_points example :array([[47.5, 47.5, 47.5, 47.5, 47.5, 47.5],[ 0. , 12.8, 25.6, 38.4, 51.2, 64. ]])return way_pointselif way_type smooth:##### TODO ###### create spline pointsExample)t np.linspace(arguments)t.shape : (num_waypoints,)# roadside points from splineExample)roadside1_points np.array(splev(arguments))roadside2_points np.array(splev(arguments))roadside1_points.shape : (2, num_waypoints)roadside2_points.shape : (2, num_waypoints)roadside1_points example :array([[37. , 37. , 37. , 37. , 37. , 37. ],[ 0. , 12.8, 25.6, 38.4, 51.2, 64. ]])roadside2_points example :array([[58. , 58. , 58. , 58. , 58. , 58. ],[ 0. , 12.8, 25.6, 38.4, 51.2, 64. ]])# center between corresponding roadside pointsExample)way_points_center (np.array( {derive center between corresponding roadside points} )).reshape(-1)way_points_center.shape : (num_waypoints*2,)way_points_center example :array([47.5, 47.5, 47.5, 47.5, 47.5, 47.5, 0. , 12.8, 25.6, 38.4, 51.2, 64. ])# optimizationscipy.optimize.minimize Doc.)https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.htmlExample)way_points minimize(arguments)way_points.shape : (num_way_points*2,)way_points example :array([47.5, 47.5, 47.5, 47.5, 47.5, 47.5, 0. , 12.8, 25.6, 38.4, 51.2, 64. ])return way_points.reshape(2,-1)def target_speed_prediction(waypoints, num_waypoints_used5,max_speed60, exp_constant4.5, offset_speed30):##### TODO #####Predict target speed given waypointsImplement the function using curvature()args:waypoints [2,num_waypoints] for curv_centernum_waypoints_used (default5) for curv_centermax_speed (default60) for target_speedexp_constant (default4.5) for target_speedoffset_speed (default30) for target_speedoutput:target_speed (float)Example)curv_center ~~~target_speed ~~~return target_speed 2. Test_waypoint_prediction.py 用于测试 import gym from gym.envs.box2d.car_racing import CarRacingfrom lane_detection import LaneDetection from waypoint_prediction import waypoint_prediction, target_speed_prediction import matplotlib.pyplot as plt import numpy as np import pyglet from pyglet import gl from pyglet.window import key import pygame# action variables action np.array([0.0, 0.0, 0.0]) def register_input():for event in pygame.event.get():if event.type pygame.KEYDOWN:if event.key pygame.K_LEFT:action[0] -1.0if event.key pygame.K_RIGHT:action[0] 1.0if event.key pygame.K_UP:action[1] 0.5if event.key pygame.K_DOWN:action[2] 0.8 # set 1.0 for wheels to block to zero rotationif event.key pygame.K_r:global retryretry Trueif event.key pygame.K_s:global recordrecord Trueif event.key pygame.K_q:global quitquit Trueif event.type pygame.KEYUP:if event.key pygame.K_LEFT and action[0] 0.0:action[0] 0if event.key pygame.K_RIGHT and action[0] 0.0:action[0] 0if event.key pygame.K_UP:action[1] 0if event.key pygame.K_DOWN:action[2] 0# init environement env CarRacing() env.render() env.reset()# define variables total_reward 0.0 steps 0 restart False# init modules of the pipeline LD_module LaneDetection()# init extra plot fig plt.figure() plt.ion() plt.show()while True:# perform stepregister_input()s, r, done, speed env.step(action)# lane detectionlane1, lane2 LD_module.lane_detection(s)# waypoint and target_speed predictionwaypoints waypoint_prediction(lane1, lane2)target_speed target_speed_prediction(waypoints)# rewardtotal_reward r# outputs during trainingif steps % 2 0 or done:print(\naction str([{:0.2f}.format(x) for x in action]))print(step {} total_reward {:0.2f}.format(steps, total_reward))LD_module.plot_state_lane(s, steps, fig, waypointswaypoints)steps 1env.render()# check if stopif done or restart or steps600: print(step {} total_reward {:0.2f}.format(steps, total_reward))breakenv.close() 0x01 道路中心Road Center 汽车的一个简单路径是沿着道路中心行驶使用车道边界样条曲线导出 6 个等距样条曲线参数值的车道边界点。 →  waypoint_prediction() 使用相同样条曲线参数确定车道边界点之间的中心 →  waypoint_prediction()  0x02 路径平滑Path Smoothing 由于我们正在创建一辆赛车我们需要根据道路的走向来调整航点例如打到顶点。我们通过最小化以下方程来做到这一点。在给定中心航路点  的情况下通过最小化以下关于航路点  的目标来改善路径。 解释第二项的效果并实施第二项。 其中 是为了最小化目标而变化的航点 是任务中估计的中心航点。 → curvature()  0x03 目标速度预测Target Speed Prediction 除了空间路径外我们还需要知道汽车在路径上应该开多快。从启发式的角度来看如果路径是平滑的汽车应该加速到最大速度并在转弯前减速。实现一个函数输出状态图像中预测路径的目标速度参考如下公式 * 初始参数采用 → target_speed_prediction()  Ⅲ. 代码实现 0x00 curvature 函数 提供的基础模板如下 def curvature(waypoints):##### TODO #####Curvature as the sum of the normalized dot product between the way elementsImplement second term of the smoothin objective.args: waypoints [2, num_waypoints] !!!!!Example)norm_diff normalize(arguments)norm_diff.shape : (2, num_waypoints)curvature example:3.9999937500073246return curvature 根据提示可知该部分属于计算路径曲率。曲率作为路元素之间的归一化点积之和实现平滑目标的第二项。根据提示输入的是一个二维数组其中每一列代表路径中的一个点。 首先定义出 curv我们可以从第二个点开始遍历到倒数第二个点计算每个点的曲率。 curv 0 for p in range(1, waypoints.shape[1] - 1):... 创建数组分别记录当前点、上一个点和下一个点 x np.array(waypoints[:, p])y np.array(waypoints[:, p 1])z np.array(waypoints[:, p - 1]) 这里可以使用 reshape  函数reshape() 函数的功能是改变数组或矩阵的形状并将这些数组改为一个2行的二维新数组。 px, py, pz x.reshape(N, AUTO_CALC), y.reshape(N, AUTO_CALC), z.reshape(N, AUTO_CALC)然后可以使用 np.dot() 返回两个数组的点积 matrixA normalize(px - pz)matrixB normalize(py - px)matrixB_T matrixB.transpose() # .transpose() .Tdot_product np.dot(matrixB_T, matrixA) 最后再利用 flatten()  将结果降维最后返回 curv 即可。 curv dot_product.flatten()return curv 0x01 smoothing_objective 函数 def smoothing_objective(waypoints, waypoints_center, weight_curvature40):Objective for path smoothingargs:waypoints [2 * num_waypoints] !!!!!waypoints_center [2 * num_waypoints] !!!!!weight_curvature (default40)# mean least square error between waypoint and way point centerls_tocenter np.mean((waypoints_center - waypoints)**2)# derive curvaturecurv curvature(waypoints.reshape(2,-1))return -1 * weight_curvature * curv ls_tocenter ls_tocenter np.mean((waypoints_center - waypoints.reshape(2, -1))**2)0x02 waypoint_prediction 函数 def waypoint_prediction(roadside1_spline, roadside2_spline, num_waypoints6, way_type smooth):##### TODO #####Predict waypoint via two different methods:- center- smooth args:roadside1_splineroadside2_splinenum_waypoints (default6)parameter_bound_waypoints (default1)waytype (defaultsmoothed)if way_type center:##### TODO ###### create spline argumentsExample)t np.linspace(arguments)t.shape : (num_waypoints,)num_waypoints_default 6parameter_bound_waypoints_default 1# 利用 linsapce() 创建等差数列AP np.linspace( 0, parameter_bound_waypoints_default, num_waypoints_default)way_points np.zeros((N, num_waypoints))# derive roadside points from splineExample)roadside1_points np.array(splev(arguments))roadside2_points np.array(splev(arguments))roadside1_points.shape : (2, num_waypoints)roadside2_points.shape : (2, num_waypoints)roadside1_points example :array([[37. , 37. , 37. , 37. , 37. , 37. ],[ 0. , 12.8, 25.6, 38.4, 51.2, 64. ]])roadside2_points example :array([[58. , 58. , 58. , 58. , 58. , 58. ],[ 0. , 12.8, 25.6, 38.4, 51.2, 64. ]])# 中间点可视化: B样条和它的导数插值# display1, display2 splev(AP, roadside1_spline), splev(AP, roadside2_spline)# p1 np.array(display1)# p2 np.array(display2)p1 np.array(splev(AP, roadside1_spline))p2 np.array(splev(AP, roadside2_spline))# derive center between corresponding roadside pointsExample)way_points np.array( {derive center between corresponding roadside points} )way_points.shape : (2, num_waypoints)way_points example :array([[47.5, 47.5, 47.5, 47.5, 47.5, 47.5],[ 0. , 12.8, 25.6, 38.4, 51.2, 64. ]])p1_sp, p2_sp p1.shape[1], p2.shape[1]for i in range( min(p1_sp, p2_sp) ):way_points[:, i] np.array( (p1[:, i] p2[:, i]) / 2) # 求中点return way_pointselif way_type smooth:##### TODO ###### create spline pointsExample)t np.linspace(arguments)t.shape : (num_waypoints,) # roadside points from splineExample)roadside1_points np.array(splev(arguments))roadside2_points np.array(splev(arguments))roadside1_points.shape : (2, num_waypoints)roadside2_points.shape : (2, num_waypoints)roadside1_points example :array([[37. , 37. , 37. , 37. , 37. , 37. ],[ 0. , 12.8, 25.6, 38.4, 51.2, 64. ]])roadside2_points example :array([[58. , 58. , 58. , 58. , 58. , 58. ],[ 0. , 12.8, 25.6, 38.4, 51.2, 64. ]])# center between corresponding roadside pointsExample)way_points_center (np.array( {derive center between corresponding roadside points} )).reshape(-1)way_points_center.shape : (num_waypoints*2,)way_points_center example :array([47.5, 47.5, 47.5, 47.5, 47.5, 47.5, 0. , 12.8, 25.6, 38.4, 51.2, 64. ])way_points_center waypoint_prediction(roadside1_spline, roadside2_spline, way_type center)# optimizationscipy.optimize.minimize Doc.)https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.htmlExample)way_points minimize(arguments)way_points.shape : (num_way_points*2,)way_points example :array([47.5, 47.5, 47.5, 47.5, 47.5, 47.5, 0. , 12.8, 25.6, 38.4, 51.2, 64. ])# 利用 minimize 进行非线性优化 # minimize(func, xo, args, **pos) # func:优化目标 # xo:优化参数初始值 # args:优化目标中其他参数的值way_points minimize (smoothing_objective,(way_points_center),args way_points_center)[x]return way_points.reshape(2,-1) 0x03 target_speed_prediction 函数 提供的模板如下 def target_speed_prediction(waypoints, num_waypoints_used5,max_speed60, exp_constant4.5, offset_speed30):##### TODO #####Predict target speed given waypointsImplement the function using curvature()args:waypoints [2,num_waypoints] for curv_centernum_waypoints_used (default5) for curv_centermax_speed (default60) for target_speedexp_constant (default4.5) for target_speedoffset_speed (default30) for target_speedoutput:target_speed (float)Example)curv_center ~~~target_speed ~~~return target_speed 这里只需要将提供的公式写成代码形式即可最后将结果返回。 Vmax max_speedVmin offset_speedKv exp_constantN num_waypoints_usedE curvature(waypoints)# Path Planning 公式Vtarget (Vmax - Vmin) * math.exp( -Kv * abs(N - 2 - E) ) Vmin 0x04 运行结果演示 cd 到 skeleton 文件夹的路径下输入 python test_lane_detection 运行代码 运行结果如下 ​​ [ 笔者 ]   王亦优[ 更新 ]   2023.2.23 ❌ [ 勘误 ]   /* 暂无 */[ 声明 ]   由于作者水平有限本文有错误和不准确之处在所难免本人也很想知道这些错误恳望读者批评指正 参考资料  [6] Montemerlo M, Becker J, Bhat S, et al. Junior: The Stanford entry in the Urban Challenge Slide Credit: Steven Waslander Course 自动驾驶课程Motion Planning for Self-Driving Cars | Coursera LaValle: Rapidly-exploring random trees: A new tool for path planning. Techical Report, 1998 Dolgov et al.: Practical Search Techniques in Path Planning for Autonomous Driving. STAIR, 2008. Microsoft. MSDN(Microsoft Developer Network)[EB/OL]. []. . 百度百科[EB/OL]. []. https://baike.baidu.com/. . [EB/OL]. []. https://blog.waymo.com/2021/10/the-waymo-driver-handbook-perception.html.
http://www.w-s-a.com/news/483565/

相关文章:

  • 优秀的电子商务网站教育公司网站建设文案
  • 网站开发市场成本网站链接推广工具
  • 猪八戒做网站排名常州seo博客
  • wordpress 网站遭篡改如何优化公司的网站
  • 汉中公司做网站网站建设的风格设置
  • 网站建议怎么写怎么做网页连接
  • 站长工具seo综合查询下载安装软件平台搭建包括哪几个方面
  • 做网站怎么存放视频支付功能网站建设
  • 庆阳手机网站设计兰州网站的优化
  • 企业网站托管有必要吗项目管理资格证书
  • 检索类的网站建设个人博客网页模板图片
  • 贵阳网站建设搜q479185700做网站有什么语言好
  • 制作公司主页网站贵阳网站建设技术托管
  • 广西建设网站网址多少钱南京江北新区地图
  • 网站建设及优化 赣icp外包服务美剧
  • wordpress添加菜单深圳优化网站排名
  • 免费下载建设银行官方网站重点专业建设验收网站
  • 建行官方网站登录怎样制作悬浮的WordPress
  • 建设一个网站需要几个角色广告设计与制作就业前景
  • 侵入别人的网站怎么做怎么修改网站排版
  • 网站如何提交百度收录什么最便宜网站建设
  • 商丘网站建设想象力网络做公司网站需要准备什么
  • 滁州新手跨境电商建站哪家好网站推广运作怎么做
  • 烟台有没有做网站大连建设工程信息网专家库
  • 网站建设明确细节商贸有限公司的经营范围
  • 南宁微网站开发做的好的有哪些网站
  • 好的素材下载网站读书网网站建设策划书
  • 东莞南城网站建设wordpress用户投稿插件
  • 开个网站做代理赚钱吗沽源网站建设
  • 做卖车网站需要什么手续wordpress 主题 demo