Imageomics / Imageomics/pybioclip

CPU bottleneck in taxonomy aggregation for non-species predictions

Open
#147 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
67
Forks
14
PR merge metrics
No merged PRs in 30d

Description

When requesting higher taxonomic ranks (genus, family, order, etc.), `TreeOfLifeClassifier.predict()` seems to aggregate the species-level probabilities up the taxonomy tree. Currently, this aggregation uses CPU loops with dictionary lookups - creating a major bottleneck.

With 10k plant images and the current 350K plantae species in the TOL embeddings, that's 3.5 billion dictionary operations on a single CPU-core. I suggest moving this to the GPU with precomputed species-rank mappings up front and using PyTorch `scatter_add` for accumulation. In my 10k dataset, this went from ~130 minutes for family-level predictions to ~4.8 minutes.

Happy to submit PR if interested.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at TreeOfLifeClassifier.predict() and trace the taxonomy aggregation path for genus, family, and order predictions. Benchmark the current 10k-image case, then verify that the completed aggregation avoids the CPU dictionary-loop bottleneck and preserves the expected higher-rank probabilities.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning, performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.