File size: 1,237 Bytes
d942758
 
9ecb0be
 
 
 
 
 
 
 
 
d942758
9ecb0be
 
 
c99dd69
9ecb0be
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d4abdfe
 
 
 
 
 
5d8e0fe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
license: mit
datasets:
- competitions/aiornot
language:
- en
metrics:
- accuracy
tags:
- classification
- computer vision
---

## Usage:
Follow the following code example to use this model.
```python
# 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**

### Performance
- Trained MLP Fine-tuning layers for 150 epochs.
- Accuracy: 0.9250 on validation data (~5% of the training data).