add transformation to memory data layer#3100
Conversation
|
This is exactly what I was looking for and I'm not sure why it wasn't supported. Can you elaborate what you mean by set by a pointer via reset? Would this also work using python.set_input_arrays? (I got a cublas error attempting to use this through python and I'm trying to diagnose). |
|
@bwilbertz It looks like this code assumes height/width are preserved during transformation, which is usually not the case, am I missing something? |
|
Hi dfagnan. Yes, python.set_input_arrays uses this mechanism. What do you exactly mean by "height/width are preserved during transformation"? This PR uses (like in the DataLayer) DataTransformer::Transform(Blob* input_blob, Blob* transformed_blob) for the transformation. That means, if you have input pictures in 1024x768, you would specify this height/width in the proto file and when setting a crop of 256, all the output blobs would have size 256x256. |
|
Sorry for the delay in following up but this code worked exactly as I hoped. My error was an unrelated bug with memory data layer which has been addressed but not merged here: #2334. Thanks for the great work. I still don't understand the details of the code, but will leave that for another day! |
|
Great :) |
|
Closing according to #5528, but thanks @bwilbertz for proposing an improvement to the layer (in good form too with a test). |
Rebased from PR BVLC#3100
Rebased from PR BVLC#3100
This PR adds transformations according to TransformParam to the MemoryDataLayer for the case that data is directly set by a pointer via reset. The transformations (on the blobs) are done on-the-fly during Forward. Including test cases.