Edit model card

Fatima 2023 Application

This project is about an image classification task of artificial and natural classes.

Setup:

pip install -r requirements.txt

Inference:

from torchvision import transforms
from PIL import Image
import torch


inference_transform = transforms.Compose([
    transforms.Resize(128),
    transforms.ToTensor(),
    transforms.Normalize(mean=[0.4914, 0.4822, 0.4465],
                         std=[0.2023, 0.1994, 0.2010]),
])

#load image and model
img_example = Image.open("image_example.png").convert('RGB')
print("image loaded!")
model_loaded = torch.load("fatima_challenge_model_exp3.pt")
model_loaded.eval()
print("model loaded!")


img_example_transformed = inference_transform(img_example)
out = model_loaded(img_example_transformed.to(torch.device("cuda:0")).unsqueeze(0)) # Generate predictions
_, outs = torch.max(out, 1)
prediction = "natural" if int(outs.cpu().numpy())==0 else "artificial"
print("prediction = ",prediction)
Downloads last month
0
Inference API
Drag image file here or click to browse from your device
Unable to determine this model's library. Check the docs .

Dataset used to train CristianLazoQuispe/AIorNot-model