This document presents a food recognition system for diabetic patients based on an optimized bag-of-features model. The system extracts dense local features from food images using scale-invariant feature transform on HSV color space. It then builds a visual vocabulary of 10,000 visual words using k-means clustering and classifies the food descriptions with a linear support vector machine classifier. The optimized system achieved a classification accuracy of around 78% on a dataset of over 5,000 food images belonging to 11 classes, demonstrating the feasibility of using a bag-of-features approach for automated food recognition to help with carbohydrate counting for diabetic patients.