Add flag to do test time augmentation to improve prediction robustness #98
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a boolean flag to the CLI and lib functions which enables test-time augmentation in the find-kelp and find-mussels functions.
For each image chip, it is classified in it's normal orientation, then repeatedly rotated 90 degrees and reclassified. The chips are then flipped horizontally, reclassified, and finally flipped vertically and reclassified. In total, each chip is classified 6 times in different orientations. The predictions are then un-flipped and rotated such that each chip has 6 predictions in the correct orientation. Finally, individual pixels are classified using a combination of all these predictions such that the most confident prediction over all the possible orientations is used as the final output.
The result of this is that processing an image takes about 6 times as long as in the normal, non-tta, mode to process. However, the outputs are generally expected to be of higher quality.