--- language: id license: mit tags: - image-classification - plant-identification - pytorch - cnn - vision-transformer - efficientnet - vit datasets: - gumi-banten metrics: - accuracy model-index: - name: CNN + ViT Hybrid — Gumi Banten results: - task: type: image-classification metrics: - type: accuracy value: 0.9012 --- # 🌿 Gumi Banten Plant Identification — CNN + ViT Hybrid Model identifikasi tanaman Gumi Banten menggunakan arsitektur hybrid **CNN (EfficientNet-B4) + Vision Transformer (ViT)**. ## 📊 Performa Model | Metrik | Nilai | |--------|-------| | **Test Accuracy** | 0.9012 (90.12%) | | **Best Val Accuracy** | 0.9202 (92.02%) | | **Jumlah Kelas** | 10 | ## 🏗️ Arsitektur - **CNN Backbone**: EfficientNet-B4 (feature extractor) - **ViT Head**: 6x Transformer Encoder Block, embed_dim=384 - **Input Size**: 224×224 px - **Framework**: PyTorch (weights disimpan sebagai HDF5/.h5) ## 📦 File dalam Repo | File | Deskripsi | |------|-----------| | `gumi_banten_cnn_vit.h5` | Model weights dalam format HDF5 | | `best_model.pth` | Checkpoint PyTorch lengkap | | `config.json` | Konfigurasi model | | `class_names.txt` | Daftar nama kelas | ## 🚀 Cara Menggunakan ### Load dari .pth (PyTorch — Direkomendasikan) ```python import torch from huggingface_hub import hf_hub_download pth_path = hf_hub_download(repo_id="Wisnu1354/Gumi-Banten", filename="best_model.pth") ckpt = torch.load(pth_path, map_location='cpu') model.load_state_dict(ckpt['model_state']) model.eval() ``` ### Load dari .h5 ```python import h5py, torch, numpy as np from huggingface_hub import hf_hub_download def load_from_h5(h5_path, model_class, cfg): with h5py.File(h5_path, 'r') as hf: class_names = list(hf['metadata/class_names'][:]) state_dict = {} def _load(name, obj): if isinstance(obj, h5py.Dataset): state_dict[name.replace('/', '.')] = torch.tensor(obj[()]) hf['model_weights'].visititems(_load) model = model_class(cfg) model.load_state_dict(state_dict) model.eval() return model, class_names h5_path = hf_hub_download(repo_id="Wisnu1354/Gumi-Banten", filename="gumi_banten_cnn_vit.h5") model, class_names = load_from_h5(h5_path, CNNViTHybrid, CFG) ``` ## 📋 Kelas yang Didukung - Daun Ancak - Daun Base - Daun Bila - Daun Bingin - Daun Dapdap - Daun Intaran - Daun Kayu Tulak - Daun Kelor - Daun Nagasari - Daun Pucuk Rejuna ## 🧑‍💻 Training Dilatih di Google Colab menggunakan GPU A100/V100/T4. --- *Dibuat oleh: Gumi Banten Research | 2026-04-27*