The viewer is disabled because this dataset repo requires arbitrary Python code execution. Please consider removing the loading script and relying on automated data support (you can use convert_to_parquet from the datasets library). If this is not possible, please open a discussion for direct help.

YAML Metadata Warning: empty or missing yaml metadata in repo card (https://huggingface.co/docs/hub/datasets-cards)

Code snippet to visualise the position of the box

import matplotlib.image as img
import matplotlib.pyplot as plt
from datasets import load_dataset
from matplotlib.patches import Rectangle

# Load dataset
ds_name = "HuggingFaceM4/FGVC-Aircraft"
ds = load_dataset(ds_name, use_auth_token=True)

# Extract information for the sample we want to show
index = 300
sample = ds["train"][index]
box_coord = sample["bbox"]
xmin = box_coord["xmin"]
ymin = box_coord["ymin"]
xmax = box_coord["xmax"]
ymax = box_coord["ymax"]
img_path = sample["image"].filename

# Create plot
# define Matplotlib figure and axis
fig, ax = plt.subplots()

# plot figure
image = img.imread(img_path)
ax.imshow(image)

# add rectangle to plot
ax.add_patch(
    Rectangle((xmin, ymin), xmax-xmin, ymax - ymin, fill=None)
)

# display plot
plt.show()
Downloads last month
1,659