Closed Steffen-Wolf closed 1 year ago
In the tensorflow prediction node if skip_empty==True the check statement seems incorrect:
skip_empty==True
I am referring to https://github.com/funkey/gunpowder/blob/bb204c84293b637137b23195b8de18caf5ca1197/gunpowder/tensorflow/nodes/predict.py#L118 where the prediction is not skipped if all batch[array_key].data.sum() are not equal to zero.
batch[array_key].data.sum()
However, the sum of all values can be zero even if there are non zero values in the input image. I suggest we replace it by if batch[array_key].data.any(): as proposed here: https://stackoverflow.com/questions/18395725/test-if-numpy-array-contains-only-zeros
if batch[array_key].data.any():
looks like you solved this, thanks :+1:
In the tensorflow prediction node if
skip_empty==True
the check statement seems incorrect:I am referring to https://github.com/funkey/gunpowder/blob/bb204c84293b637137b23195b8de18caf5ca1197/gunpowder/tensorflow/nodes/predict.py#L118 where the prediction is not skipped if all
batch[array_key].data.sum()
are not equal to zero.However, the sum of all values can be zero even if there are non zero values in the input image. I suggest we replace it by
if batch[array_key].data.any():
as proposed here: https://stackoverflow.com/questions/18395725/test-if-numpy-array-contains-only-zeros