docs: add contents to README.md
Browse files
README.md
CHANGED
@@ -1,9 +1,107 @@
|
|
1 |
---
|
2 |
base_model:
|
3 |
-
- google/vit-base-patch16-224-in21k
|
4 |
library_name: transformers
|
5 |
tags:
|
6 |
-
- image-classification
|
7 |
-
- vision-transformer
|
8 |
-
- just-for-fun
|
9 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
base_model:
|
3 |
+
- google/vit-base-patch16-224-in21k
|
4 |
library_name: transformers
|
5 |
tags:
|
6 |
+
- image-classification
|
7 |
+
- vision-transformer
|
8 |
+
- just-for-fun
|
9 |
+
---
|
10 |
+
|
11 |
+
# MaxVision: Max vs. Not Max Classifier
|
12 |
+
|
13 |
+
## Model Overview
|
14 |
+
|
15 |
+
**MaxVision** is a fun, hobby AI vision classifier designed to distinguish between images of Max, a black and white
|
16 |
+
sprocker spaniel, and all other images. The model has been trained using personal photos of Max and general images of
|
17 |
+
other dogs and non-dog subjects to improve its classification accuracy. It is intended purely for personal and
|
18 |
+
experimental use.
|
19 |
+
|
20 |
+
## Model Details
|
21 |
+
|
22 |
+
- **Developed by:** Patrick Skillen
|
23 |
+
- **Use Case:** Identifying whether an image contains Max
|
24 |
+
- **Architecture:** Based on a fine-tuned vision transformer (ViT)
|
25 |
+
- **Training Dataset:** Curated personal dataset of Max and various non-Max images
|
26 |
+
- **Framework:** PyTorch with Hugging Face Transformers
|
27 |
+
- **Training Platform:** Google Colab
|
28 |
+
- **Labels:**
|
29 |
+
- `0`: Max
|
30 |
+
- `1`: Not Max
|
31 |
+
|
32 |
+
## Intended Use
|
33 |
+
|
34 |
+
This model is built as a fun, personal experiment in AI/ML and image classification. It is not intended for commercial
|
35 |
+
applications, biometric identification, or general dog breed classification.
|
36 |
+
|
37 |
+
## Limitations & Biases
|
38 |
+
|
39 |
+
- The model is heavily biased toward distinguishing Max from non-Max images and is not robust for identifying specific
|
40 |
+
breeds or other dogs.
|
41 |
+
- Performance may degrade on images with low resolution, extreme lighting conditions, or unusual poses.
|
42 |
+
- Limited dataset size and personal image selection may affect generalizability.
|
43 |
+
|
44 |
+
## How to Use
|
45 |
+
|
46 |
+
Try it in the HF Space at https://huggingface.co/spaces/paddeh/is-it-max
|
47 |
+
|
48 |
+
To use the model, you can run inference using the Hugging Face `transformers` or `timm` library, depending on the model
|
49 |
+
backbone. Below is a sample inference script:
|
50 |
+
|
51 |
+
```python
|
52 |
+
from transformers import pipeline
|
53 |
+
|
54 |
+
classifier = pipeline("image-classification", model="paddeh/is-it-max")
|
55 |
+
|
56 |
+
result = classifier("path/to/image.jpg")
|
57 |
+
print("Max" if prediction.item() == 0 else "Not Max")
|
58 |
+
```
|
59 |
+
|
60 |
+
Alternatively, with `torchvision`:
|
61 |
+
|
62 |
+
```python
|
63 |
+
import torch
|
64 |
+
from torchvision import transforms
|
65 |
+
from transformers import ViTForImageClassification, ViTImageProcessor
|
66 |
+
from PIL import Image
|
67 |
+
|
68 |
+
model = ViTForImageClassification.from_pretrained('model.safetensors')
|
69 |
+
model.eval()
|
70 |
+
processor = ViTImageProcessor.from_pretrained(model_path)
|
71 |
+
|
72 |
+
transform = transforms.Compose([
|
73 |
+
transforms.Resize((224, 224)),
|
74 |
+
transforms.ToTensor(),
|
75 |
+
transforms.Normalize(mean=feature_extractor.image_mean, std=feature_extractor.image_std),
|
76 |
+
])
|
77 |
+
|
78 |
+
image = Image.open("path/to/image.jpg")
|
79 |
+
image = transform(image).unsqueeze(0)
|
80 |
+
|
81 |
+
with torch.no_grad():
|
82 |
+
output = model(image)
|
83 |
+
|
84 |
+
prediction = torch.argmax(output, dim=1)
|
85 |
+
print("Max" if prediction.item() == 0 else "Not Max")
|
86 |
+
```
|
87 |
+
|
88 |
+
## Model Performance
|
89 |
+
|
90 |
+
As this is a personal hobby project, there is no formal benchmark, but the model has been tested informally using
|
91 |
+
validation images from Max’s personal collection and various other dog breeds.
|
92 |
+
|
93 |
+
## Ethical Considerations
|
94 |
+
|
95 |
+
Since this model is built for personal use, there are no significant ethical concerns. However, users should be mindful
|
96 |
+
of data privacy and not use the model for unauthorized biometric identification of pets or people.
|
97 |
+
|
98 |
+
## Future Improvements
|
99 |
+
|
100 |
+
- Expand the dataset with more diverse images of Max in different lighting conditions and settings.
|
101 |
+
- Improve augmentation techniques to enhance robustness.
|
102 |
+
- Fine-tune using more advanced architectures like CLIP or Swin Transformer for better accuracy.
|
103 |
+
|
104 |
+
---
|
105 |
+
|
106 |
+
**Disclaimer:** This model is intended for personal and educational use only. It is not designed for commercial
|
107 |
+
applications or general-purpose image recognition.
|