An Ruopeng, Perez-Cruet Joshua, Wang Junjie
Brown School, Washington University, St Louis, MO, USA.
School of Medicine, Washington University, St Louis, MO, USA.
Nutr Health. 2024 Jun;30(2):301-307. doi: 10.1177/02601060221113928. Epub 2022 Jul 21.
Nuts are nutrient-dense foods that contribute to healthier eating. Food image datasets enable artificial intelligence (AI) powered diet-tracking apps to help people monitor daily eating patterns.
This study aimed to create an image dataset of commonly consumed nut types and use it to build an AI computer vision model to automate nut type classification tasks.
iPhone 11 was used to take photos of 11 nut types-almond, brazil nut, cashew, chestnut, hazelnut, macadamia, peanut, pecan, pine nut, pistachio, and walnut. The dataset contains 2200 images, 200 per nut type. The dataset was randomly split into the training (60% or 1320 images), validation (20% or 440 images), and test sets (20% or 440 images). A neural network model was constructed and trained using transfer learning and other computer vision techniques-data augmentation, mixup, normalization, label smoothing, and learning rate optimization.
The trained neural network model correctly predicted 338 out of 440 images (40 per nut type) in the validation set, achieving 99.55% accuracy. Moreover, the model classified the 440 images in the test set with 100% accuracy.
This study built a nut image dataset and used it to train a neural network model to classify images by nut type. The model achieved near-perfect accuracy on the validation and test sets, demonstrating the feasibility of automating nut type classification using smartphone photos. Being made open-source, the dataset and model can assist the development of diet-tracking apps that facilitate users' adoption and adherence to a healthy diet.
坚果是营养丰富的食物,有助于实现更健康的饮食。食物图像数据集使人工智能驱动的饮食追踪应用程序能够帮助人们监测日常饮食模式。
本研究旨在创建一个常见食用坚果类型的图像数据集,并使用它构建一个人工智能计算机视觉模型,以自动化坚果类型分类任务。
使用iPhone 11拍摄11种坚果的照片——杏仁、巴西坚果、腰果、栗子、榛子、澳洲坚果、花生、山核桃、松子、开心果和核桃。该数据集包含2200张图像,每种坚果类型200张。数据集被随机分为训练集(60%或1320张图像)、验证集(20%或440张图像)和测试集(20%或440张图像)。使用迁移学习和其他计算机视觉技术——数据增强、混合、归一化、标签平滑和学习率优化来构建和训练神经网络模型。
训练后的神经网络模型在验证集中正确预测了440张图像中的338张(每种坚果类型40张),准确率达到99.55%。此外,该模型对测试集中的440张图像分类准确率为100%。
本研究构建了一个坚果图像数据集,并使用它训练了一个神经网络模型,以按坚果类型对图像进行分类。该模型在验证集和测试集上达到了近乎完美的准确率,证明了使用智能手机照片自动化坚果类型分类的可行性。该数据集和模型开源后,可协助开发饮食追踪应用程序,促进用户采用和坚持健康饮食。