Áp dụng học tăng cường chương trình cho xe tự lái
Phần mềm:
-
Python 3.7
-
CARLA 0.9.9
-
Libraries: install from
requirements.txt
Trước khi chạy chương trình bắt buộc phải có:
-
Download CARLA 0.9.9 từ github của Carla, here Tài liệu có thể giúp sử dụng môi trường giả lập carla carla-quickstart
-
Install CARLA Python bindings Để có thể kết nối python với Carla cần làm những yêu cầu sau:
- Windows:
cd your-path-to-carla/CARLA_0.9.9.4/WindowsNoEditor/PythonAPI/carla/dist/
- Linux:
cd your-path-to-carla/CARLA_0.9.9.4/PythonAPI/carla/dist/
- Extract
carla-0.9.9-py3.7-XXX-amd64.egg
whereXXX
depends on your OS, e.g.win
for Windows. - Create a
setup.py
file within the extracted folder and write the following:from distutils.core import setup setup(name='carla', version='0.9.9', py_modules=['carla'])
- Windows:
Before running the repository's code be sure to start CARLA first:
- Windows:
your-path-to/CARLA_0.9.9.4/WindowsNoEditor/CarlaUE4.exe
- Linux:
your-path-to/CARLA_0.9.9.4/./CarlaUE4.sh
- [optional] Để máy có thể chạy tốt hơn và tốn ít GPU hơn thì có thể chạy câu lệnh:
-windowed -ResX=32 -ResY=32 --quality-level=Low
. For example./CarlaUE4.sh --quality-level=Low
.
- Clone this repo:
git clone https://github.com/ndamtruong2k/Self_Driving_Car_Reinforcement_Learning.git
- Lưu dữ liệu code chương trình trong đường dẫn:
your-path-to/CARLA_0.9.9.4/PythonAPI/examples
- Lưu dữ liệu code chương trình trong đường dẫn:
Ví dụ học tăng cường:
from core import learning
learning.stage_s1(episodes=5, timesteps=256, gamma=0.999, lambda_=0.995, save_every='end', stage_name='stage',
seed=42, polyak=0.999, aug_intensity=0.0, repeat_action=1, load_full=False)\
.run2(epochs=10)
Quy trình đào tạo được để trong main.py
. Hãy lưu ý rằng mỗi giai đoạn có thể mất nhiều thời gian để hoàn thành, vì vậy hãy comment những gì bạn không muốn chạy
Mạng PPO được áp dụng để đào tạo.
Cấu trúc đầu vào và đầu ra của tác nhân.
Kết quả xe chuyển làn thành công trên thị trấn 3 của Carla.