НачатьНачать бесплатно

CV fine-tuning: dataset prep

In this exercise, you will prepare the Stanford Cars dataset for training. This will involve using the datasets library to split the dataset and applying the preprocessing transformations. The dataset consists of 8k labeled images of 196 car models:

an example car from the dataset

The dataset has been loaded as dataset. The transformations have been defined for you as transforms, and consist of renormalization and type conversion.

Это упражнение является частью курса

Multi-Modal Models with Hugging Face

Посмотреть курс

Инструкции к упражнению

  • Create an 80/20 train/test split from dataset using the .train_test_split() method.
  • Apply the transformations (transforms) to data_splits.
  • Plot the augmented image from the first set of pixel values in dataset_transformed.

Интерактивное практическое упражнение

Попробуйте выполнить это упражнение, дополнив этот пример кода.

# Create a train/test split within the HF dataset
data_splits = ____(test_size=____, seed=42)

# Apply the transformations
dataset_transformed = ____

# Plot the transformed image
plt.imshow(dataset_transformed["train"][0]["____"].permute(1, 2, 0))
plt.show()
Редактировать и запускать код