Data Science | Machine Learning with Python for Researchers
32.4K subscribers
2.93K photos
102 videos
22 files
3.15K links
ads: @HusseinSheikho

The Data Science and Python channel is for researchers and advanced programmers

Buy ads: https://telega.io/c/dataScienceT
Download Telegram
πŸ€–πŸ§  Thinking with Camera 2.0: A Powerful Multimodal Model for Camera-Centric Understanding and Generation

πŸ—“οΈ 14 Oct 2025
πŸ“š AI News & Trends

In the rapidly evolving field of multimodal AI, bridging gaps between vision, language and geometry is one of the frontier challenges. Traditional vision-language models excel at describing what is in an image β€œa cat on a sofa” β€œa red car on the road” but struggle to reason about how the image was captured: the camera’s ...

#MultimodalAI #CameraCentricUnderstanding #VisionLanguageModels #AIResearch #ComputerVision #GenerativeModels
πŸ’‘ 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 ✨
πŸ’‘ 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 ✨