Downloads · 30 days
35
1% of all-time downloads
Ganesh-KSV/vit-face-recognition-1
vit-face-recognition-1 is a image classification model from Ganesh-KSV. Use it when you need a label for an image. It is set up for transformers. The card lists the license as other.
Model type: Vision Transformer (ViT) for Image Classification
Downloads · 30 days
35
1% of all-time downloads
All-time downloads
3.4K
Public
Parameters
5.5M
22.1 MB on disk
Likes
4
Public
Click a slice to open those files.
.safetensors22.1 MB · 100%
From the Hugging Face model README
Model type: Vision Transformer (ViT) for Image Classification
Finetuned from model : google/vit-base-patch16-384
Image classification based on facial features from the dataset.Link:https://www.kaggle.com/datasets/bhaveshmittal/celebrity-face-recognition-dataset
Fine-tuning for other image classification tasks.
Transfer learning for related vision tasks.
Tasks unrelated to image classification.
Sensitive applications without proper evaluation of biases and limitations.
Potential biases in the training dataset affecting model predictions.
Limitations in generalizability to different populations or image conditions not represented in the training data.
Risks associated with misclassification in critical applications.
Users (both direct and downstream) should be made aware of the risks, biases, and limitations of the model. It's recommended to evaluate the model's performance on the specific data before deploying it in a production environment
import torch
from transformers import ViTForImageClassification, ViTImageProcessor
model = ViTForImageClassification.from_pretrained("Ganesh-KSV/face-recognition-version1")
processor = ViTImageProcessor.from_pretrained("Ganesh-KSV/face-recognition-version1")
def predict(image):
inputs = processor(images=image, return_tensors="pt")
outputs = model(**inputs)
logits = outputs.logits
predictions = torch.argmax(logits, dim=-1)
return predictions
Training Procedure:
Preprocessing :
Images were resized, augmented (rotation, color jitter, etc.), and normalized.
Training Hyperparameters:
Optimizer: Adam with learning rate 2e-5 and weight decay 1e-2
Scheduler: StepLR with step size 2 and gamma 0.5
Loss Function: CrossEntropyLoss
Epochs: 40
Batch Size: 4
Validation split of the VGGFace dataset.
Performance evaluated based on loss and accuracy on the validation set.
Loss and accuracy metrics for each epoch.
Training and validation loss and accuracy plotted for 40 epochs.
Confusion matrix generated for the final validation results.


Model performance examined through loss, accuracy plots, and confusion matrix.
ViT: Vision Transformer
CrossEntropyLoss: A loss function used for classification tasks.
Adam: An optimization algorithm.
StepLR: Learning rate scheduler that decays the learning rate by a factor every few epochs.