LoginSignup
3
2

More than 3 years have passed since last update.

AWS DeepRacerをノリと勢いで走らせてみた

Posted at

AWS DeepRacerをノリと勢いで走らせてみた

前置き

  • ノリと勢いだけで評価関数を作成しているので、あまり参考にならないかもしれない
  • 拙い無いようなので流し見を推奨します(オイ

とりあえず評価関数(ドン

def reward_function(params):
    # 入力パラメータを読む
    track_width = params['track_width']
    distance_from_center = params['distance_from_center']

    # トラック幅から3区画幅を計算
    marker_1 = 0.1 * track_width
    marker_2 = 0.25 * track_width
    marker_3 = 0.5 * track_width

    # 中央線との距離に応じた報酬を設定
    if distance_from_center <= marker_1:
        reward = 1.0
    elif distance_from_center <= marker_2:
        reward = 0.5
    elif distance_from_center <= marker_3:
        reward = 0.1
    else:
        reward = 1e-3  # クラッシュ/オフトラックに近い

    speed = params['speed'] / 5.0
    steeringStatus = params['steering_angle']
    steeringVal = 1.0 if steeringStatus==0.0 else 0.75

    reward *= (speed * steeringVal)
    return float(reward)

パラメータについて

内容の明記は避けますが、ステアリングの角度をワザと浅く設定しています。
速度は初めてでしたので変調設定を採用(ベタ踏みでも良かったな)

学習結果

4時間学習させた結果がこちらになります(棒○分クッキング

キャプチャ.PNG
ジワ上がりですけど所々で急降下してるので評価式を見直すべきでしょうが。。。
(どうしたものかワカラナイ エロい人教えてー)

走行結果

完走することは出来ましたが、如何せん速度が乗り切れていないようで遅いです。

キャプチャ_.PNG

まとめ

DeepRacer 楽しい (これ大切)
他の方も書かれていると思いますが、パラメータ等の資料は公式ドキュメントを参照するのが良いです。

参考

Train and Evaluate AWS DeepRacer Models Using the AWS DeepRacer Console - AWS DeepRacer
https://docs.aws.amazon.com/deepracer/latest/developerguide/deepracer-console-train-evaluate-models.html

AWS DeepRacerを強化する 報酬関数実装パターンあれこれ | DevelopersIO
https://dev.classmethod.jp/machine-learning/aws-deepracer-pattern-of-reward-function/

AWS DeepRacerで報酬関数の実装をあれこれ試してみた
https://qiita.com/kai_kou/items/8a45c687baca8c9465f6

3
2
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2