funkelab / gunpowder

A library to facilitate machine learning on multi-dimensional images.
https://funkelab.github.io/gunpowder/
MIT License
78 stars 56 forks source link

Fix SimpleAugment upstream request #98

Closed riels89 closed 4 years ago

riels89 commented 4 years ago

Old tranpose:

  1. Prepare: Request transposed ROI !Problem
  2. Process: Tranpose ROI back to fit Request !Covers up problem 1
  3. Process: Transpose array data
  4. Proces: Transpose location data with respect to source ROI !Problem

When requesting a tranposed ROI the source does not get tranposed, instead the ROI request is just shifted and it gets data from a different part of the source than was requested by SimpleAugment's downstread node. The Roi is then tranposed back to fit the original request, but still has the data from the translated ROI.

The points are then tranposed with respect to the global source by just filping the ROI dims. This is an issue because we already tranposed the ROI back to the downstream request so locations can be outside of the request dim.

New tranpose:

  1. Prepare: Use downsteam reqest
  2. Transpose array data
  3. Tranpose graph locations with respect to the batch's total ROI

This change will also no longer change request with respect to the mirror, for the same reasons as the transpose change.

This way we request the spot on the source that the downstream node wanted, and point locations are not placed incorrectly.

Added 3 tests and improved existing mirror test.

Some tests make all possible permuations of mirror/transposes to ensure tranposed and mirrored locations are put in expected locations.