LoginSignup
18
6

More than 5 years have passed since last update.

AWS DeepRacerを利用する際に覚えておいたほうがよいこと

Posted at

2019/04/30にDeepRacerの仮想リーグがオープンしたタイミングでDeepRacerコンソールもGA(一般提供開始)されました。

AWS DeepRacer League Virtual Circuit がオープンしました – 自分のモデルのトレーニングを今すぐ始めましょう! | Amazon Web Services ブログ
https://aws.amazon.com/jp/blogs/news/the-aws-deepracer-league-virtual-circuit-is-now-open-train-your-model-today/

それまでもPreviewで利用できたり、Amazon SageMakerやAWS RoboMakerを利用してモデル作成はできましたが、変更点や気をつけておいたほうが良い点がありましたので、まとめていきます。

AWS DeepRacerに関する記事などのまとめは下記をご参考ください。

AWS DeepRacer関連情報まとめ【随時更新】 - Qiita
https://qiita.com/kai_kou/items/5c02d0dca26a33dd8761

AWS DeepRacerコンソールの利用方法については下記が参考になります。

ついにオープンしたAWS DeepRacer League Virtual Circuitに参加しよう! | DevelopersIO
https://dev.classmethod.jp/cloud/aws/aws-deepracer-virtual-circuit-join/

ドキュメントは英語版を参照する

4/30にDeepRacerコンソールがGAされて、同じタイミングでドキュメントも更新されました。
ただし、日本語訳の更新はまだなので英語版を参照しましょう。(2019/05/11時点)

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

特にreward_function のパラメータが変更されており、日本語訳が古いため要確認です。(2019/05/11時点)

Input Parameters of the AWS DeepRacer Reward Function - AWS DeepRacer
https://docs.aws.amazon.com/deepracer/latest/developerguide/deepracer-reward-function-input.html#reward-function-input-all_wheels_on_track

トレーニング・シミュレーション中の状況はRoboMakerでも確認できる

DeepRacerコンソールでトレーニングするとコンソール上で「Reward graph」や「Simulation video stream」が確認することができます。
スクリーンショット 2019-05-11 12.17.18.png
「Simulation video stream」は車両カメラの映像となっており、車両がコース上のどこを走っているのかがわかりにくいです。

コース上のどこを走っているのかはRoboMakerで確認できます。
RoboMaker.png
Gzclient_-_sim-v4zrphd8syjk.png
その際にツールのアイコンをいじるとシミュレーション環境の設定を変更してしまう可能性があるので、矢印のアイコンで視点変更するのにとどめておくのが無難かと思います。

トレーニング実行は同時に2つまで

トレーニングの同時実行数に制限がありました。
DeepRacerのコピー.png

You have exceeded the number training requests allowed on your account.

公式ドキュメントにDeepRacerコンソールの制限について記載がまだありません。
最大2トレーニングだと都合が悪い場合、AWSサポートへ上限緩和申請可能か問合せが必要です。

AWS Service Limits - Amazon Web Services
https://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html

Amazon SageMakerやAWS RoboMakerにも制限があるため、DeepRacerと別で利用している場合には、そちらも合わせて検討する必要があります。

ひとつの AWS アカウント で複数人が AWS DeepRacer を始めた時に注意したこと - Qiita
https://qiita.com/dnp-wada/items/18ad01dcc96e6c053cb6

reward_function でログ出力できる

reward_function で報酬設定する場合に、パラメータ値や報酬設定した結果を詳細に確認したい場合、ログ出力できます。

ログ出力の例
def reward_function(params):

    # パラメータ取得
    all_wheels_on_track = params['all_wheels_on_track']
    x = params['x']
    y = params['y']
    distance_from_center = params['distance_from_center']
    is_left_of_center = params['is_left_of_center']
    heading = params['heading']
    progress = params['progress']
    steps = params['steps']
    speed = params['speed']
    steering_angle = params['steering_angle']
    track_width = params['track_width']
    waypoints = params['waypoints']
    closest_waypoints = params['closest_waypoints']

    # ログ出力
    print("all_wheels_on_track: " + str(all_wheels_on_track))
    print("x: %.2f" % x)
    print("y: %.2f" % y)
    print("distance_from_center: %.2f" % distance_from_center)
    print("is_left_of_center: " + str(is_left_of_center))
    print("heading: %.2f" % heading)
    print("progress: %.2f" % progress)
    print("steps: " + str(steps))
    print("speed: %.2f" % speed)
    print("steering_angle: %.2f" % steering_angle)
    print("track_width: %.2f" %track_width)
    print("waypoints: " + str(len(waypoints)))
    print("closest_waypoints: " + str(closest_waypoints))

    return 1e-3

