BVLC/caffe — pull request #1386 by drdan14 (2014-10-31 22:47:09+00:00)
Title: Data augmentation via random rotations

My dataset is agnostic to which direction in the image is "up" and therefore can be augmented with random rotations. This PR implements a `rotate` option in the `TransformationParameter` message which operates analogously to `mirror`. It's `false` by default; setting it to `true` causes images to be randomly rotated by an integer multiple of 90 degrees. If `mirror` is also enabled, there are 8 possibilities for the randomly transformed output image.

I added unit tests to `test_data_transformer.cpp` by copying and pasting some pre-existing mirroring unit tests; the tests show that this transformation runs, but they don't prove that it does what I expect it to do (i.e., rotate an image properly). I'm not a pro at Caffe unit tests, so if anyone can suggest how to write a unit test that confirms that the rotation is working properly, I'd be happy to implement it. I can (and probably will) copy the logic to a little test script in Matlab to convince myself that the logic is working, but that's not really good enough as a unit test.

I have not yet tried to train a network using the `rotate` parameter but that's next on my list. In the mean time, eyeballs on my rotation (and generalized mirroring) logic are welcome.