{"id":19516353,"url":"https://github.com/zfw1226/active_tracking_rl","last_synced_at":"2025-05-08T00:06:03.234Z","repository":{"id":40982423,"uuid":"195059278","full_name":"zfw1226/active_tracking_rl","owner":"zfw1226","description":"Active visual tracking library based on PyTorch.","archived":false,"fork":false,"pushed_at":"2024-05-16T14:34:48.000Z","size":65218,"stargazers_count":85,"open_issues_count":1,"forks_count":19,"subscribers_count":2,"default_branch":"AD-VAT","last_synced_at":"2025-05-08T00:05:56.488Z","etag":null,"topics":["active-tracking","adversarial-reinforcement-learning","multi-agent-learning"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zfw1226.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-03T13:30:22.000Z","updated_at":"2025-04-21T06:55:35.000Z","dependencies_parsed_at":"2024-05-16T15:47:00.359Z","dependency_job_id":"5fb5c3fe-dad6-44ad-959f-183446fcd4b0","html_url":"https://github.com/zfw1226/active_tracking_rl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zfw1226%2Factive_tracking_rl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zfw1226%2Factive_tracking_rl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zfw1226%2Factive_tracking_rl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zfw1226%2Factive_tracking_rl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zfw1226","download_url":"https://codeload.github.com/zfw1226/active_tracking_rl/tar.gz/refs/heads/AD-VAT","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252973690,"owners_count":21834108,"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":["active-tracking","adversarial-reinforcement-learning","multi-agent-learning"],"created_at":"2024-11-10T23:45:51.166Z","updated_at":"2025-05-08T00:06:03.213Z","avatar_url":"https://github.com/zfw1226.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AD-VAT\nThis repository is the code for \n[AD-VAT: An Asymmetric Dueling mechanism for learning Visual Active Tracking (ICLR 2019)](https://openreview.net/pdf?id=HkgYmhR9KX). \n\nIt contains the code for training/testing(Pytorch) and the 2D environments.\nThe 3D environments are hosted in [gym-unrealcv](https://github.com/zfw1226/gym-unrealcv).\n\n![framework](./figs/framework.png)\n# Dependencies\nThis repository requires:\n- Python \u003e= 3.6\n- Pytorch \u003e= 1.0\n- Opencv \u003e= 3.4\n- Numpy == 1.14.0\n- setproctitle, scikit-image, imageio, TensorboardX\n\nSee [requirements.txt](requirements.txt) for more details.\n# Installation\nTo download the repository and install the requirements, you can run as:\n```\ngit clone https://github.com/zfw1226/active_tracking_rl.git\ncd active_tracking_rl\npip install -r requirements.txt\n```\n**Note that you need install `OpenCV`, `Pytorch`, and `the 2D/3D environments` additionally.**\n\n## Prepare the 2D/3D Environments\nWe provide various 2D and 3D environments to validate the effectiveness of AD-VAT.\n\n![2d_env](./figs/2d_env.png)\nThe **2D environment** is a matrix map where obstacles are randomly placed.\nThe 2D experiment can run on a CPU-only machine.\nIn the 2D environments, you can evaluate and quantify the effectiveness of AD-VAT in a few minutes. \n\nTo install 2D environments([gym-track2d](/envs/gym-track2d)), you need run:\n```\npip install -e envs/gym_track2d\n```\n\n![3d_env](./figs/3d_env.png)\nThe **3D environments** are built on Unreal Engine(UE4), which could be flexibly customized to simulate \nreal-world active tracking scenarios.\nTo run the 3D environments, GPU is necessary.\n\nTo install 3D environments, **please follow the instructions in \n[gym-unrealcv](https://github.com/zfw1226/gym-unrealcv).**\n\n# Running on 2D Environments\n## Training\nYou can try AD-VAT in 2D environments by running:\n```\npython main.py --shared-optimizer --workers 16 --split --train-mode -1 --env Track2D-BlockPartialPZR-v0\n```\nNote that you need adjust the number of `--workers` according to the number of your cpu cores.\nIt is important to limit number of worker processes to number of cpu cores available \nas too many processes (e.g. more than one process per cpu core available) will actually be detrimental \nin training speed and effectiveness.\n`--split` means that it will save the tracker and target model separately for further evaluation.\nBesides, you can also run the two baseline methods referred in the paper.\n\nTo train tracker with `Ram` target:\n```\npython main.py --shared-optimizer --workers 16 --split --train-mode 0 --env Track2D-BlockPartialRam-v0\n```\nTo train tracker with `Nav` target:\n```\npython main.py --shared-optimizer --workers 16 --split --train-mode 0 --env Track2D-BlockPartialNav-v0\n```\nTo train tracker and target under `Naive dueling`:\n```\npython main.py --shared-optimizer  --workers 16 --split --network maze-lstm --entropy-target 0.01 --aux none --env Track2D-BlockPartialAdv-v0\n```\n\n## Evaluation\nYou can evaluate the tracker by running:\n```\npython gym_eval.py --env {ENV_NAME} --network tat-maze-lstm --load-tracker {PATH_TO_YOUR_TRACKER}\n```\nThe ``ENV_NAME`` we used to evaluate in the paper is:\n- `Track2D-BlockPartialNav-v0` (Block-Nav),\n- `Track2D-BlockPartialRam-v0` (Block-Ram), \n- `Track2D-MazePartialNav-v0` (Maze-Nav).\n- `Track2D-MazePartialRam-v0` (Maze-Ram), \n\nIf you use the the default setting while training, the `PATH_TO_YOUR_MODLE` should be `logs/{ENV_NAME}/{DATE}/tracker-best.dat`\n\n\nYou can also evaluate the effectiveness of the `tracker-aware target` by running with different trackers, as:\n```\npython gym_eval.py --env Track2D-BlockPartialAdv-v0 --network tat-maze-lstm --load-tracker {PATH_TO_YOUR_TRACKER} --load-target {PATH_TO_YOUR_TARGET}\n```\n\n# Running on 3D Environments\n## Training\nYou can try AD-VAT in 3D environments by running:\n```\npython main.py --shared-optimizer  --workers 6  --split --network tat-cnn-lstm --rnn-out 256 --entropy-target 0.05 --sleep-time 30 --env UnrealTrack-DuelingRoomPZR-DiscreteColor-v4 --env-base UnrealTrack-DuelingRoomNav-DiscreteColor-v4 --gray --rescale --lr 0.0001\n```\nTo train the baselines, you only need reset `--env` to `UnrealTrack-DuelingRoomRam-DiscreteColor-v4` or `UnrealTrack-DuelingRoomNav-DiscreteColor-v4`, and set `--train-mode` to `0` meanwhile.\n\n## Evaluation\nYou can evaluate the tracker by running:\n```\npython gym_eval.py --env {ENV_NAME} --network cnn-lstm --gray --rescale --rnn-out 256 --load-tracker {PATH_TO_YOUR_TRACKER} \n```\nThe ``ENV_NAME`` we used to evaluate in the paper is: \n- `UnrealTrack-DuelingRoomNav-DiscreteColor-v4` (DR Room), \n- `UnrealTrack-UrbanCityNav-DiscreteColor-v1` (Urban City), \n- `UnrealTrack-SnowForestNav-DiscreteColor-v1` (Snow Village),\n- `UnrealTrack-GarageNav-DiscreteColor-v0` (Parking Lot)\n\n# Visualization\nYou could monitor the performance while training using `tensorboard`:\n```\ntensorboard --logdir {PATH_TO_LOGS}\n```\nIf you use the the default setting while training, `PATH_TO_LOGS` should be `logs/{ENV_NAME}/{DATE}`\n\n\n# Citation\nIf you found AD-VAT useful, please consider citing:\n```\n@inproceedings{zhong2018advat,\n  title={{AD}-{VAT}: An Asymmetric Dueling mechanism for learning Visual Active Tracking},\n  author={Fangwei Zhong and Peng Sun and Wenhan Luo and Tingyun Yan and Yizhou Wang},\n  booktitle={International Conference on Learning Representations},\n  year={2019},\n  url={https://openreview.net/forum?id=HkgYmhR9KX},\n  }\n\n  @article{zhong2021advat,\n  author={Zhong, Fangwei and Sun, Peng and Luo, Wenhan and Yan, Tingyun and Wang, Yizhou},\n  journal={IEEE Transactions on Pattern Analysis and Machine Intelligence}, \n  title={AD-VAT+: An Asymmetric Dueling Mechanism for Learning and Understanding Visual Active Tracking}, \n  year={2021},\n  volume={43},\n  number={5},\n  pages={1467-1482},\n  doi={10.1109/TPAMI.2019.2952590}\n  }\n```\n\n# Contact\nIf you have any suggestion/questions, get in touch at [zfw@pku.edu.cn](zfw@pku.edu.cn).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzfw1226%2Factive_tracking_rl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzfw1226%2Factive_tracking_rl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzfw1226%2Factive_tracking_rl/lists"}