{"id":13482850,"url":"https://github.com/zsdonghao/Imitation-Learning-Dagger-Torcs","last_synced_at":"2025-03-27T13:32:55.404Z","repository":{"id":72877685,"uuid":"99949145","full_name":"zsdonghao/Imitation-Learning-Dagger-Torcs","owner":"zsdonghao","description":"A Simple Example for Imitation Learning with Dataset Aggregation (DAGGER) on Torcs Env","archived":false,"fork":false,"pushed_at":"2017-08-10T19:42:20.000Z","size":14,"stargazers_count":71,"open_issues_count":2,"forks_count":28,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-21T09:11:24.263Z","etag":null,"topics":["dagger","gym-torcs","imitation-learning","tensorflow","tensorflow-tutorials","tensorlayer","torcs","torcs-env"],"latest_commit_sha":null,"homepage":"https://github.com/zsdonghao/tensorlayer","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zsdonghao.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-08-10T17:33:43.000Z","updated_at":"2025-02-27T04:53:14.000Z","dependencies_parsed_at":"2024-01-07T10:55:50.525Z","dependency_job_id":null,"html_url":"https://github.com/zsdonghao/Imitation-Learning-Dagger-Torcs","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zsdonghao%2FImitation-Learning-Dagger-Torcs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zsdonghao%2FImitation-Learning-Dagger-Torcs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zsdonghao%2FImitation-Learning-Dagger-Torcs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zsdonghao%2FImitation-Learning-Dagger-Torcs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zsdonghao","download_url":"https://codeload.github.com/zsdonghao/Imitation-Learning-Dagger-Torcs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245854714,"owners_count":20683401,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dagger","gym-torcs","imitation-learning","tensorflow","tensorflow-tutorials","tensorlayer","torcs","torcs-env"],"created_at":"2024-07-31T17:01:06.085Z","updated_at":"2025-03-27T13:32:55.003Z","avatar_url":"https://github.com/zsdonghao.png","language":"Python","funding_links":[],"categories":["Models/Projects"],"sub_categories":[],"readme":"## Imitation Learning with Dataset Aggregation (DAGGER) on Torcs Env\n\nThis repository implements a simple algorithm for imitation learning: [DAGGER](https://www.cs.cmu.edu/~sross1/publications/Ross-AIStats11-NoRegret.pdf).\nIn this example, the agent only learns to control the steer [-1, 1], the speed is computed\nautomatically in `gym_torcs.TorcsEnv`.\n\n## Requirements\n\n1. Ubuntu (I only test on this)\n2. Python 3\n3. TensorLayer and TensorFlow \n4. [Gym-Torcs](https://github.com/ugo-nama-kun/gym_torcs)\n\n## Setting Up\n\nIt is a little bit boring to set up the environment, but any incorrect configurations will lead to FAILURE.\nAfter installing [Gym-Torcs](https://github.com/ugo-nama-kun/gym_torcs), please follow the instructions to confirm everything work well:\n\n- Open a terminal:\n  - Run `sudo torcs -vision` to start a game\n  - `Race --\u003e Practice --\u003e Configure Race`: set the driver to `scr_server 1` instead of `player`\n  - Open Torcs server by selecting `Race --\u003e Practice --\u003e New Race`:\nThis should result that Torcs keeps a blue screen with several text information.\n\n- Open another terminal:\n  - Run `python snakeoil3_gym.py` on another terminal, it will shows how the fake AI control the car.\n  - Press F2 to see the driver view.\n\n- Set image size to 64x64x3:\n  - The model is trained on 64x64 RGB observation.\n  - Run `sudo torcs -vision` to start a game\n  - `Options --\u003e Display --\u003e select 64x64 --\u003e Apply`\n\n\n## Usage\nMake sure everything above work well and then run:\n\n- `python dagger.py`\n\nIt will start a Torcs server at the beginning of every episode, and terminate the server when the car crashs or the speed is too low.\nNote that, the self-contained `gym_torcs.py` is modified from [Gym-Torcs](https://github.com/ugo-nama-kun/gym_torcs), you can try different settings (like default speed, terminated speed) by modifying it.\n\n## Results \n\nAfter Episode 1, the car crashes after 315 steps. \n\n![](http://i.imgur.com/YfqFXQZ.gif)\n\n\u003c!---\nAfter Episode 2, crashes after 151 steps\n\n![](http://i.imgur.com/0bXKyVx.gif)\n\n\nAfter Episode 3, crashes after 395 steps\n\n![](http://i.imgur.com/doz8U0z.gif)\n\nAfter Episode 4, the car does not crash anymore: [gif](http://i.imgur.com/pKeVxLY.gif).\n--\u003e\n\nAfter Episode 3, the car does not crash anymore !!!\n\n![](http://i.imgur.com/doz8U0z.gif)\n\nThe number of steps and episodes might vary depending on the parameters initialization.\n\n\nENJOY !\n\n\u003c!---\nNote: The images fed to the model are 64x64, the images shown above have been resized to 256x256 for viewing purposes.\n--\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzsdonghao%2FImitation-Learning-Dagger-Torcs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzsdonghao%2FImitation-Learning-Dagger-Torcs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzsdonghao%2FImitation-Learning-Dagger-Torcs/lists"}