|
Download README.md from HuggingFaceM4/Caltech-101: direct link, hf CLI and curl.
- Browser
- Download file 969 Bytes
-
https://huggingface.co/datasets/HuggingFaceM4/Caltech-101/resolve/main/README.md
- Command line
-
hf download hf://datasets/HuggingFaceM4/Caltech-101/README.md
-
curl -L -o README.md https://huggingface.co/datasets/HuggingFaceM4/Caltech-101/resolve/main/README.md
969 Bytes
| license: cc-by-4.0 | |
| ## Code snippet to visualise the position of the box | |
| ```python | |
| import matplotlib.image as img | |
| import matplotlib.pyplot as plt | |
| from datasets import load_dataset | |
| from matplotlib.patches import Rectangle | |
| # Load dataset | |
| ds_name = "SaulLu/Caltech-101" | |
| ds_config = "without_background_category" | |
| ds_without = load_dataset(ds_name, ds_config, use_auth_token=True) | |
| # Extract information for the sample we want to show | |
| index = 100 | |
| sample = ds_without["train"][index] | |
| box_coord = sample["annotation"]["box_coord"][0] | |
| 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((box_coord[2], box_coord[0]), box_coord[3] - box_coord[2], box_coord[1] - box_coord[0], fill=None) | |
| ) | |
| # display plot | |
| plt.show() | |
| ``` | |
| Result: | |
|  |