File size: 2,731 Bytes
80bea10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# MobileNetV3 Model for Plant Classification

## Model Description
This model is a fine-tuned **MobileNetV3Small** trained to classify different types of plants. It was trained using transfer learning on a dataset obtained from Kaggle.

- **Base Model:** MobileNetV3Small (pretrained on ImageNet)
- **Dataset:** [Plants Classification Dataset](https://www.kaggle.com/datasets/marquis03/plants-classification)
- **Accuracy:** 88%
- **Fine-Tuning:** Last 20 layers of MobileNetV3Small were unfrozen for fine-tuning.

## Dataset
The dataset consists of images of various plant species, divided into training and validation sets:
- **Training Images:** Preprocessed with data augmentation (rotation, shifting, zoom, brightness adjustment, etc.)
- **Validation Images:** Rescaled without augmentation

## Model Training
The model was trained using **TensorFlow** and **Keras**, with categorical crossentropy loss and the Adam optimizer. The training process involved:

1. **Data Augmentation** using `ImageDataGenerator`.
2. **Transfer Learning** by leveraging MobileNetV3Small's pretrained weights.
3. **Fine-Tuning** of the last 20 layers.
4. **Learning Rate Scheduling** using `ReduceLROnPlateau`.
5. **Evaluation** using classification reports and a confusion matrix.
6. **Exporting the Model** as a `.tflite` file for mobile deployment.

## Model Performance
- **Training Accuracy:** 88%
- **Validation Accuracy:** 88%
- **Loss Function:** Categorical Crossentropy
- **Optimizer:** Adam (learning rate = 0.0001)

## Usage
To use the model for inference, load it using TensorFlow:

```python
import tensorflow as tf
from tensorflow.keras.models import load_model

# Load the model
model = load_model("mobilenetv3_tanaman.h5")

# Preprocess an input image
import numpy as np
from tensorflow.keras.preprocessing import image

img_path = "path_to_image.jpg"
img = image.load_img(img_path, target_size=(224, 224))
img_array = image.img_to_array(img) / 255.0
img_array = np.expand_dims(img_array, axis=0)

# Make a prediction
predictions = model.predict(img_array)
class_idx = np.argmax(predictions)
print(f"Predicted class: {class_idx}")
```

## Deployment
This model can be deployed for:
- Mobile applications (converted to `.tflite` for TensorFlow Lite compatibility)
- Web-based applications
- Embedded AI systems for plant classification

## License
This model is provided for research and educational purposes. Please ensure to cite the original dataset from Kaggle if used in any publication.

## Citation
If you use this model, please cite:
```
@misc{PlantClassification2024,
  title={MobileNetV3 Model for Plant Classification},
  author={Ade Maulana},
  year={2024},
  url={https://huggingface.co/your-huggingface-repo}
}
```