CBAM: Convolutional Block Attention Module
Paper โข 1807.06521 โข Published
Food image classifier trained with food_recognition. efficientnet_b4_cbam is a torchvision backbone with a CBAM block (channel then spatial attention) between the features and the classification head.
| Metric | Value |
|---|---|
| Validation accuracy | 94.85% |
| Macro F1 | 0.9481 |
| Classes | 11 |
| Input resolution | 300px |
| Checkpoint epoch | 30 |
| Training wall clock | 49 min |
| Hardest / easiest class | 02 (F1 0.855) / 06 (F1 1.000) |
These figures come from this run's own metrics.json, computed over the full validation split. The repository re-scores every published checkpoint through a separate evaluation path and requires the two to agree to six decimal places.
pip install git+https://github.com/linhongyu510/food_recognition.git
from huggingface_hub import hf_hub_download
from food_recognition import load_predictor
checkpoint = hf_hub_download("hylin16/food-recognition-food11-effnet-b4-cbam-300", "best.pt")
predictor = load_predictor(checkpoint)
prediction = predictor.predict("photo.jpg", topk=3)
print(prediction.label, prediction.topk)
The checkpoint embeds its architecture, input resolution and class names, so nothing needs to be specified again at load time.
To see which pixels drove a prediction:
food-recognition-gradcam --checkpoint best.pt --input photo.jpg --side-by-side
efficientnet_b4_cbambaf1b5e