{ "cells": [ { "cell_type": "markdown", "metadata": { "id": "c3hpiPPEqmf6" }, "source": [ "##### Copyright 2024 Google LLC." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "cellView": "form", "id": "bVm-2hW9z9HR" }, "outputs": [], "source": [ "# @title Licensed under the Apache License, Version 2.0 (the \"License\");\n", "# you may not use this file except in compliance with the License.\n", "# You may obtain a copy of the License at\n", "#\n", "# https://www.apache.org/licenses/LICENSE-2.0\n", "#\n", "# Unless required by applicable law or agreed to in writing, software\n", "# distributed under the License is distributed on an \"AS IS\" BASIS,\n", "# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n", "# See the License for the specific language governing permissions and\n", "# limitations under the License." ] }, { "cell_type": "markdown", "metadata": { "id": "u71STQRgnQ3a" }, "source": [ "# Fine-tune PaliGemma for Image Description with Custom Dataset" ] }, { "cell_type": "markdown", "metadata": { "id": "wR53lePHuiP-" }, "source": [ "This notebook guides you through the process of fine-tuning [PaliGemma](https://ai.google.dev/gemma/docs/paligemma), a powerful vision-language model, for bird description using [JAX](https://jax.readthedocs.io/en/latest/installation.html). We will leverage a curated subset of a bird species dataset and enrich it with descriptive text for each bird. The resulting dataset, comprising 3,692 image-description pairs, will be used to fine-tune PaliGemma, enabling it to generate accurate and detailed descriptions of bird images.\n", "\n", "
\n", " Run in Google Colab\n", " | \n", "
\n", " | class id | \n", "filepaths | \n", "labels | \n", "data set | \n", "scientific name | \n", "bird_description | \n", "
---|---|---|---|---|---|---|
0 | \n", "0.0 | \n", "ABBOTTS BABBLER/001.jpg | \n", "ABBOTTS BABBLER | \n", "train | \n", "MALACOCINCLA ABBOTTI | \n", "Abbott's Babbler: Look for this small insectiv... | \n", "
1 | \n", "0.0 | \n", "ABBOTTS BABBLER/007.jpg | \n", "ABBOTTS BABBLER | \n", "train | \n", "MALACOCINCLA ABBOTTI | \n", "Abbott's Babbler: Look for this small insectiv... | \n", "
2 | \n", "0.0 | \n", "ABBOTTS BABBLER/008.jpg | \n", "ABBOTTS BABBLER | \n", "train | \n", "MALACOCINCLA ABBOTTI | \n", "Abbott's Babbler: Look for this small insectiv... | \n", "
3 | \n", "0.0 | \n", "ABBOTTS BABBLER/009.jpg | \n", "ABBOTTS BABBLER | \n", "train | \n", "MALACOCINCLA ABBOTTI | \n", "Abbott's Babbler: Look for this small insectiv... | \n", "
4 | \n", "0.0 | \n", "ABBOTTS BABBLER/002.jpg | \n", "ABBOTTS BABBLER | \n", "train | \n", "MALACOCINCLA ABBOTTI | \n", "Abbott's Babbler: Look for this small insectiv... | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
3917 | \n", "524.0 | \n", "BLACK BREASTED PUFFBIRD/3.jpg | \n", "BLACK BREASTED PUFFBIRD | \n", "valid | \n", "NOTHARCHUS PECTORALIS | \n", "Black-breasted Puffbird: Observe the medium-si... | \n", "
3918 | \n", "524.0 | \n", "BLACK BREASTED PUFFBIRD/4.jpg | \n", "BLACK BREASTED PUFFBIRD | \n", "valid | \n", "NOTHARCHUS PECTORALIS | \n", "Black-breasted Puffbird: Observe the medium-si... | \n", "
3919 | \n", "524.0 | \n", "BLACK BREASTED PUFFBIRD/1.jpg | \n", "BLACK BREASTED PUFFBIRD | \n", "valid | \n", "NOTHARCHUS PECTORALIS | \n", "Black-breasted Puffbird: Observe the medium-si... | \n", "
3920 | \n", "524.0 | \n", "BLACK BREASTED PUFFBIRD/2.jpg | \n", "BLACK BREASTED PUFFBIRD | \n", "valid | \n", "NOTHARCHUS PECTORALIS | \n", "Black-breasted Puffbird: Observe the medium-si... | \n", "
3921 | \n", "524.0 | \n", "BLACK BREASTED PUFFBIRD/5.jpg | \n", "BLACK BREASTED PUFFBIRD | \n", "valid | \n", "NOTHARCHUS PECTORALIS | \n", "Black-breasted Puffbird: Observe the medium-si... | \n", "
3922 rows Γ 6 columns
\n", "yellow-billed chough: observe this medium-sized crow easily recognizable by its sleek black feathers and contrasting long yellow bill, a common sight in the mountainous regions of europe and asia, noted for its acrobatic flight and yellow bill.
\n", "american bittern: notice this medium-sized heron, a master of camouflage, blending seamlessly into the marshes of north and central america, distinguished by its cryptic plumage and elongated neck.
\n", "american pipit: look for this small, ground-dwelling songbird with streaked brown plumage and long tail, filling the air with melodic tunes across the grasslands of north america, europe, and asia.
\n", "alexandrine parakeet: notice this medium-sized parrot bursting with a rainbow of colors, a vibrant resident of the forests and woodlands of south and southeast asia, distinguished by its large size and distinctive red beak.
\n", "crowned crane: observe this epitome of elegance with a golden crown, calling the wetlands and grasslands of sub-saharan africa home, distinguished by its tall stature, long legs, and regal posture.
\n", "african pygmy goose: look for this small freshwater goose with dark brown feathers and contrasting white markings, gracing the lakes and rivers of sub-saharan africa, noted for its petite size and distinctive facial markings.
\n", "american bittern: notice this medium-sized heron, a master of camouflage, blending seamlessly into the marshes of north and central america, distinguished by its cryptic plumage and elongated neck.
\n", "african pygmy goose: look for this small freshwater goose with dark brown feathers and contrasting white markings, gracing the lakes and rivers of sub-saharan africa, noted for its petite size and distinctive facial markings.
\n", "{html.escape(description)}
\n", "