You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
monai.transforms.RandomWeightedCrop uses the function monai.transforms.utils.weighted_patch_samples. At line 576 in utils the weighted_patch_samples function converts the datatype of the randomly generate number in the range of (0,1) to match the datatype of the input weightmap.
"""
r, *_ = convert_to_dst_type(r_state.random(n_samples), v)
"""
If the weightmap consisted of integers then the random value will always be the integer of 0, which disables random sampling and instead samples from the first valid region continuously.
To Reproduce
Steps to reproduce the behavior:
Create a numpy weightmap with integer datatype
Pass weightmap into RandomWeightedCrop
Observe the "crop_center" value in the meta data of the cropped image after multiple iterations it will remain constant
Expected behavior
The random factor "r" should never be an converted to an integer.
The text was updated successfully, but these errors were encountered:
Describe the bug
monai.transforms.RandomWeightedCrop uses the function monai.transforms.utils.weighted_patch_samples. At line 576 in utils the weighted_patch_samples function converts the datatype of the randomly generate number in the range of (0,1) to match the datatype of the input weightmap.
"""
r, *_ = convert_to_dst_type(r_state.random(n_samples), v)
"""
If the weightmap consisted of integers then the random value will always be the integer of 0, which disables random sampling and instead samples from the first valid region continuously.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The random factor "r" should never be an converted to an integer.
The text was updated successfully, but these errors were encountered: