data_tools icon indicating copy to clipboard operation
data_tools copied to clipboard

Need some modifications on data_augmentation.py

Open wenmengliu opened this issue 7 years ago • 6 comments

Hi Eugene,

Currently, I am using data_tools on the LiTS2017 dataset. I notice that in the data_augmentation.py line 154-156 in the 'image_random_transform' function might need some modifications. Because, in the repo, the input_image shape is based on 'tensorflow' (n_w,n_h,n_c) but if the input_image shape is on 'theano'. Using this function directly will cause the error? I mean I set the input_image shape is on 'theano' in (n_c,n_w,n_h). So I think it might need modifications under this case (Actually I changed it when I used, I just wanna ask it whether I did it right or not). Please kindly correct me if I were wrong.

screen shot 2018-10-09 at 10 59 22 am

Cheers, Crystal

wenmengliu avatar Oct 09 '18 18:10 wenmengliu

Hi Eugene,

I mean if the image.data_format is tensorflow, it needs to change the order. Sorry I typed it wrongly. Now I am working on building up the model. Last week, I finished the architectures of U-net and ResNet and then I could understand your paper and your code. When I finished my temporary work, I might discuss some details with you!

Cheers, Crystal

On Oct 9, 2018, at 11:30 AM, Eugene Vorontsov [email protected] wrote:

Reopened #4 https://github.com/veugene/data_tools/issues/4.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/veugene/data_tools/issues/4#event-1893617376, or mute the thread https://github.com/notifications/unsubscribe-auth/ALB4V1Xu9ncz5MM0c3DNS6niVhFO1WJ3ks5ujOspgaJpZM4XT1Jy.

wenmengliu avatar Oct 09 '18 18:10 wenmengliu

Yes, it looks like the channel axis handling in image_random_transform is incomplete and incorrect for non-default channel dims (default is 0). Currently, image_stack_random_transform handles arbitrary channel dims correctly.

Handling a non-zero channel dim could either be fixed in image_random_transform or removed.

veugene avatar Oct 09 '18 18:10 veugene

Are you using fcn_maker? UNet and ResUNet could be created (in 2D or 3D, with many possible modifications) using fcn_maker.models.assemble_unet or fcn_maker.models.assemble_resunet.

https://github.com/veugene/fcn_maker/tree/pytorch

veugene avatar Oct 09 '18 18:10 veugene

Actually I tried to use them in my model. But it seems a little bit complicated for me to apply it directly. So I wrote them by myself with a reference to your repo. I might be too new in this field so I failed to use this fcn_maker directly.

On Oct 9, 2018, at 11:38 AM, Eugene Vorontsov [email protected] wrote:

Are you using fcn_maker? UNet and ResUNet could be created (in 2D or 3D, with many possible modifications) using fcn_maker.models.assemble_unet or fcn_maker.models.assemble_resunet.

https://github.com/veugene/fcn_maker/tree/pytorch https://github.com/veugene/fcn_maker/tree/pytorch — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/veugene/data_tools/issues/4#issuecomment-428303330, or mute the thread https://github.com/notifications/unsubscribe-auth/ALB4V1LtFfTTzlrw6ZqSjPMWLCJGRS6Zks5ujO0OgaJpZM4XT1Jy.

wenmengliu avatar Oct 09 '18 18:10 wenmengliu

As a side note there is a neat data augmentation lib called Augmentor now, but I don't know if it supports 3D operations.

Gabsha avatar Oct 09 '18 19:10 Gabsha

Oh, that looks like it got popular. It seems that for elastic deformations, they anchor all image edges whereas we allow all edges and corners to be deformed since we support 'reflect' filling, where the reflected edges and corners are also deformed and sized appropriately for each deformed image. I wonder how much that matters in practice.

veugene avatar Oct 09 '18 19:10 veugene