ログはAmazon CloudWatchのログから確認できます。
パスは下記のようになっています。
CloudWatch > ロググループ > /aws/robomaker/SimulationJobs > sim-xxxxxxxxxxxx/2019-略/SimulationApplicationLogs
sim-xxxxxxxxxxxx はRoboMakerのIDで、DeepRacerコンソールだと確認できないので、実行日時からあたりをつけます。(もしかしたらよい方法があるのかも?)
CloudWatch_Management_Console.png

料金に気をつける

AWS DeepRacerコンソールを利用するにはコストが発生しませんが、裏でAmazon SageMakerやAWS RoboMakerが動いているため、そちらにはしっかりとコストが発生します。

AWS DeepRacer の料金 ‐ アマゾン ウェブ サービス
https://aws.amazon.com/jp/deepracer/pricing/

料金のページをみると無料利用枠があるのが確認できますが、Amazon SageMakerやAWS RoboMakerの無料利用枠は「12 か月間無料」や「トライアル」となるため注意が必要です。

AWS クラウド無料利用枠 | AWS
https://aws.amazon.com/jp/free/

個人での利用はもちろん、企業として利用する場合にも請求アラームを作成して痛い目に合わないようにしましょう。AWS SageMakerもAWS RoboMakerもそこそこコストがかかり、モデル作成するにも時間と試行錯誤が必要なので、とてもリッチな大人のお遊びです。個人ならお財布と、企業ならご予算と相談しながらご利用ください。

予想 AWS 請求額をモニタリングする請求アラームの作成 - Amazon CloudWatch
https://docs.aws.amazon.com/ja_jp/AmazonCloudWatch/latest/monitoring/monitor_estimated_charges_with_cloudwatch.html

AWSの無料利用枠に関する注意点

AWSの無料利用枠の「12 か月間無料」や「トライアル」は「アカウント作成後12か月」または「利用開始からnか月」の間に適用される無料利用枠となっています。

「だったら無料利用枠過ぎたらアカウント作成しなおせば(゚д゚)ウマー」って思っちゃいますよね。
残念ながら、そうはAWSが使わせない。そうは問屋が卸さない。です。

AWSに複数アカウントを作ってもいいのか - Qiita
https://qiita.com/hnw/items/96820cddcef4573403a8

複数アカウント作成することはOKですが、制限回避や無料提供の追加特典を得ようとして作成するのは利用規約違反となり、標準料金が課金される可能性がありますのでご注意ください。

AWSさんのことなので、より利用しやすくなるようにコストダウンしてくれることを期待しつつ、できる範囲で利用してリーグへ挑みましょう^^

参考

AWS DeepRacer League Virtual Circuit がオープンしました – 自分のモデルのトレーニングを今すぐ始めましょう! | Amazon Web Services ブログ
https://aws.amazon.com/jp/blogs/news/the-aws-deepracer-league-virtual-circuit-is-now-open-train-your-model-today/

AWS DeepRacer関連情報まとめ【随時更新】 - Qiita
https://qiita.com/kai_kou/items/5c02d0dca26a33dd8761

ついにオープンしたAWS DeepRacer League Virtual Circuitに参加しよう! | DevelopersIO
https://dev.classmethod.jp/cloud/aws/aws-deepracer-virtual-circuit-join/

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

Input Parameters of the AWS DeepRacer Reward Function - AWS DeepRacer https://docs.aws.amazon.com/deepracer/latest/developerguide/deepracer-reward-function-input.html#reward-function-input-all_wheels_on_track

AWS Service Limits - Amazon Web Services
https://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html

ひとつの AWS アカウント で複数人が AWS DeepRacer を始めた時に注意したこと - Qiita
https://qiita.com/dnp-wada/items/18ad01dcc96e6c053cb6

AWS DeepRacer の料金 ‐ アマゾン ウェブ サービス
https://aws.amazon.com/jp/deepracer/pricing/
AWS クラウド無料利用枠 | AWS
https://aws.amazon.com/jp/free/

予想 AWS 請求額をモニタリングする請求アラームの作成 - Amazon CloudWatch
https://docs.aws.amazon.com/ja_jp/AmazonCloudWatch/latest/monitoring/monitor_estimated_charges_with_cloudwatch.html

AWSに複数アカウントを作ってもいいのか - Qiita
https://qiita.com/hnw/items/96820cddcef4573403a8

18
6
0

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
18
6