https://github.com/amazon-science/adaslot
Official implementation of the CVPR'24 paper [Adaptive Slot Attention: Object Discovery with Dynamic Slot Number]
Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
✓Academic publication links
Links to: arxiv.org, scholar.google -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.9%) to scientific vocabulary
Keywords
Repository
Official implementation of the CVPR'24 paper [Adaptive Slot Attention: Object Discovery with Dynamic Slot Number]
Basic Info
- Host: GitHub
- Owner: amazon-science
- License: apache-2.0
- Language: Python
- Default Branch: main
- Homepage: https://kfan21.github.io/AdaSlot/
- Size: 1.44 MB
Statistics
- Stars: 41
- Watchers: 1
- Forks: 2
- Open Issues: 9
- Releases: 0
Topics
Metadata Files
README.md
Official PyTorch Implementation of Adaptive Slot Attention: Object Discovery with Dynamic Slot Number
Adaptive Slot Attention: Object Discovery with Dynamic Slot Number
Ke Fan, Zechen Bai, Tianjun Xiao, Tong He, Max Horn, Yanwei Fu†, Francesco Locatello, Zheng Zhang
This is the official implementation of the CVPR'24 paper Adaptive Slot Attention: Object Discovery with Dynamic Slot Number.
Introduction

Object-centric learning (OCL) uses slots to extract object representations, enhancing flexibility and interpretability. Slot attention, a common OCL method, refines slot representations with attention mechanisms but requires predefined slot numbers, ignoring object variability. To address this, a novel complexity-aware object auto-encoder framework introduces adaptive slot attention (AdaSlot), dynamically determining the optimal slot count based on data content through a discrete slot sampling module. A masked slot decoder suppresses unselected slots during decoding. Extensive testing shows this framework matches or exceeds fixed-slot models, adapting slot numbers based on instance complexity and promising further research opportunities.
News!
- [2024.11.02] We released the pre-trained checkpoints! Please find them at this link!
- [2024.08.24] We open-sourced the code!
Development Setup
Installing AdaSlot requires at least python3.8. Installation can be done using poetry. After installing poetry, check out the repo and setup a development environment:
```bash
install python3.8
sudo apt update sudo apt install software-properties-common sudo add-apt-repository ppa:deadsnakes/ppa sudo apt install python3.8
install poetry with python3.8
curl -sSL https://install.python-poetry.org | python3.8 - --version 1.2.0
add poetry to environment variable
create virtual environment with poetry
cd $code_path poetry install -E timm ```
This installs the ocl package and the cli scripts used for running experiments in a poetry managed virtual environment. Activate the poetry virtual environment poetry shell before running the experiments.
Running experiments
Experiments are defined in the folder configs/experiment and can be run
by setting the experiment variable. For example, if we run OC-MOT on Cater dataset, we can follow:
```bash poetry shell
python -m ocl.cli.train +experiment=projects/bridging/dinosaur/moviefeatrecvitb16.yaml python -m ocl.cli.train +experiment=projects/bridging/dinosaur/moviefeatrecvitb16adaslot.yaml +loadmodelweight=PATH-TO-KMAX-SLOT-CHECKPOINT python -m ocl.cli.eval +experiment=projects/bridging/dinosaur/moviefeatrecvitb16adasloteval.yaml ++loadcheckpoint=PATH-TO-ADASLOT-CHECKPOINT
python -m ocl.cli.train +experiment=projects/bridging/dinosaur/movicfeatrecvitb16.yaml python -m ocl.cli.train +experiment=projects/bridging/dinosaur/movicfeatrecvitb16adaslot.yaml +loadmodelweight=PATH-TO-KMAX-SLOT-CHECKPOINT python -m ocl.cli.eval +experiment=projects/bridging/dinosaur/movicfeatrecvitb16adasloteval.yaml ++loadcheckpoint=PATH-TO-ADASLOT-CHECKPOINT
python -m ocl.cli.train +experiment=projects/bridging/dinosaur/cocofeatrecdinobase16.yaml python -m ocl.cli.train +experiment=projects/bridging/dinosaur/cocofeatrecdinobase16adaslot.yaml +loadmodelweight=PATH-TO-KMAX-SLOT-CHECKPOINT python -m ocl.cli.eval +experiment=projects/bridging/dinosaur/cocofeatrecdinobase16adasloteval.yaml ++loadcheckpoint=PATH-TO-ADASLOT-CHECKPOINT
python -m ocl.cli.train +experiment=slotattention/clevr10.yaml python -m ocl.cli.train +experiment=slotattention/clevr10adaslot.yaml +loadmodelweight=PATH-TO-KMAX-SLOT-CHECKPOINT python -m ocl.cli.eval +experiment=slotattention/clevr10adasloteval.yaml ++load_checkpoint=PATH-TO-ADASLOT-CHECKPOINT ```
The result is saved in a timestamped subdirectory in outputs/<experiment_name>, i.e. outputs/OC-MOT/cater/<date>_<time> in the above case. The prefix path outputs can be configured using the experiment.root_output_path variable.
Citation
Please cite our paper if you find this repo useful!
bibtex
@inproceedings{fan2024adaptive,
title={Adaptive slot attention: Object discovery with dynamic slot number},
author={Fan, Ke and Bai, Zechen and Xiao, Tianjun and He, Tong and Horn, Max and Fu, Yanwei and Locatello, Francesco and Zhang, Zheng},
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
pages={23062--23071},
year={2024}
}
Related projects that this paper is developed upon:
bibtex
@misc{oclf,
author = {Max Horn and Maximilian Seitzer and Andrii Zadaianchuk and Zixu Zhao and Dominik Zietlow and Florian Wenzel and Tianjun Xiao},
title = {Object Centric Learning Framework (version 0.1)},
year = {2023},
url = {https://github.com/amazon-science/object-centric-learning-framework},
}
Owner
- Name: Amazon Science
- Login: amazon-science
- Kind: organization
- Website: https://amazon.science
- Twitter: AmazonScience
- Repositories: 80
- Profile: https://github.com/amazon-science
GitHub Events
Total
- Issues event: 9
- Watch event: 30
- Delete event: 2
- Member event: 1
- Issue comment event: 5
- Push event: 5
- Pull request event: 5
- Fork event: 1
- Create event: 4
Last Year
- Issues event: 9
- Watch event: 30
- Delete event: 2
- Member event: 1
- Issue comment event: 5
- Push event: 5
- Pull request event: 5
- Fork event: 1
- Create event: 4
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 6
- Total pull requests: 8
- Average time to close issues: 2 months
- Average time to close pull requests: 5 months
- Total issue authors: 4
- Total pull request authors: 1
- Average comments per issue: 0.83
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 8
Past Year
- Issues: 6
- Pull requests: 4
- Average time to close issues: 2 months
- Average time to close pull requests: N/A
- Issue authors: 4
- Pull request authors: 1
- Average comments per issue: 0.83
- Average comments per pull request: 0.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 4
Top Authors
Issue Authors
- FBehrad (3)
- JunyongPark97 (1)
- MingfuYAN (1)
- nricciardi (1)
- shllgtca (1)
Pull Request Authors
- dependabot[bot] (11)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- 206 dependencies
- black ^22.1.0 develop
- flake8 ^4.0.1 develop
- flake8-bugbear ^22.1.11 develop
- flake8-docstrings ^1.6.0 develop
- flake8-isort ^4.1.1 develop
- flake8-tidy-imports ^4.6.0 develop
- pre-commit ^2.17.0 develop
- pytest ^7.0.1 develop
- Pillow 9.0.1
- awscli ^1.22.90
- botocore ^1.27.22
- decord 0.6.0
- einops ^0.6.0
- ftfy ^6.1.1
- hydra-core ^1.2.0
- hydra-submitit-launcher ^1.2.0
- hydra-zen ^0.7.0
- importlib-metadata 4.2
- jupyter ^1.0.0
- matplotlib ^3.5.1
- mlflow ^1.29.0
- motmetrics ^1.2.5
- moviepy ^1.0.3
- pluggy ^1.0.0
- pyamg ^4.2.3
- python >=3.7.1,<3.9
- pytorch-lightning ^1.5.10
- regex ^2022.7.9
- scikit-learn ^1.0.2
- scipy <=1.8
- timm 0.6.7
- torch 1.12.*
- torchmetrics ^0.8.1
- torchtyping ^0.1.4
- torchvision 0.13.*
- webdataset ^0.1.103