plant-detector
Model Description
Convolutional Autoencoder for plant anomaly detection
This is a Convolutional Autoencoder (CAE) trained for plant anomaly detection. The model learns to reconstruct plant images and detects anomalies based on reconstruction error.
Model Details
- Model Type: Convolutional Autoencoder
- Framework: PyTorch Lightning
- Task: Anomaly Detection / Plant Classification
- Input: RGB images (224x224)
- Output: Reconstruction + anomaly score
Training Details
- Architecture: Encoder-Decoder with skip connections
- Loss Function: Mean Squared Error (MSE)
- Optimizer: AdamW
- Learning Rate: 0.0001
- Batch Size: 32
- Epochs: N/A
- Dataset Size: N/A images
Performance Metrics
- Validation Loss: N/A
- Threshold: 0.5687
- Mean Reconstruction Error: N/A
- Std Reconstruction Error: N/A
- Anomaly Rate: N/A
Normalization Statistics
The model expects input images to be normalized with:
- Mean: [0.4682, 0.4865, 0.3050]
- Std: [0.2064, 0.1995, 0.1961]
Usage
PyTorch Lightning Checkpoint
from annomallyDet.models.lit_models.lit_cae import LitCAE
# Load the model
model = LitCAE.load_from_checkpoint("plant_anomaly_detector.ckpt")
model.eval()
# Make prediction
reconstruction_error = model.get_reconstruction_error(input_tensor)
is_anomaly = reconstruction_error > 0.5687
Mobile Deployment (TorchScript Lite)
import torch
# Load mobile model
model = torch.jit.load("plant_anomaly_detector.ptl")
reconstruction = model(input_tensor)
# Calculate reconstruction error
error = torch.mean((input_tensor - reconstruction) ** 2)
is_anomaly = error > 0.5687
Flutter Integration
See the included flutter_integration_example.dart
for complete Flutter app integration using flutter_pytorch_lite
.
Files Included
plant_anomaly_detector.ckpt
: PyTorch Lightning checkpointplant_anomaly_detector.ptl
: TorchScript Lite model for mobile deploymentconfig.json
: Model configuration and metadataflutter_integration_example.dart
: Flutter integration examplenormalization_stats.json
: Dataset normalization statistics
Model Architecture
Input (3, 224, 224)
β
Encoder: Conv2d β BatchNorm β LeakyReLU β Dropout
[32, 64, 128, 256] channels
β
Latent Space (128 dimensions)
β
Decoder: ConvTranspose2d β BatchNorm β LeakyReLU β Dropout
[256, 128, 64, 32] channels
β
Output (3, 224, 224)
Anomaly Detection Logic
- Training: Model learns to reconstruct normal plant images
- Inference: Calculate reconstruction error (MSE)
- Decision: If error > threshold β Anomaly (not a plant)
- Confidence: Distance from threshold indicates confidence
Limitations
- Trained specifically on plant images
- Performance depends on similarity to training data
- May struggle with novel plant species not in training set
- Threshold may need adjustment for different use cases
Citation
@misc{plant_anomaly_detector,
title={Plant Anomaly Detection using Convolutional Autoencoder},
author={Your Name},
year={2024},
howpublished={\url{https://huggingface.co/YOUR_USERNAME/plant-detector}},
}
License
[Specify your license here]
- Downloads last month
- 22
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
π
Ask for provider support