-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
Search before asking
- I have searched the Supervision issues and found no similar bug report.
Bug
AttributeError Traceback (most recent call last)
/tmp/ipython-input-1680823999.py in <cell line: 0>()
24 annotated_images.append(annotated_image)
25
---> 26 grid = sv.create_tiles(
27 annotated_images,
28 grid_size=(GRID_SIZE, GRID_SIZE),
AttributeError: module 'supervision' has no attribute 'create_tiles'
Environment
Google Colab Notebook:
- Supervision: 0.27.0rc1
- Python: 3.12.11
Also Tested in Kaggle: - Supervision: 0.27.0rc1
- Python: 3.11.13
Have also tried uninstalling and reinstalling Supervision: 0.25.0 but didn't work
Minimal Reproducible Example
I was following the train-rt-detr-on-custom-dataset-with-transformers.ipynb tutorial from Roboflow from this website: https://blog.roboflow.com/train-rt-detr-custom-dataset-transformers/, which has a link to the following colab notebook https://colab.research.google.com/github/roboflow-ai/notebooks/blob/main/notebooks/train-rt-detr-on-custom-dataset-with-transformers.ipynb?ref=blog.roboflow.com. It was using an older version of supervision which still had BoundingBoxAnnotator instead of BoxAnnotator, but I was able to run it after making those changes. Despite being able to get it working, it now suddenly no longer works and after checking the changelogs I cannot find anything on sv.create_tiles being removed, but I know it definitely used to exist because this code used to work. Unfortunately, after reaching the "Display dataset sample" section it broke through the following code:
GRID_SIZE = 5
def annotate(image, annotations, classes):
labels = [
classes[class_id]
for class_id
in annotations.class_id
]
bounding_box_annotator = sv.BoxAnnotator()
label_annotator = sv.LabelAnnotator(text_scale=1, text_thickness=2)
annotated_image = image.copy()
annotated_image = bounding_box_annotator.annotate(annotated_image, annotations)
annotated_image = label_annotator.annotate(annotated_image, annotations, labels=labels)
return annotated_image
annotated_images = []
for i in range(GRID_SIZE * GRID_SIZE):
_, image, annotations = ds_train[i]
annotated_image = annotate(image, annotations, ds_train.classes)
annotated_images.append(annotated_image)
grid = sv.create_tiles(
annotated_images,
grid_size=(GRID_SIZE, GRID_SIZE),
single_tile_size=(400, 400),
tile_padding_color=sv.Color.WHITE,
tile_margin_color=sv.Color.WHITE
)
sv.plot_image(grid, size=(10, 10))`
`AttributeError Traceback (most recent call last)
/tmp/ipython-input-1680823999.py in <cell line: 0>()
24 annotated_images.append(annotated_image)
25
---> 26 grid = sv.create_tiles(
27 annotated_images,
28 grid_size=(GRID_SIZE, GRID_SIZE),
AttributeError: module 'supervision' has no attribute 'create_tiles'`
Additional
sv.create_tiles() used to work but now has disappeared.