AI & ML Papers
33.7K subscribers
7.29K photos
581 videos
24 files
8.02K links
Advancing research in Machine Learning – practical insights, tools, and techniques for researchers.

Admin: @HusseinSheikho || @Hussein_Sheikho
Download Telegram
πŸš€ FREE IT Study Kits for 2025 β€” Grab Yours Now!

Just found these zero-cost resources from SPOTOπŸ‘‡
Perfect if you're prepping for #Cisco, #AWS, #PMP, #AI, #Python, #Excel, or #Cybersecurity!
βœ… 100% Free
βœ… No signup traps
βœ… Instantly downloadable

πŸ“˜ IT Certs E-book: https://bit.ly/4fJSoLP
☁️ Cloud & AI Kits: https://bit.ly/3F3lc5B
πŸ“Š Cybersecurity, Python & Excel: https://bit.ly/4mFrA4g
🧠 Skill Test (Free!): https://bit.ly/3PoKH39
Tag a friend & level up together πŸ’ͺ

🌐 Join the IT Study Group: https://chat.whatsapp.com/E3Vkxa19HPO9ZVkWslBO8s
πŸ“² 1-on-1 Exam Help: https://wa.link/k0vy3x
πŸ‘‘Last 24 HOURS to grab Mid-Year Mega Sale prices!Don’t miss Lucky DrawπŸ‘‡
https://bit.ly/43VgcbT
πŸš€ 2025 FREE Study Recourses from SPOTO for y’all β€” Don’t Miss Out!
βœ… 100% Free Downloads
βœ… No signup / spam

πŸ“˜ #Python, Cybersecurity & Excel: https://bit.ly/4lYeVYp
πŸ“Š #Cloud Computing: https://bit.ly/45Rj1gm
☁️ #AI Kits: https://bit.ly/4m4bHTc
πŸ” #CCNA Courses: https://bit.ly/45TL7rm
🧠 Free Online Practice – Test Now: https://bit.ly/41Kurjr

September 8th to 21th, SPOTO launches the Lowest Price Ever on ALL products! πŸ”₯
Amazing Discounts for πŸ“Œ CCNA 200-301 πŸ“Œ CCNP 400-007 and more…
πŸ“² Contact admin to grab them: https://wa.link/uxde01
❀1
πŸ’‘ ViT for Fashion MNIST Classification

This lesson demonstrates how to use a pre-trained Vision Transformer (ViT) to classify an image from the Fashion MNIST dataset. ViT treats an image as a sequence of patches, similar to how language models treat sentences, making it a powerful architecture for computer vision tasks. We will use a model from the Hugging Face Hub that is already fine-tuned for this specific dataset.

from transformers import ViTImageProcessor, ViTForImageClassification
from datasets import load_dataset
import torch

# 1. Load a model fine-tuned on Fashion MNIST and its processor
model_name = "abhishek/autotrain-fashion-mnist-283834433"
processor = ViTImageProcessor.from_pretrained(model_name)
model = ViTForImageClassification.from_pretrained(model_name)

# 2. Load the dataset and get a sample image
dataset = load_dataset("fashion_mnist", split="test")
image = dataset[100]['image'] # Get the 100th image

# 3. Preprocess the image and prepare it for the model
inputs = processor(images=image, return_tensors="pt")

# 4. Perform inference to get the classification logits
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits

# 5. Get the predicted class and its label
predicted_class_idx = logits.argmax(-1).item()
predicted_class = model.config.id2label[predicted_class_idx]

print(f"Image is a: {dataset[100]['label']}")
print(f"Model predicted: {predicted_class}")


Code explanation: This script uses the transformers library to load a ViT model specifically fine-tuned for Fashion MNIST classification. It then loads the dataset, selects a single sample image, and uses the model's processor to convert it into the correct input format. The model performs inference, and the script identifies the most likely class from the output logits, printing the final human-readable prediction.

#Python #MachineLearning #ViT #ComputerVision #HuggingFace

━━━━━━━━━━━━━━━
By: @DataScienceT ✨