Upload modele classification poubelles
Browse files- README.md +63 -0
- training_args.bin +3 -0
README.md
CHANGED
|
@@ -1,3 +1,66 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
+
base_model: google/vit-base-patch16-224
|
| 4 |
+
tags:
|
| 5 |
+
- image-classification
|
| 6 |
+
- vision-transformer
|
| 7 |
+
- trash-classification
|
| 8 |
+
- waste-management
|
| 9 |
+
- pytorch
|
| 10 |
+
datasets:
|
| 11 |
+
- custom
|
| 12 |
+
language:
|
| 13 |
+
- en
|
| 14 |
+
pipeline_tag: image-classification
|
| 15 |
---
|
| 16 |
+
|
| 17 |
+
# Modèle de Classification de Propreté des Poubelles
|
| 18 |
+
|
| 19 |
+
Ce modèle utilise Vision Transformer (ViT) pour classifier les images de poubelles en deux catégories:
|
| 20 |
+
- **Clean** (Propre)
|
| 21 |
+
- **Dirty** (Sale)
|
| 22 |
+
|
| 23 |
+
## Modèle de base
|
| 24 |
+
- **Architecture**: Vision Transformer (ViT)
|
| 25 |
+
- **Modèle de base**: google/vit-base-patch16-224
|
| 26 |
+
- **Type**: Classification binaire d'images
|
| 27 |
+
- **Taille d'entrée**: 224x224 pixels
|
| 28 |
+
|
| 29 |
+
## Classes
|
| 30 |
+
- `0`: Clean (Poubelle propre)
|
| 31 |
+
- `1`: Dirty (Poubelle sale)
|
| 32 |
+
|
| 33 |
+
## Utilisation
|
| 34 |
+
|
| 35 |
+
```python
|
| 36 |
+
from transformers import ViTImageProcessor, ViTForImageClassification
|
| 37 |
+
from PIL import Image
|
| 38 |
+
import torch
|
| 39 |
+
|
| 40 |
+
# Charger le modèle et le processeur
|
| 41 |
+
processor = ViTImageProcessor.from_pretrained('JeanPaulLePape/MasterCAMPDataetIAModelGoogleTrained')
|
| 42 |
+
model = ViTForImageClassification.from_pretrained('JeanPaulLePape/MasterCAMPDataetIAModelGoogleTrained')
|
| 43 |
+
|
| 44 |
+
# Fonction de prédiction
|
| 45 |
+
def predict_trash_cleanliness(image_path):
|
| 46 |
+
image = Image.open(image_path).convert('RGB')
|
| 47 |
+
inputs = processor(image, return_tensors="pt")
|
| 48 |
+
|
| 49 |
+
with torch.no_grad():
|
| 50 |
+
outputs = model(**inputs)
|
| 51 |
+
predicted_class = torch.argmax(outputs.logits, dim=1).item()
|
| 52 |
+
confidence = torch.softmax(outputs.logits, dim=1).max().item()
|
| 53 |
+
|
| 54 |
+
label = "Clean" if predicted_class == 0 else "Dirty"
|
| 55 |
+
return label, confidence
|
| 56 |
+
|
| 57 |
+
# Exemple d'utilisation
|
| 58 |
+
label, confidence = predict_trash_cleanliness("path/to/your/image.jpg")
|
| 59 |
+
print(f"Prédiction: {label} (Confiance: {confidence:.2f})")
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
## Entraînement
|
| 63 |
+
- **Framework**: Transformers + PyTorch
|
| 64 |
+
- **Optimiseur**: AdamW
|
| 65 |
+
- **Précision**: Mixed precision (FP16)
|
| 66 |
+
- **Métriques**: Accuracy
|
training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d2a10f980f9487f0b2039b462a98053a6992497bdbe715d34a74d38cb7f282d8
|
| 3 |
+
size 5304
|