[Question]Can data enhancement be turned off during prediction?
Lynclock opened this issue · comments
❓ Question
Hi,
Can data enhancement be turned off during prediction?
When the statement “transformed= transform(**batch)” is executed, I save the result of “batch[0]” and the result of "transformed[0]", and find that they are exactly the same, as if the transformation did not work. As follows:
`
def predict_with_transformation(self,
model: AbstractModel,
batch: Dict,
batch_num: int,
transform: Callable,
inverse_transform: Callable,
):
"""
Run prediction with the specified transformations
Args:
model: model to predict
batch: input batch to model
batch_num: batch index
transform: transform to apply to batch.
inverse_transform: inverse transform to apply to batch and resuls
"""
batch = to_device(batch, device=self.device)
if self.pre_transform is not None:
batch = self.pre_transform(**batch)
x1 = batch['data'].cpu().numpy()[0]
Data = np.squeeze(x1)
tem = sitk.GetImageFromArray(Data)
sitk.WriteImage(tem, "batch0.nii.gz")
transformed = transform(**batch)
t1 = transformed['data'].cpu().numpy()[0]
Data1 = np.squeeze(t1)
tem1 = sitk.GetImageFromArray(Data1)
sitk.WriteImage(tem1, "transformed0.nii.gz")
`
Thank you!
Lynclock
It is possible to disable TTA in the inference commands. Regarding your observation:
nnDetection/nndet/inference/transforms.py
Lines 38 to 39 in 06c2eb4
The first transform is intended to perform "nothing" and the remaining transforms will mirror the data in the different directions.
I see.Thank you!
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.