반응형
블로그 이미지
개발자로서 현장에서 일하면서 새로 접하는 기술들이나 알게된 정보 등을 정리하기 위한 블로그입니다. 운 좋게 미국에서 큰 회사들의 프로젝트에서 컬설턴트로 일하고 있어서 새로운 기술들을 접할 기회가 많이 있습니다. 미국의 IT 프로젝트에서 사용되는 툴들에 대해 많은 분들과 정보를 공유하고 싶습니다.
솔웅

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

글 보관함

카테고리

Get Started with AWS DeepRacer

2018. 12. 25. 21:52 | Posted by 솔웅


반응형


Get Started with AWS DeepRacer


To help you get started quickly with AWS DeepRacer, we walk you through essential steps using the AWS DeepRacer console. Use the console to: Create a training job that trains a reinforcement learning model for autonomous racing and also evaluates the trained model in a simulated environment.


AWS DeepRacer를 빠르게 시작하는 데 도움이되도록 AWS DeepRacer 콘솔을 사용하여 필수 단계를 안내합니다. 콘솔을 사용하여 다음을 수행 할 수 있습니다. 자율 경주를 위한 강화 학습 모델reinforcement learning model을 훈련하고 시뮬레이트 된 환경에서 훈련 된 모델을 평가하는 훈련 작업을 만듭니다.






Train Your First AWS DeepRacer Model for Autonomous Racing


Using the AWS DeepRacer console, you can follow built-in templates to train and evaluate an AWS DeepRacer model.


AWS DeepRacer 콘솔을 사용하여 내장 된 템플릿을 따라 AWS DeepRacer 모델을 학습하고 평가할 수 있습니다.



To train a reinforcement learning model for autonomous racing using the AWS DeepRacer console


