The current layout of training and inference scripts contain lengthy functions which covers the whole process in one step, this is not friendly to write unit tests to boost the robustness. Thus refactoring big functions to small and testable functions is needed for future development.
To propose a new training script (train.py) without changing current logic:
Note: Individual functions have been wrapped in rectangle, common utility functions which will be called in both training and inference are colored in orange.

To propose a new inference script (segment.py) without changing current logic:

Feedbacks are welcomed @dylanmcreynolds @Wiebke @taxe10 @ahexemer.