Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Bug in RandomCropNearBBox #1806

Closed
ternaus opened this issue Jun 19, 2024 · 1 comment
Closed

[Bug] Bug in RandomCropNearBBox #1806

ternaus opened this issue Jun 19, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@ternaus
Copy link
Collaborator

ternaus commented Jun 19, 2024

RandomCropNearBbox is not working.

aug = Compose([RandomCropNearBBox(max_part_shift=(0.1, 0.5), cropping_bbox_key='test_box')],
bbox_params=BboxParams("pascal_voc"))
result = aug(image=image, bboxes=bboxes, test_box=[0, 5, 10, 20])

leads to:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[89], line 3
      1 aug = A.Compose([A.RandomCropNearBBox(max_part_shift=(0.1, 0.5), cropping_bbox_key='test_box')],
      2               bbox_params=A.BboxParams("pascal_voc"))
----> 3 result = aug(image=image, bboxes=[[1, 2, 3, 4]], test_box=[0, 5, 10, 20])

File ~/workspace/albumentations/albumentations/core/composition.py:269, in Compose.__call__(self, force_apply, *args, **data)
    266 if not need_to_run:
    267     return data
--> 269 self.preprocess(data)
    271 for t in self.transforms:
    272     data = t(**data)

File ~/workspace/albumentations/albumentations/core/composition.py:297, in Compose.preprocess(self, data)
    295 def preprocess(self, data: Any) -> None:
    296     if self.is_check_args:
--> 297         self._check_args(**data)
    298     for p in self.processors.values():
    299         p.ensure_data_valid(data)

File ~/workspace/albumentations/albumentations/core/composition.py:358, in Compose._check_args(self, **kwargs)
    356 if data_name not in self._available_keys and data_name not in ["mask", "masks"]:
    357     msg = f"Key {data_name} is not in available keys."
--> 358     raise ValueError(msg)
    359 internal_data_name = self._additional_targets.get(data_name, data_name)
    360 if internal_data_name in checked_single:

ValueError: Key test_box is not in available keys.
@ternaus ternaus added the bug Something isn't working label Jun 19, 2024
@ternaus
Copy link
Collaborator Author

ternaus commented Jun 20, 2024

Fixed

@ternaus ternaus closed this as completed Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant