Downloads · 30 days
25
1% of all-time downloads
RishiDarkDevil/ai-image-det-resnet152
ai-image-det-resnet152 is a feature extraction model from RishiDarkDevil. Use it when you need embeddings to search or compare text. It is set up for transformers. The card lists the license as mit.
Follow the following code example to use this model.
Downloads · 30 days
25
1% of all-time downloads
All-time downloads
4.7K
Public
Repo size
467 MB
Likes
1
Public
Click a slice to open those files.
.bin233 MB · 100%
From the Hugging Face model README
Follow the following code example to use this model.
# import libraries
from transformers import AutoModel, AutoModelForImageClassification
import torch
from datasets import load_dataset
# load dataset
dataset = load_dataset("competitions/aiornot")
# list of images
images = dataset["test"][10:20]["image"]
# load models
feature_extractor = AutoModel.from_pretrained(
"RishiDarkDevil/ai-image-det-resnet152", trust_remote_code=True).to('cuda')
classifier = AutoModelForImageClassification.from_pretrained(
"RishiDarkDevil/ai-image-det-resnet152", trust_remote_code=True).to('cuda')
# extract features from images
inputs = feature_extractor(images)
# classification using extracted features
with torch.no_grad():
logits = classifier(inputs)['logits']
# model predicts one of the 2 classes
predicted_label = logits.argmax(-1)
# predictions
print(predicted_label) # 0 is Not AI, 1 is AI
Backbone for Feature Extraction: ResNet152