{"id":50612110,"url":"https://github.com/nv-nguyen/template-pose","last_synced_at":"2026-06-23T00:00:57.215Z","repository":{"id":37490654,"uuid":"475802398","full_name":"nv-nguyen/template-pose","owner":"nv-nguyen","description":"[CVPR 2022] Pytorch implementation of \"Templates for 3D Object Pose Estimation Revisited: Generalization to New objects and Robustness to Occlusions\" paper","archived":false,"fork":false,"pushed_at":"2024-12-31T15:48:23.000Z","size":23169,"stargazers_count":178,"open_issues_count":9,"forks_count":14,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-12-31T16:29:32.688Z","etag":null,"topics":["6d-pose-estimation","6dof","deep-learning","object-pose-estimation","pose-estimation"],"latest_commit_sha":null,"homepage":"https://nv-nguyen.github.io/template-pose/","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/nv-nguyen.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-30T09:10:17.000Z","updated_at":"2024-12-12T07:26:57.000Z","dependencies_parsed_at":"2024-12-31T16:38:03.303Z","dependency_job_id":null,"html_url":"https://github.com/nv-nguyen/template-pose","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nv-nguyen/template-pose","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nv-nguyen%2Ftemplate-pose","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nv-nguyen%2Ftemplate-pose/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nv-nguyen%2Ftemplate-pose/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nv-nguyen%2Ftemplate-pose/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nv-nguyen","download_url":"https://codeload.github.com/nv-nguyen/template-pose/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nv-nguyen%2Ftemplate-pose/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34669839,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-22T02:00:06.391Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["6d-pose-estimation","6dof","deep-learning","object-pose-estimation","pose-estimation"],"created_at":"2026-06-06T05:00:21.752Z","updated_at":"2026-06-23T00:00:57.194Z","avatar_url":"https://github.com/nv-nguyen.png","language":"Python","funding_links":[],"categories":["6D Object Pose Estimation"],"sub_categories":["Methods"],"readme":"\u003cdiv align=\"center\"\u003e\n\u003ch2\u003e\nTemplates for 3D Object Pose Estimation Revisited:\u003cbr\u003e  Generalization to New objects and Robustness to Occlusions\n\u003cp\u003e\u003c/p\u003e\n\u003c/h2\u003e\n\n\u003ch3\u003e\n\u003ca href=\"https://nv-nguyen.github.io/\" target=\"_blank\"\u003e\u003cnobr\u003eVan Nguyen Nguyen\u003c/nobr\u003e\u003c/a\u003e \u0026emsp;\n\u003ca href=\"https://yinlinhu.github.io/\" target=\"_blank\"\u003e\u003cnobr\u003eYinlin Hu\u003c/nobr\u003e\u003c/a\u003e \u0026emsp;\n\u003ca href=\"https://youngxiao13.github.io/\" target=\"_blank\"\u003e\u003cnobr\u003eYang Xiao\u003c/nobr\u003e\u003c/a\u003e \u0026emsp;\n\u003ca href=\"https://people.epfl.ch/mathieu.salzmann\" target=\"_blank\"\u003e\u003cnobr\u003eMathieu Salzmann\u003c/nobr\u003e\u003c/a\u003e \u0026emsp;\n\u003ca href=\"https://vincentlepetit.github.io/\" target=\"_blank\"\u003e\u003cnobr\u003eVincent Lepetit\u003c/nobr\u003e\u003c/a\u003e\n\n\u003cp\u003e\u003c/p\u003e\n\n\u003ca href=\"https://nv-nguyen.github.io/template-pose/\"\u003e\u003cimg \nsrc=\"https://img.shields.io/badge/-Webpage-blue.svg?colorA=333\u0026logo=html5\" height=35em\u003e\u003c/a\u003e\n\u003ca href=\"https://arxiv.org/abs/2203.17234\"\u003e\u003cimg \nsrc=\"https://img.shields.io/badge/-Paper-blue.svg?colorA=333\u0026logo=arxiv\" height=35em\u003e\u003c/a\u003e\n\u003ca href=\"https://colab.research.google.com/drive/18Si4X7fcKFHvFuMS-FRVkDyTvlOsr78H?usp=sharing\"\u003e\u003cimg \nsrc=\"https://img.shields.io/badge/-Demo-blue.svg?colorA=333\u0026logo=googlecolab\" height=35em\u003e\u003c/a\u003e\n\u003cp\u003e\u003c/p\u003e\n\n\u003ch2\u003e\nCheckout our new work GigaPose which supports more features:\u003cbr\u003e\n\n\u003ca href=\"https://github.com/nv-nguyen/gigapose\" target=\"_blank\"\u003e\u003cnobr\u003ehttps://github.com/nv-nguyen/gigapose\u003c/nobr\u003e\u003c/a\u003e\n\n\u003cp\u003e\u003c/p\u003e\n\u003c/h2\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=./media/qualitative.gif width=\"80%\"/\u003e\n\u003c/p\u003e\n\n\u003c/h3\u003e\n\u003c/div\u003e\n\n\n#### In case of any issue, you can checkout to the commit where the code is working smoothly:\n```\ngit checkout 50a1087\n```\n\nIf our project is helpful for your research, please consider citing : \n``` Bash\n@inproceedings{nguyen2022template,\n    title={Templates for 3D Object Pose Estimation Revisited: Generalization to New objects and Robustness to Occlusions},\n    author={Nguyen, Van Nguyen and Hu, Yinlin and Xiao, Yang and Salzmann, Mathieu and Lepetit, Vincent},\n    booktitle={Proceedings IEEE Conf. on Computer Vision and Pattern Recognition (CVPR)},\n    year={2022}}\n```\nYou can also put a star :star:, if the code is useful to you.\n\nIf you like this project, check out related works from our group:\n- [CNOS: A Strong Baseline for CAD-based Novel Object Segmentation (ICCV 2023 R6D)](https://github.com/nv-nguyen/cnos) \n- [NOPE: Novel Object Pose Estimation from a Single Image (arXiv 2023)](https://github.com/nv-nguyen/nope) \n- [PIZZA: A Powerful Image-only Zero-Shot Zero-CAD Approach to 6DoF Tracking\n(3DV 2022)](https://github.com/nv-nguyen/pizza)\n- [BOP visualization toolkit](https://github.com/nv-nguyen/bop_viz_kit)\n\n![Teaser image](./media/method.png)\n\n##  Updates\nWe have introduced additional features and updates to the codebase:\n- Adding wandb logger: [training loggers](https://api.wandb.ai/links/nv-nguyen/8hkk35s4), [testing loggers](https://wandb.ai/nv-nguyen/template-pose-released/reports/Visualizations-of-template-pose--Vmlldzo0MzY0NDI2?accessToken=hyet783s3ujnbtvmqda71q2nv8haira63f5n23c3fhorb1oe949qmehucplaxfd8)\n- Cropping in LINEMOD settings is done with input bounding boxes (there is also predicted in-plane rotation)\n- Releasing synthetic templates with Pyrender for faster rendering \n- Releasing ready-to-use universal model pretrained on different datasets of BOP challenge [HomebrewedDB, HOPE, RU-APC, IC-BIN, IC-MI, TUD-L, T-LESS](https://bop.felk.cvut.cz/datasets/)\n- Adding code to generate poses (OpenCV coordinate) from icosahedron with Blender\n- Parsing with [hydra](https://github.com/facebookresearch/hydra) library, simplifying training_step, testing_step with [pytorch lightning](https://lightning.ai/)\n- Path structure (of pretrained models, dataset) is defined as in our recent project [NOPE](https://github.com/nv-nguyen/nope)\n\u003cdetails\u003e\u003csummary\u003eClick to expand\u003c/summary\u003e\n\n```bash\n$ROOT_DIR\n    ├── datasets\n        ├── linemod \n            ├── models\n            ├── test\n        ├── tless\n        ├── ruapc \n        ├── ...\n        ├── templates\t\n    ├── pretrained\n        ├── moco_v2_800ep_pretrain.pth\n    ├── results\n        ├── experiment1\n            ├── wandb\n            ├── checkpoint\n        ├── experiment2\n```\n\n\u003c/details\u003e\n\n\n\nThis repository is running with the Weight and Bias logger. Ensure that you update this [user's configuration](https://github.com/nv-nguyen/template-pose/blob/main/configs/user/default.yaml) before conducting any experiments. \n\n## Installation :construction_worker:\n\n\u003cdetails\u003e\u003csummary\u003eClick to expand\u003c/summary\u003e\n\n### 1. Create conda environment\n```\nconda env create -f environment.yml\nconda activate template\n\n# require only for evaluation: pytorch3d 0.7.0\ngit clone https://github.com/facebookresearch/pytorch3d.git\npython -m pip install -e .\n```\n\n### 2. Datasets\nFirst, create template poses from icosahedron:\n```\nblenderproc run src/poses/create_poses.py\n```\nNext, download and process BOP datasets\n```\n./src/scripts/download_and_process_datasets.sh\n```\nThere are two options for the final step (rendering synthetic templates from CAD models):\n\n#### Option 1: Download pre-rendered synthetic templates:\n```\npython -m src.scripts.download_prerendered_templates\n```\nOptional: This pre-rendered template set can be manually downloaded from [here](https://drive.google.com/drive/folders/1p9eJ8dTxR3rVinvaFxPw5N_3IGSlS2_E?usp=sharing) (12GB).\n#### Option 2: Rendering synthetic templates from scratch (this will take around 1 hour with Nvidia V100)\n\n```\n./src/scripts/render_pyrender_all.sh\n```\n\n\u003cdetails\u003e\u003csummary\u003eClick to expand\u003c/summary\u003e\n\nIt is important to verify that all the datasets are correctly downloaded and processed. For example, by counting the number of images of each folder:\n\n\n```\nfor dir in $ROOT_DIR/datasets/*     \ndo\n    echo ${dir}\n    find ${dir} -name \"*.png\" | wc -l     \ndone\n```\n\nIf everything is fine, here are the number of images that you should get:\n\n```bash\n├── $ROOT_DIR/datasets\n    ├── hb # 55080\n    ├── hope # 1968\n    ├── icbin # 19016\n    ├── icmi # 31512\n    ├── lm # 49822\n    ├── olm # 4856\t\n    ├── ruapc #\t143486\n    ├── tless # 309600\n    ├── tudl # 153152\n    ├── templates (12GB) # 84102\n```\n\u003c/details\u003e\n\n\u003c/details\u003e\n\n\n ##  Launch a training  :rocket:\n\n\u003cdetails\u003e\u003csummary\u003eClick to expand\u003c/summary\u003e\n\n### 0. (Optional) We use pretrained weight from MoCo v2. You can download it from [here](https://drive.google.com/file/d/1DwlMVdj7rPh3TZ2QfKDU4t4460gofm7i/view?usp=share_link) or run:\n\n```\npython -m src.scripts.download_moco_weights\n```\n\nIf you don't want to use pretrained weights, you can remove the path in [this line](https://drive.google.com/drive/folders/1p9eJ8dTxR3rVinvaFxPw5N_3IGSlS2_E?usp=sharing).\n### 1. Training on all BOP datasets except LINEMOD and T-LESS (only objects 19-30)\n```\npython train.py name_exp=train_all\n```\n\nThe parsing is done with Hydra library. You can override anything in the configuration by passing arguments. For example:\n\n```\n# experiment 1: change batch_size, using data augmentation, update name_exp\npython train.py machine.batch_size=2 use_augmentation=True name_exp=train_augmentation\n\n# experiment 2: change batch_size, using data augmentation, update name_exp, update_lr\npython train.py machine.batch_size=2 use_augmentation=True model.lr=0.001 name_exp=train_augmentation_lr0.001\n```\n\nPlease check out this [training loggers](https://api.wandb.ai/links/nv-nguyen/8hkk35s4) to see how the training loss looks like.\n\n\u003c/details\u003e\n\n##  Reproduce quantitative results \n\nPlease note that all testing objects are unseen during training!\n\n\u003cdetails\u003e\u003csummary\u003eClick to expand\u003c/summary\u003e\n\n### 0. You can download it from [this link](https://drive.google.com/drive/folders/11SQYPrG3pX31Qszf8R13s7Aaa5MO57lb?usp=sharing) or run:\n\n```\npython -m src.scripts.download_checkpoint\n```\n\nTODO: This is not the final checkpoint. We will update it soon.\n\n### 1. LINEMOD's objects\n\n```\npython test_lm.py name_exp=test_lm model.checkpoint_path=$CHECKPOINT_PATH\n```\n\n### 2. TLESS's objects\n\n```\npython test_tless.py name_exp=test_tless model.checkpoint_path=$CHECKPOINT_PATH\n```\n\nPlease check out this [testing loggers](https://wandb.ai/nv-nguyen/template-pose-released/reports/Visualizations-of-template-pose--Vmlldzo0MzY0NDI2?accessToken=hyet783s3ujnbtvmqda71q2nv8haira63f5n23c3fhorb1oe949qmehucplaxfd8) to see how the retrieved results looks like.\n\n\u003c/details\u003e\n\n\n## Acknowledgement\n\nThe code is adapted from [Nope](https://github.com/nv-nguyen/nope), [Temos](https://github.com/Mathux/Temos), [Unicorn](https://github.com/monniert/unicorn), [PoseContrast](https://github.com/YoungXIAO13/PoseContrast), [CosyPose](https://github.com/ylabbe/cosypose) and [BOP Toolkit](https://github.com/thodan/bop_toolkit). \n\nThe authors thank Martin Sundermeyer, Paul Wohlhart and Shreyas Hampali for their fast reply, feedback!\n\n## Contact\nIf you have any question, feel free to create an issue or contact the first author at van-nguyen.nguyen@enpc.fr","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnv-nguyen%2Ftemplate-pose","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnv-nguyen%2Ftemplate-pose","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnv-nguyen%2Ftemplate-pose/lists"}