Downloads · 30 days
5
8% of all-time downloads
lrzjason/noise-classifier
noise-classifier is a image classification model from lrzjason. Use it when you need a label for an image. It is set up for transformers. The card lists the license as apache-2.0.
An vit classifier for handling noise image like this
Downloads · 30 days
5
8% of all-time downloads
All-time downloads
65
Public
Parameters
85.8M
343 MB on disk
Likes
2
Public
Click a slice to open those files.
.safetensors343 MB · 100%
From the Hugging Face model README
An vit classifier for handling noise image like this

It has limitation inbetween clear and noise
from datasets import load_dataset
from PIL import Image
from transformers import ViTImageProcessor, ViTForImageClassification, TrainingArguments, Trainer
import torch
import numpy as np
from datasets import load_metric
import os
import shutil
model_name_or_path = 'lrzjason/noise-classifier'
image_processor = ViTImageProcessor.from_pretrained(model_name_or_path)
model = ViTForImageClassification.from_pretrained(model_name_or_path)
input_dir = ''
file = 'b5b457f4-5b52-4d68-be1b-9a2f557465f6.jpg'
image = Image.open(os.path.join(input_dir, file))
inputs = image_processor(image, return_tensors="pt")
with torch.no_grad():
logits = model(**inputs).logits
# model predicts one of the 1000 ImageNet classes
predicted_label = logits.argmax(-1).item()