food image recognition by deep learning - nvidia · food image recognition •could be very...

41
Food Image Recognition by Deep Learning Assoc. Prof. Steven HOI School of Information Systems Singapore Management University

Upload: others

Post on 02-Aug-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Food Image Recognition by Deep Learning

Assoc. Prof. Steven HOI

School of Information SystemsSingapore Management University

Page 2: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

National Day Rally 2017: Singapore's War on Diabetes

www.moh.gov.sg/budget2016

“Four simple ways to fight diabetes: Go for regular medical check-ups; Exercise more; Watch your diet; and Cut down on soft drinks.”

- PM Lee Hsien Loong

Page 3: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Traditional Food Journal

https://www.womenshealthmag.com/sites/womenshealthmag.com/files/images/food-journal-1_0.jpg

Tedious

Non-efficient

Non-effective

Page 4: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Smart Food Logging

Healthy 365

Powered by

Page 5: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Roadmap

CasesResearchApproachProblem

Page 6: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Food Image Recognition

• Visual Recognition

Laksa?

Machine Learning

Page 7: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Food Image Recognition

• Could be very challenging…

Singapore Tea or Teh

•Teh, tea with milk and sugar

•Teh-C, tea with evaporated milk

•Teh-C-kosong, tea with evaporated milk and no sugar

•Teh-O, tea with sugar only

•Teh-O-kosong, plain tea without milk or sugar

•Teh tarik, the Malay tea

•Teh-halia, tea with ginger water

•Teh-bing, tea with ice, aka Teh-ice

•Teh-siu-dai, tea with less sugar

•Teh-gah-dai, tea with extra sweetened milk

……

http://supermerlion.com/wp-content/uploads/2010/04/madnesskopiteh.jpg

Page 8: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Food Name Hierarchy

Teh O

……

Teh O siu dai

Teh O kosong

Teh O

Tea, no milkGreen tea

Green tea ( no sugar)

Iced lemon tea

Green tea

Iced lemon tea

Food Item Visual Food Food Category

……

……

Page 9: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Roadmap

CasesResearchApproachProblem

Page 10: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Visual Recognition

• Classical Computer Vision Pipeline

• Deep Learning Approach

FeatureExtraction

Trainable Classifier

(ML)

LaksaMee siamMee Goreng

FeatureExtraction

Trainable Classifier

(ML)

LaksaMee siamMee Goreng

Deep NN Deep NN...Deep Learning

Page 11: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Deep Convolutional Neural Networks (CNN)

• Convolutional Neural Networks (CNN)

Photos taken form https://www.mathworks.com/discovery/convolutional-neural-network.html

Low-level Mid-level High-level

LeNet [LeCun et a. 1998]

Page 12: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Deep CNN for Visual Recognition

• Revolution of Depth• From AlexNet (8-layers) in 2012

[ Krizhevsky et al. 2012 ]

Page 13: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Why Deep Learning?

13

Deep Learning

Small data Big dataData Size

Accuracy

Traditional Learning

ProductData

Machine Learning

HPC(GPU)

Page 14: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

GPU for High Performance Computing

• Deep Learning on GPU Clusters

• DGX-1: NVIDIA Pascal™-powered Tesla® P100

• Performance equal to 250 conventional servers.

Singapore 1st DGX-1 Deep Learning Supercomputer (with P100 GPUs)

NVIDIA DGX-1AI Supercomputer

Page 15: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

SG-FOOD

Page 16: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

SGFOOD Data Statistics

SGFood724 Dataset Training Validation Test

# total images 361,676 7,240 36,200

# Image per class ~500 10 50

Histogram of #visual foods (724 visual food classes)

#Food Items: 1038 #Visual Food: 724 #Food Category: 158

Page 17: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

FoodAI: Open API Services

http://www.foodai.org

Page 18: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

FoodAI System Architecture

API Service

MODELINFERENCE

ENGINE

DATABASEANNOTATION

