Skip to content
프로젝트

bdsaglam/torch-scae has 38 GitHub stars and 9 forks. GitHot measured 0 stars in 24 hours and 0 in 7 days. Last checked 2026-11-20 11:42 UTC. Last push 2026-09-23.

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
기록 수집 중
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

소개

PyTorch implementation of Stacked Capsule Auto-Encoders

머신러닝

README.md

Original

torch-scae

PyTorch implementation of Stacked Capsule Auto-Encoders [1].

Ported from official implementation with TensorFlow v1. The architecture of model and hyper-parameters are kept same. However, some parts are refactored for ease of use.

Please, open an issue for bugs and inconsistencies with original implementation.


Installation

# clone project   
git clone https://github.com/bdsaglam/torch-scae   

# install project   
cd torch-scae
pip install -e .

Train with MNIST Open In Colab

It uses PyTorch Lightning for training and Hydra for configuration management.

# CPU
python -m torch_scae_experiments.mnist.train

# GPU
python -m torch_scae_experiments.mnist.train +trainer.accelerator=gpu +trainer.devices=1

You can customize model hyperparameters and training with Hydra syntax.

python -m torch_scae_experiments.mnist.train \
    data_loader.batch_size=32 \
    optimizer.learning_rate=1e-4 \
    model.n_part_caps=16 \
    trainer.max_steps=100000

Evaluate a checkpoint with linear probes and with k-means clustering plus bipartite matching, as in the paper:

python -m torch_scae_experiments.mnist.evaluate path/to/last.ckpt

Results

Unsupervised classification accuracy (%) on the 40x40 MNIST test set after 300k steps with the default configuration, which follows the reference run_mnist.sh (40 part capsules, 32 object capsules).

LIN-MATCH LIN-PRED
Paper [1], Table 1 (5 runs) 98.7 (0.35) 99.0 (0.07)
This implementation, seed 42 98.6 98.9
This implementation, seed 43 98.7 98.8

LIN-MATCH fits k-means with 10 clusters on the object capsule presences of the training set and matches clusters to labels; the table reports the posterior presences. LIN-PRED is the better of the two linear probes trained alongside the model. Training takes about 4 hours on an A100.

Image reconstructions

reconstructions

Fig 1. Rows: test images and their reconstructions

References

  1. Kosiorek, A. R., Sabour, S., Teh, Y. W., & Hinton, G. E. (2019). Stacked Capsule Autoencoders. NeurIPS. http://arxiv.org/abs/1906.06818