AWS DeepRacer 콘솔을 사용하여 자율 경주용 reinforcement learning model을 훈련하기


  1. Sign in to the AWS DeepRacer console(https://console.aws.amazon.com/deepracer).

  2. On the AWS DeepRacer home page, choose Create model.

    If you aren't on the home page, choose Reinforcement learning on the primary navigation pane and then choose Create model.

    AWS DeepRacer 홈 페이지에 있지 않은 경우 primary navigation pane에서 Reinforcement learning을 선택한 다음 Create model을 선택하십시오.

  3. Under Model details on the Create model page, do the following:

    1. Type a name for the to-be-trained model in the Model name input field. Use this name to identify this model in the list of AWS DeepRacer models you've created or on the leaderboards displaying the evaluation metrics of the model.


      모델 이름 입력 필드에 to-be-trained model의 이름을 입력하십시오. 이 이름을 사용하여 작성한 AWS DeepRacer 모델 목록 또는 모델의 평가 메트릭을 표시하는 leaderboards에서이 모델을 식별하십시오.






  1. Optionally, provide a brief description of the model in the Model description - optional input field. The description, for example, can provide a summary of the model features and limitations.

    옵션으로 Model description에 해당 모델에 대한 간단한 설명을 제공합니다. 이 설명은 예를 들어 해당 모델 기능에 대한 요약과 제한 사항등에 대한 정보를 제공할 수 있습니다

  2. For Permissions and storage, choose the Create resources button to create the required IAM roles and an S3 bucket, if they don't already exist.

    Permissions 및 storage에 대해 Create resources 버튼을 선택하여 필수 IAM roles와 S3 버킷을 만듭니다. (만약 그것들이 존재하지 않을 경우)

    If the resources have been created, you're notified as such as shown in the following screenshot:

    리소스가 생성 된 경우 다음 스크린 샷과 같이 알림을받습니다.




The S3 bucket is used to store the trained model artifacts. And the IAM roles contain relevant IAM policies to grant AWS DeepRacer permissions to call other AWS services on your behalf. For more information about the required IAM roles and policies, see Identity and Access Management for AWS DeepRacer.



S3 버킷은 훈련된 모델 artifacts를 저장하는 데 사용됩니다. 또한 IAM roles에는 AWS DeepRacer 권한을 부여하여 관련 AWS 서비스를 호출하는 관련 IAM 정책이 포함됩니다. 필요한 IAM 역할 및 정책에 대한 자세한 내용은 AWS DeepRacer의 ID 및 액세스 관리를 참조하십시오.


  1.  


  2. Under Environment simulation, choose an available track as a virtual environment with which your agent interacts to train a reinforcement learning model through trials and errors.

    환경 시뮬레이션에서 시도 및 오류를 통해 reinforcement learning 모델을 학습하기 위해 agent가 상호 작용하는 가상 환경으로, 사용 가능한 트랙을 선택하십시오.


  3. Under Reward function, choose the Basic function or Advanced function and use the predefined code without modification.

    보상 기능에서 기본 기능 또는 고급 기능을 선택하고 수정없이 미리 정의 된 코드를 사용하시면 됩니다.

    To modify or replace the predefined reward function code, choose the Insert code button to insert the code into the code editor and change it.

    미리 정의 된 보상 기능 코드를 수정하거나 교체하려면 코드 삽입 단추를 선택하여 코드 편집기에 코드를 삽입하고 변경하십시오.

  4. To customize hyperparameters, expand Algorithm settings and set Hyperparameters as follows:

    hyperparameters를 사용자 정의하려면 알고리즘 설정을 expand하고 다음과 같이 hyperparameters를 설정하십시오.

    1. For Batch size, choose an available options or leave the default choice (64) as-is.

    2. For Number of epochs, set a valid value or leave the default (10) as-is.

    3. For Learning rate, set a valid value or leave the default value (0.0003) as-is.

    4. For Exploration, choose one of the available options or leave the default value (Categorical Parameters) as-is.

    5. For Entropy, set a valid value or leave the default value (0.01) as-is.

    6. For Discount factor, set a valid value or leave the default value (0.99) as-is.

    7. For Loss type, choose an available options or leave the default choice (Huber) as-is.

    8. For Number of episodes between each training, set a valid value or leave the default value (20) as-is.

    For more information about hyperparameters, see Systematically Tune Hyperparameters for Optimal Training Performances.

    hyperparameters에 대한 자세한 내용은 Systematically Tune Hyperparameters for Optimal Training Performances를 참조하십시오.


  5. Under Stop conditions, set the conditions to terminate long-running (and possible run-away) training session:

    정지 조건에서 장기 실행 (및 가능한 런 - 어웨이) 훈련 세션을 종료하는 조건을 설정하십시오.

    1. For Max. Time, set a valid value or leave the default value (60 mins) as-is.

      Max. Time에 대해서는, 유효한 값을 설정하거나 기본값 (60 분)을 그대로 두십시오.

    For more information about stop conditions, see Train and Evaluate AWS DeepRacer Models.

    정지 조건에 대한 자세한 내용은 Train and Evaluate AWS DeepRacer Models를 참조하십시오.


  6. Choose Start training to start creating the model and provisions the training job instance. The process takes a few minutes. You can watch the status change on the Models page.

    모델을 만들고 훈련 작업 인스턴스를 제공하기 위해  Start training을 선택하십시오. 이 과정은 몇 분이 걸립니다. Models page에서 상태 변경을 볼 수 있습니다.

  7. After the training is initialized, the status becomes Training. You can now choose the model name to open the mode details page.

    훈련이 초기화 된 후 status는 Training이됩니다. 이제 모델 이름을 선택하여 모드 세부 정보 페이지를 열 수 있습니다.




10. On the model details page, watch the training progress in the simulator.


모델 세부 정보 페이지에서 시뮬레이터의 교육 진행 상황을 확인하십시오.






As seen in the simulator, as the agent maneuvers the curve on the track, it gets repeatedly knocked off the track until it masters the correct steering. The training stops when the specified stop condition is met. The training has converged if the TrainingRewardScore value plateaus with respect to the training time. You can choose Stop training to manually stop the training job when the training has converged before the specified stop condition is met. If the training has not converged when the training stops, you should do the following: Create a new training job. Tune some hyperparameters or extend the training time. Repeat the training until the average reward converges. If you choose Stop training, the process could take a few minutes to complete.

시뮬레이터에서 볼 수 있듯이 에이전트가 트랙에서 커브를 움직이면 올바른 스티어링을 마스터 할 때까지 트랙에서 반복적으로 knocked off됩니다. 지정한 중지 조건이 충족되면 교육이 중지됩니다. 트레이닝 시간과 관련하여 TrainingRewardScore 값이 안정되면 교육이 수렴됩니다. 지정된 중지 조건이 충족되기 전에 학습이 수렴되었을 때 수동으로 학습 작업을 중지하려면 학습 중지를 선택할 수 있습니다. 교육이 중지되었을 때 교육이 수렴되지 않은 경우 다음을 수행해야합니다. 새 교육 작업을 작성하십시오. 일부 hyperparameters를 조정하거나 교육 시간을 연장하십시오. 평균 보상이 수렴 할 때까지 훈련을 반복하십시오. 교육 중지를 선택하면 프로세스가 완료되는 데 몇 분이 걸릴 수 있습니다.

After the training job finishes, continue next to evaluate the trained model to gauge its performance.


교육 작업이 끝난 후에는 다음 단계로 진행하여 숙련 된 모델을 평가하여 성능을 측정하십시오.






Evaluate Your AWS DeepRacer Models in Simulation

After training completes, follow the steps below to evaluate the trained model.

교육이 끝나면 아래 단계에 따라 숙련 된 모델을 평가하십시오.


  1. In the Evaluation section, choose Start evaluation to begin the evaluation.

    평가 섹션에서 평가 시작을 선택하여 평가를 시작합니다.

    You can start evaluation only when your model is a ready state. A model is ready when the training completes. Even if the training doesn't complete, the model that has been trained up to the failing point can still be ready.

    모델이 준비 상태 인 경우에만 평가를 시작할 수 있습니다. 교육이 완료되면 모델이 준비됩니다. 교육이 완료되지 않더라도 실패한 지점까지 훈련 된 모델을 계속 준비 할 수 있습니다.





2. Under Select environment to start evaluation, choose the track option you specified in the training steps.


평가를 시작하기위해 Select environment에서 교육 단계에서 지정한 트랙 옵션을 선택하십시오.




You can choose any track for evaluating your model, however, you can only expect the best performance on the track used to train the model.


모델을 평가하기 위해 아무 트랙이나 선택할 수는 있지만 모델을 학습하는 데 사용 된 트랙에서만 최상의 성능을 기대할 수 있습니다.



3, To specify the stop condition, leave the default value (3 trials) as-is forNumber of trials. You can specify at most 5 trial runs at a time.


정지 조건을 지정하려면 시도 횟수에 대한 기본값 (3 회)을 그대로 두십시오. 한 번에 최대 5 회의 시험 실행을 지정할 수 있습니다.



4. Choose Start evaluation to start creating and initializing the evaluation job.

평가 작업 생성 및 초기화를 시작하려면 평가 시작을 선택합니다.


This initialization process takes about a few minutes to complete.


이 초기화 프로세스는 완료하는 데 몇 분 정도 걸립니다.





5. Once evaluation is in progress, choose Stop evaluation if you would like to stop the evaluation for any reason.

평가가 진행되면 어떤 이유에서든 평가를 중단하려면 평가 중지를 선택하십시오.


To stop an evaluation job, choose Stop evaluation on the upper-right corner of the Evaluation pane and then confirm to stop the evaluation.


평가 작업을 중지하려면 평가 창의 오른쪽 위 모서리에있는 평가 중지를 선택한 다음 평가를 중지하도록 확인하십시오.


6. After evaluation completed successfully, view the performance results underEvaluation.


평가가 성공적으로 완료되면 평가에서 성능 결과를보십시오.




For this training, the performance (of ~30%-40% completion) is not of production quality. The agent couldn't manage to finish the course at all. This is understandable because the TrainingRewardScore value didn't appear to have converged. You can improve the performance by extending the Max. time value. For example, by doubling the training time, you should improve the performance significantly, as shown by the following evaluation results:


이 훈련의 경우 성능 (~ 30 % ~ 40 % 완성)은 production quality가 아닙니다. 에이전트가 해당 과정을 전혀 마치지 못한 것입니다. 이는 TrainingRewardScore 값이 수렴하지 않은 것으로 이해할 수 있습니다. Max. time값을 확장하여 성능을 향상시킬 수 있습니다. 예를 들어 훈련 시간을 두 배로 늘리면 다음과 같은 평가 결과에 나타난 것처럼 성능을 크게 향상시켜야합니다.




This time the agent managed to complete the entire track (of 100% completion) one time at a slower speed (in 1 minute and 23 seconds). If you looked at the TrainingRewardScore plot for the training, you would have seen the training score had begun to converge.


이번에는 에이전트가 전체 트랙 (100 % 완료)을 한 번 더 느린 속도 (1 분 23 초)로 완료했습니다. 교육을 위해 TrainingRewardScore 플롯을 보면 훈련 점수가 수렴하기 시작했을 것입니다.



Now you've finished training and evaluating your first AWS DeepRacer model for autonomous racing with clicks or taps of a few buttons and some patience. The wizard provided by the AWS DeepRacer console did most of the heavy lifting.


이제 몇 번의 버튼 클릭과 몇 번의 인내로 자율 경주를위한 첫 번째 AWS DeepRacer 모델을 교육하고 평가를 마쳤습니다. AWS DeepRacer 콘솔이 제공하는 마법사는 대부분의 어려운 작업을 수행했습니다.



From here on, you can proceed to improve the model by cloning the model, tweaking the reward function, tuning hyperparameters, and then iterating the process until the TrainingRewardScore value converges and the performance metrics improve. For more information on how to improve the training, see Train and Evaluate AWS DeepRacer Models.


여기에서 모델을 복제하고 보상 기능을 조정하고 hyperparameters를 조정 한 다음 TrainingRewardScore 값이 수렴되고 성능 메트릭이 향상 될 때까지 프로세스를 반복하여 모델을 향상시킬 수 있습니다. 교육을 향상시키는 방법에 대한 자세한 내용은 AWS DeepRacer 모델 학습 및 평가를 참조하십시오.



Having trained a satisfactory AWS DeepRacer model, you're ready to test it with an AWS DeepRacer vehicle in a physical environment. For more information about testing an AWS DeepRacer model with a physical agent, see Drive Your AWS DeepRacer Vehicle .


만족스러운 AWS DeepRacer 모델을 훈련하면 실제 환경에서 AWS DeepRacer 차량으로 테스트 할 수 있습니다. 물리적 에이전트로 AWS DeepRacer 모델을 테스트하는 방법에 대한 자세한 내용은 AWS DeepRacer Vehicle을 참조하십시오.

반응형