aim-uofa / AdelaiDet

AdelaiDet is an open source toolbox for multiple instance-level detection and recognition tasks.
https://git.io/AdelaiDet
Other
3.37k stars 647 forks source link

ValueError: Cannot finished cropping adjustment within 25 tries (#instances 637). #630

Open 13181713593 opened 4 months ago

13181713593 commented 4 months ago

I made a mistake in training, the following is the error message.

File "/home/XX/detectron2-master/detectron2/data/transforms/augmentation.py", line 347, in apply_augmentations
    return AugmentationList(augmentations)(self)
  File "/home/XX/detectron2-master/detectron2/data/transforms/augmentation.py", line 264, in __call__
    tfm = x(aug_input)
  File "/home/XX/detectron2-master/detectron2/data/transforms/augmentation.py", line 165, in __call__
    tfm = self.get_transform(*args)
  File "/home/XX/DeepSolo_ori/adet/data/augmentation.py", line 110, in get_transform
    return gen_crop_transform_with_instance(
  File "/home/XX/DeepSolo_ori/adet/data/augmentation.py", line 53, in gen_crop_transform_with_instance
    raise ValueError(
ValueError: Cannot finished cropping adjustment within 25 tries (#instances 637).

(DEEPSOLO) XX@XX:~/XX/DeepSolo$ /home/XX/anaconda2/envs/DEEPSOLO/lib/python3.8/multiprocessing/resource_tracker.py:216: UserWarning: resource_tracker: There appear to be 96 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '

the source code in "adet/data/augmentation.py", line 53:

# if some instance is cropped extend the box
if not crop_box:
        num_modifications = 0
        modified = True

    #convert crop_size to float

    crop_size = crop_size.astype(np.float32)
    while modified:
        modified, x0, y0, crop_size = adjust_crop(x0, y0, crop_size, instances)
        num_modifications += 1
        if num_modifications > 25:
            raise ValueError(
                "Cannot finished cropping adjustment within 25 tries (#instances {}).".format(
                    len(instances)
                )
            )
            return T.CropTransform(0, 0, image_size[1], image_size[0])

return T.CropTransform(*map(int, (x0, y0, crop_size[1], crop_size[0])))

I don't know why such a requirement num_modifications > 25, and how to settle this problem