Downloads · 30 days
6
1% of all-time downloads
hula07/cifar
cifar is a image classification model from hula07. Use it when you need a label for an image. It is set up for transformers.
This repository contains a Python script for training an image classification model using the Vision Transformer (ViT) architecture. We use the transformers and datasets libraries from Hugging Face along with PyTorch…
Downloads · 30 days
6
1% of all-time downloads
All-time downloads
859
Public
Repo size
1 GB
Likes
0
Public
Click a slice to open those files.
.bin343 MB · 100%
From the Hugging Face model README
This repository contains a Python script for training an image classification model using the Vision Transformer (ViT) architecture. We use the transformers and datasets libraries from Hugging Face along with PyTorch and TensorFlow for the implementation.
convert_to_tf_tensor(image: Image):
This function converts an image to a Tensorflow tensor with a size of 224x224 and three color channels.
preprocess(batch):
Preprocesses the images in a batch, using the feature extractor to convert them to pixel values. It also adds the labels to the batch.
collate_fn(batch):
This function prepares the batch for training or evaluation. It stacks the pixel values and labels.
compute_metrics(p):
Computes the metrics (accuracy) for the predictions.