--- license: apache-2.0 base_model: google/vit-base-patch16-224-in21k tags: - generated_from_trainer datasets: - beans metrics: - accuracy model-index: - name: vit-base-beans-demo-v5 results: - task: name: Image Classification type: image-classification dataset: name: beans type: beans config: default split: validation args: default metrics: - name: Accuracy type: accuracy value: 1.0 --- # Fine-Tuned ViT for Beans Leaf Disease Classification ## Model Information * **Model Name**: VIT_Beans_Leaf_Disease_Classifier * **Base Model**: Google/ViT-base-patch16-224-in21k * **Task**: Image Classification (Beans Leaf Disease Classification) * **Dataset**: Beans leaf dataset with images of diseased and healthy leaves. ## Problem Statement The goal of this model is to classify leaf images into three categories: ``` { "angular_leaf_spot": 0, "bean_rust": 1, "healthy": 2, } ``` ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6338c06c107c4835a05699f9/3qwVfVNQSt0KHe8t_OCrT.png) ### Training results | Training Loss | Epoch | Step | Validation Loss | Accuracy | |:-------------:|:-----:|:----:|:---------------:|:--------:| | 0.1495 | 1.54 | 100 | 0.0910 | 0.9774 | | 0.0121 | 3.08 | 200 | 0.0155 | 1.0 | ## Framework versions + Transformers 4.33.2 + Pytorch 2.0.1+cu118 + Datasets 2.14.5 + Tokenizers 0.13.3 ## Get Started With The Model: ``` ! pip -q install datasets transformers[torch] ``` ```python from transformers import pipeline from PIL import Image # Use a pipeline as a high-level helper pipe = pipeline("image-classification", model="ayoubkirouane/VIT_Beans_Leaf_Disease_Classifier") # Load the image image_path = "Your image_path " image = Image.open(image_path) # Run inference using the pipeline result = pipe(image) # The result contains the predicted label and the corresponding score predicted_label = result[0]['label'] confidence_score = result[0]['score'] print(f"Predicted Label: {predicted_label}") print(f"Confidence Score: {confidence_score}") ```