SYSTEM

MODELTRAINING

EXTERNAL DATACOLLECTION

Web

App

Frontend Backend Offline

Page 19: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Roadmap

CasesResearchApproachProblem

Page 20: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Research Challenges

• How to train a good CNN model?

• How to deal with new food?

• How the labeled data size affects the accuracy?

Page 21: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Model Training

• A Family of CNN models for visual recognition

“An Analysis of Deep Neural Network Models for Practical Applications”

Alfredo Canziani, Adam Paszke, Eugenio Culurciello Published 2016 in ArXiv

ImageNet 1000 classes, 1.2 million images for training

Page 22: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Experimental Setups

• CNN Models• GoogleNet

• ResNet: 18, 50, 101, 152

• Settings• Toolbox: Caffe & TensorFelow

• Finetuned from ImageNet pretrained models

• Batch Size: From 16 to 128

• Optimizer: SGD with momentum/RMS Prop/Adam

• Learning rate: Fixed/multi-step/exponential decay

• Dropout/Batch Normalizations

Page 23: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Benchmark of FoodAI

Models (SGFOOD) Top-1 Accuracy (%) Top-5 Accuracy (%)

GoogleNet 71.5 91.0

ResNet-18 71.2 91.5

ResNet-50 76.1 93.3

ResNet-101 73.2 91.9

ResNet-152 74.7 92.7

Models (IMAGENET) Top-1 Accuracy (%) Top-5 Accuracy (%)

ResNet-50 77.1 93.3

ResNet-101 78.2 93.9

ResNet-152 78.6 94.3

724 visual food classes, 361,676 images for training, ~500 images per class

1000 object classes, 1.2 million images for training, 1200 images per class

Page 24: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Food Saliency Map

Page 25: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

How to handle NEW food?

• Too many possible food items in the market

• Only consider popular food for majority of users

• New food has few images available at the beginning

New food Discovery

New food image

annotation

Model Re-training

with new food

Update FoodAIInference

Engine

Page 26: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

What if only 10x less amount of labeled data is available to train an CNN model?

Page 27: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Training on 10x less labeled data

58

.0

82

.7

60

.0

83

.6

76

.1

93

.3

TOP-1 A CCURA CY TOP-5 A CCURA CY

ResNet-50 (10%) ResNet-50(10%)+augmentation ResNet-50 (100%)

Page 28: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Roadmap

CasesResearchApproachProblem

Page 29: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Case Studies: Food logging photos from users

WebMobile App

Powered by

Page 30: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Case Studies: Easy Cases

Page 31: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Kopi O

Americano

Case Studies: Hard Cases Large inter-class similarity (e.g., drinks)

Page 32: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Large inter-class similarity (e.g., drinks)Case Studies: Hard Cases

Plain Porridge Soya milk

Instant Coffee Teh C / Teh

Page 33: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Instant Coffee

Teh O

Teh / Teh C

Case Studies: Hard Cases Large inter-class similarity (e.g., drinks)

Page 34: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Large intra-class diversity (e.g., Economy rice)

Case Studies: Hard Cases

Page 35: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Incomplete FoodCase Studies: Hard Cases

Page 36: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Non Food Case Studies: Hard Cases

Page 37: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Poorly taken photos (illumination, rotation, occlusion, etc)Case Studies: Hard Cases

Page 38: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Multiple food itemsCase Studies: Hard Cases

Page 39: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

Unknown food / food not in our listCase Studies: Hard Cases

Page 40: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

How to build a more sustainable solution?

CrowdsourcingBetter Learning

Go beyond supervised CNNCombined with human wisdom

Page 41: Food Image Recognition by Deep Learning - Nvidia · Food Image Recognition •Could be very challenging… Singapore Tea or Teh •Teh, tea with milk and sugar •Teh-C, tea with

http://www.larc.smu.edu.sg

Thank You!

http://www.foodai.org

Acknowledgements