ValueError: empty range for randrange() (0, -127, -127)

17 views Asked by At

This is my first time to use this package Augmentor, a Python package designed to aid the augmentation and artificial generation of image data for machine learning tasks.When I try to call the sample function from this package then it showed error.Here is the code about how I call the function.

p = Augmentor.DataPipeline([[sample, target]], [1])
if sample.shape[:2]!=(self.img_size, self.col_size):
      p.resize(probability=1, height=self.img_size, width=self.col_size)
p.resize(probability=1, width=256, height=256)
p.flip_left_right(probability=0.5)
p.flip_top_bottom(probability=0.5)
p.shear(probability=0.2, max_shear_left=25, max_shear_right=15)
p.rotate(probability=0.3, max_left_rotation=10, max_right_rotation=10)
p.random_distortion(probability=0.1, grid_width=16, grid_height=16, magnitude=2)
p.crop_random(probability=0.2, percentage_area=0.5)
p.crop_by_size(probability=1, width=256, height=256)[0].shape, p.augmentor_images[0][0].dtype)
augmented_images, labels = p.sample(1)```


The error ouput:
 File "D:\chooooock\MD\deepproject\ganseg\dataset.py", line 179, in __getitem__
    augmented_images, labels = p.sample(1)
  File "C:\Users\chooooock\.conda\envs\ganseg\lib\site-packages\Augmentor\Pipeline.py", line 1918, in sample
    images_to_return = operation.perform_operation(images_to_return)
  File "C:\Users\chooooock\.conda\envs\ganseg\lib\site-packages\Augmentor\Operations.py", line 1006, in perform_operation
    left_shift = random.randint(0, int((w - self.width)))
  File "C:\Users\chooooock\.conda\envs\ganseg\lib\random.py", line 248, in randint
    return self.randrange(a, b+1)
  File "C:\Users\chooooock\.conda\envs\ganseg\lib\random.py", line 226, in randrange
    raise ValueError("empty range for randrange() (%d, %d, %d)" % (istart, istop, width))
ValueError: empty range for randrange() (0, -127, -127)
0

There are 0 answers