Models Inconsistency
@shaneahmed is already working on this.
Since Sep 20, 2024.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python, pytorch
- Domain
- machine-learning
Research direction
Start with ModelABC and compare the model implementations mentioned in vanilla.py, unet.py, hovernet.py, and micronet.py, focusing on forward, infer_batch, _transform, preproc, and _preproc. Review how the existing methods are documented before reorganizing the custom models. Done means the pipeline is consistently structured, ModelABC documents normalization, activation, inference, training, and postprocessing, and a documentation page explains evaluation and training.
Written by the indexing model from the issue text.
Description
- TIA Toolbox version: 1.3.3
- Python version: 3.10.8
Description
Tiatoolbox has several pre-trained models helpful for data processing. However, models differ in how they handle input and output, making them confusing to use (especially when customizing):
- Activation functions apply at different steps for different models. Sometimes in
forwardmethod (e.g.CNNModel), sometimesforwardreturns a raw layer output and the transformation applies ininfer_batch(e.g.UNetModel). - Moreover, activation functions are hardcoded. To customize, you can't simply change an attribute; you must overwrite the whole method (different for each model).
- Data normalization distributes across methods:
HoVerNetuses it inforward,UNetModelin_transform,MicroNetinpreproc, and vanilla models rely on the user to do so. - Data preprocessing also lacks consistency. Even though it should happen in
preproc_func/_preprocfunctions,UNetModeluses its own_transform, unrelated to the standard methods. Yet, its behavior could implement in_preproc.
What to do
Refactoring the code will significantly improve readability:
- Decompose the pipeline into small granular methods in
ModelABC: one method for normalization, activation function as an attribute, etc. - Explain
ModelABCmethods in their documentation: doesinfer_batch relyonpostproc_func? Caninfer_batchbe used for training? How? - Reorganize custom model methods to match the new
ModelABCstructure. - Add a new page to the documentation explaining the Tiatoolbox models pipeline: how is it related to the PyTorch pipeline? How to evaluate a model? How to train a model?
- Dominant language
- Python
- Stars
- 551
- Forks
- 112
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 13
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from TissueImageAnalytics/tiatoolbox
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
TissueImageAnalytics/tiatoolbox#1055 ·
All issues in TissueImageAnalytics/tiatoolbox
Similar issues
-
area/auth bug comp/agent P3 platform/discord type/security
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
NousResearch/hermes-agent#117848 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100