登录进AWS Control 控制台
搜索“DeepRacer”并点击“AWS DeepRacer”
DeepRacer 控制台。
2019 年 DeepRacer 冠军杯”的航点图
git clone https://github.com/aws-deepracer-community/deepracer-analysis.git
cd deepracer-analysis/
python3 -m venv venv source venv/bin/activate pip install --upgrade -r requirements.txt jupyter lab
航点代表轨道上的每个位置。它有 3 条线(L = 左、C = 中心和 R = 右),它们在地图上也有 0 - 154 号。不同的赛道会有不同的航点。
为航点构建新代理。
https://github.com/oscarYCL/deepracer-waypoints-workshop/blob/main/Template.py
def reward_function(params): center_variance = params["distance_from_center"] / params["track_width"] #racing line left_lane = [8,9,10,11,12,13,14,15,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,85,86,87,88,89,90,91,92,139,140,141,142,143,144,145,146,147,148,149,150,151]#Fill in the waypoints center_lane = [0,1,2,3,4,5,6,7,16,17,18,19,20,21,22,23,26,27,28,29,30,31,32,33,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,133,134,135,136,137,138,152,153,154]#Fill in the waypoints right_lane = [24,25,120,121,122,123,124,125,126,127,128,129,130,131,132]#Fill in the waypoints #Speed fast = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,141,142,143,144,145,146,147,148,149,150,151,152,153,154]#Fill in the waypoints, 2m/s slow = [83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,139,140]#Fill in the waypoints, 1m/s reward = 21 if params["all_wheels_on_track"]: reward += 10 else: reward -= 10 if params["closest_waypoints"][1] in left_lane and params["is_left_of_center"]: reward += 10 elif params["closest_waypoints"][1] in right_lane and not params["is_left_of_center"]: reward += 10 elif params["closest_waypoints"][1] in center_lane and center_variance < 0.4: reward += 10 else: reward -= 10 if params["closest_waypoints"][1] in fast: if params["speed"] == 2 : reward += 10 else: reward -= 10 elif params["closest_waypoints"][1] in slow: if params["speed"] == 1 : reward += 10 else: reward -= 10 return float(reward)
设置快=2m/s,慢=1m/s。
点击“开始评估”。
该模型有 2 个偏离轨道,因为它只完成了约 60%。我们需要更多的训练时间。
超参数。
奖励图对比。模型训练完成率从 60% 提高到 86.05%。
评价结果对比。最佳时间从 16.315s 减少到 14.896s,所有单圈完成率 100%。
github 地址:https://github.com/zgpeace/deepracer-waypoints-workshop/tree/main/Examples/re:Invent%
def reward_function(params): center_variance = params["distance_from_center"] / params["track_width"] #racing line left_lane = [23,24,50,51,52,53,61,62,63,64,65,66,67,68]#Fill in the waypoints center_lane = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,25,26,27,28,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,54,55,56,57,58,59,60,69,70]#Fill in the waypoints right_lane = [29,30,31,32,33,34]#Fill in the waypoints #Speed fast = [0,1,2,3,4,5,6,7,8,9,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70]#Fill in the waypoints, 2m/s slow = [10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]#Fill in the waypoints, 1m/s reward = 21 if params["all_wheels_on_track"]: reward += 10 else: reward -= 10 if params["closest_waypoints"][1] in left_lane and params["is_left_of_center"]: reward += 10 elif params["closest_waypoints"][1] in right_lane and not params["is_left_of_center"]: reward += 10 elif params["closest_waypoints"][1] in center_lane and center_variance < 0.4: reward += 10 else: reward -= 10 if params["closest_waypoints"][1] in fast: if params["speed"] == 2 : reward += 10 else: reward -= 10 elif params["closest_waypoints"][1] in slow: if params["speed"] == 1 : reward += 10 else: reward -= 10 return float(reward)
https://www.linkedin.com/pulse/aws-deepracer-free-student-workshop-run-faster-using-your-cheuk-lam/?published=t
https://github.com/zgpeace/deepracer-waypoints-workshop