MIC-DKFZ / nnDetection

nnDetection is a self-configuring framework for 3D (volumetric) medical object detection which can be applied to new data sets without manual intervention. It includes guides for 12 data sets that were used to develop and evaluate the performance of the proposed method.
Apache License 2.0
553 stars 97 forks source link

[Question] Visualize the augmented data. #280

Open ArpanGyawali opened 1 week ago

ArpanGyawali commented 1 week ago

I am working on LVO detection. I used the base_more augmentation with some modification. I only wanted rotation on z-axis and only horizontal flip on axial view. So i changed the miror axis to [0]. But i am not sure i did the right thing. So, i wanted to know if there is a way to visualize the augmented data? Or if i need to create my own script? Even if i am right or wrong in the case of mirroring, it would be great if i would be able to visualize those dataset. Thanks.

mibaumgartner commented 1 week ago

Dear @ArpanGyawali ,

there is no build in way of visualising the augmented data, so you need to write your own script.

Best, Michael

ArpanGyawali commented 1 week ago

Thanks @mibaumgartner Can you give some insights to in? Where can i start from? Where the data is loaded before training and after augmentation?

ArpanGyawali commented 1 week ago

hi @mibaumgartner @partha-ghosh
Also in addition, do you have some say regarding the mirror axis stated in above question.

partha-ghosh commented 6 days ago

Hi @ArpanGyawali, You can run the code in single threaded mode with multiprocessing: False in the config file. If you debug through the code you will find the data is being loaded in here: https://github.com/MIC-DKFZ/nnDetection/blob/b0504dc6daa057d1a49d2e58203431117f1ff739/nndet/io/datamodule/bg_loader.py#L185 and the transforms are being applied in batchgenerators: https://github.com/MIC-DKFZ/batchgenerators/blob/f53025bd05fe9642133ac539a0df3559d82415b4/batchgenerators/dataloading/single_threaded_augmenter.py#L38

The documentation on MirrorTransform from batchgenerators says: 'Randomly mirrors data along specified axes. Mirroring is evenly distributed. Probability of mirroring along each axis is 0.5'

Best, Partha

mibaumgartner commented 6 days ago

Dear @ArpanGyawali ,

please note that nnDetection transposes the data during its preprocessing -> the anisotropic axes (usually denoted by z) is moved to the first position (i.e. index 0). The definition of left/right depends on you data since the other axis do not change their ordering. Setting the mirror axis to [0] results in mirroring which is only performed along the z direction.

Having a visual look is definitely recommended when manipulating augmentation settings :)

Best, Michael

ArpanGyawali commented 5 days ago

@mibaumgartner @partha-ghosh Thanks, i will try to do something for visualizing the augmented images. If i run into some issue then, i shall ask for help.