Skip to content

Conversation

@drgmo
Copy link
Contributor

@drgmo drgmo commented Jan 13, 2026

This adds the TICON encoder for slide-level contextualization of tile embeddings, following the TICON paper: (https://arxiv.org/abs/2512.21331 , Belagali et al.)

  • Ticon has two inference modes:
    -->"with slide context":
    all tile embeddings are processed together, allowing each tile to receive context from the full slide-level neighborhood (note: extractor of is automatically detected from .h5- metadata, no config-input necessary)
    -->"without slide context/ isolated:
    tiles are processed independently (note: extractor must be specified in config-input)

-->in each case, all currently supported extractors are available (UNI2, H-Optimus-1, GigaPath, CONCH1_5, Virchow2)

@mducducd
Copy link
Collaborator

mducducd commented Jan 14, 2026

Hello,
Thank you for your efforts. I suggest that whether new slide-encoders or tile feature extractors should be standalone modules. In stamp/modeling/models is the space for specific-task aggregation models (predictor) only.

drgmo added 5 commits January 15, 2026 09:58
…iles; now it is fully integrated with only minor changes in the original STAMP pipeline. **kwargs was added encoding/encoder/__init__.py in _generate_slide_embedding() and _save_features_() to enable saving additional information, e.g. tile_size_px, tile_size_um, and coords, which is necessary to use the contextualized slides for further processing in STAMP.
@mducducd
Copy link
Collaborator

I would clarify this, correct me if I am wrong: author didn't say about thier public ckpt but it implicitly showed that this one is for tile-lvl. If you try to run their inference example then the output shape should be (B, N, D) not (B, D). Therefore we still use these features for bag instance training. The current ckpt is not Tangle version (slide-level encoder) tbh.

@mducducd mducducd requested a review from s1787956 January 15, 2026 11:49
@drgmo
Copy link
Contributor Author

drgmo commented Jan 16, 2026

Absolutely, both modes are tile-level…from my understanding the difference is that in isolated mode each tile is processed alone, whereas in the other mode “with slide-context”: “all tiles are processed together” and in the end you still have tile level features (“contextualized features”, not slide-level).

@s1787956
Copy link
Contributor

Please add a mode where you aggregate the tile level features of TICON (with context), such that we act like its a slide-level encoder. I think this should fairly well. We should compare that to the normal stamp modeling on TICONs tile level output (sophia Transformer) und usual stamp pipeline.
Thank you both!

@mducducd
Copy link
Collaborator

mducducd commented Jan 16, 2026

I would give some comments here:

  • In this, they said Tangle model will be released soon. That means pretrained checkpoint is separated and we do not have to aggregate tile feature ourself. Moreover, random extra pooling is not an idea.
  • In add feature extractor TICON #142 (comment), a h_optimus1+ticon feature extractor is ready for plug and play MIL experiments. This is not a TICON repo and Stamp does not serve TICON only, so I would prefer to prioritily adopt the best variant for each tile and slide level rather than making all setting available. And to retain the fairness to later benchmarks in academic publications. Furthermother, stamp config is already complicated to pathologists then adding more params like "tile-extractor" maybe not worth.
  • Holistically, we should think that contextualized feats are higher representation in brief maner. Foundation models learn to reconstruct image-level, TICON learns to reconstruct foundation model's out features (in pretraining stage). This distinction helps clarify how the term “contextualization” is used here.
  • When the new ckpt be availabe, you can implement it as slide encoder like Eagle or Prism and encode directly h_optimus/conch1_5/uni_2 features. I guess model's output will give us (B, D) in slide-level representation. I have a concern that results maybe not good by the way you are using tile-lvl ckpt for slide-encoder, and if you execute stamp slide-encode, it will mark .h5 features (in [B,N,D] if they are not agrregated into [B,D]) as slide-lvl type then leads to wrong model class when training or crossval.
  • In the end, I hope to merge this PR add feature extractor TICON #142 for tile-lvl and wait for Tangle pretrained. What do you think? @drgmo @s1787956

@drgmo drgmo force-pushed the ticon-contextualizer branch from 2846072 to b1b79ff Compare January 17, 2026 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants