Downloads · 30 days
0
mawiie/foodseg103-deeplabv3plus-resnet50
foodseg103-deeplabv3plus-resnet50 is a machine learning model from mawiie. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
A semantic segmentation model trained on the FoodSeg103 dataset for food image segmentation.
Downloads · 30 days
0
Access
Public
Updated Jan 21, 2026
Repo size
107 MB
Likes
0
Public
Click a slice to open those files.
.pth107 MB · 100%
From the Hugging Face model README
A semantic segmentation model trained on the FoodSeg103 dataset for food image segmentation.



import torch
import segmentation_models_pytorch as smp
from PIL import Image
import torchvision.transforms as T
# Load model
model = smp.DeepLabV3Plus(
encoder_name="resnet50",
encoder_weights=None,
in_channels=3,
classes=104,
)
model.load_state_dict(torch.load("best_model.pth", map_location="cpu"))
model.eval()
# Preprocess image
transform = T.Compose([
T.Resize((256, 256)),
T.ToTensor(),
T.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
])
image = Image.open("your_food_image.jpg").convert("RGB")
input_tensor = transform(image).unsqueeze(0)
# Inference
with torch.no_grad():
output = model(input_tensor)
pred_mask = output.argmax(dim=1).squeeze().numpy()
Trained on FoodSeg103 - a large-scale benchmark for food image segmentation with 103 food categories.
MIT