🎨 Refactor ModelABC to Help Use Default Torch Models#867
🎨 Refactor ModelABC to Help Use Default Torch Models#867shaneahmed wants to merge 24 commits intodev-define-engines-abcfrom
ModelABC to Help Use Default Torch Models#867Conversation
Signed-off-by: Shan E Ahmed Raza <13048456+shaneahmed@users.noreply.github.com>
Signed-off-by: Shan E Ahmed Raza <13048456+shaneahmed@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev-define-engines-abc #867 +/- ##
==========================================================
- Coverage 91.19% 91.11% -0.09%
==========================================================
Files 73 73
Lines 9374 9379 +5
Branches 1230 1230
==========================================================
- Hits 8549 8546 -3
- Misses 792 800 +8
Partials 33 33 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| with torch.inference_mode(): | ||
| output = model(img_patches_device) | ||
| # Output should be a single tensor or scalar | ||
| return {"probabilities": output.cpu().numpy()} |
There was a problem hiding this comment.
In the current develop branch, neither CNNModel, nor CNNBackbone returned dictionaries as output of their infer_batch() methods. Also, CNNModel currently returns an array, while CNNBackbone returns a list with the array. It might be fine, just wanted to highlight this.
CNNModel
CNNBackbone
There was a problem hiding this comment.
Thanks. We are aware of this. Our preference is to use torch nn models but to generalise for multi modal output we may need dictionaries. This PR is to check if we can move to generic torch models or we will need a sub class.
…rch-nn-model # Conflicts: # tests/models/test_arch_vanilla.py # tiatoolbox/models/architecture/vanilla.py
…rch-nn-model # Conflicts: # tiatoolbox/models/engine/engine_abc.py
ModelABCto Help Use Default Torch Modelsinfer_batchfromModelABC