1
FUTURE WORK CONCLUSIONS SMART RECIPE MEASUREMENTS WITH LEARNED V OLUME PREDICTION FEATURE EXTRACTION: OVERVIEW Would you rather chew off your pinky or measure ingredients for the rest of your life? The response is unanimous - no one needs a pinky anyhow. No one likes measuring, but previous research (Nelson&Maticka,2017) suggests that the Italian Grandma Method (IGM) – a splash of this and a dab of that - produces gastronomical grenades for all but the most experienced chefs (e.g. IG’s). Many of us casual cooks are not able to reproduce winning recipes when applying the IGM, and instead are left with a one-hit-wonder followed by an onslaught of failed recreation attempts that pale in comparison and litter your fridge with dreadful leftovers. We propose a solution to this dystopia. The broader purpose of this project is to create a smart recipe recorder and instructor. You can either 1) make a recipe-free dish, and add ingredients at will while a smart device films and records the recipe, or 2) you can create a saved recipe, and have the device tell you when to stop pouring a specified ingredient. We applied machine learning and computer vision to teach phones how to measure ingredients for us. We chose to focus on poured liquids as a first step. DATA COLLECTION Feature Extraction Pouring Videos X 1 : Duration X 2 : Speed X 3 : Area Predicted Volumes Machine Learning Δy Speed: Δy/Δt Start Stop Duration: Δt Δt L Area: <L 2 > X 1 X 2 X 3 Edge Detection FEATURES & SELECTION PROCESS FEATURE PROPERTIES: 3 fundamental physically-relevant features Inherent feature variance 3-way interaction term is a physical estimate of volume FEATURE SELECTION PROCESS: Forward feature selection for each model type Full feature set: 3 fundamental features, 2 nd - order terms, 2-way interactions, and 1 3-way interaction (see Feature Properties) CV error with k=10 folds (split: 90/10) was used as the selection metric The feature set that yielded the lowest CV error was chosen for the respective model 5 10 Duration (s) 100 150 200 Speed (cm/s) 1 2 Area (cm 2 ) 0 0.5 1 1.5 2 2.5 Actual Volume (cups) 2 4 6 Area*Speed*Duration MODEL SELECTION/ASSESSMENT METHOD Split Data: 90/10 Select Model With Lowest Development Error Kurt Nelson Sam Maticka {knelson3, smaticka}@stanford.edu Check if enough data For All Models Test on Reserved Data (10%) Tune model parameters 0 50 100 0.015 0.02 0.025 CV Error (MSE or % wrong) Feature selection 4 6 8 10 0.018 0.02 0.022 0.024 50 100 150 0 0.05 0.1 0.15 0.2 Test Other Models: Neural networks. We would need to collect a lot more data PCA combined with other methods Regression Trees (preliminary results show promise) Things that may help current models: Improve experimental setup - stereo cameras for better cross-sectional area estimate Improve feature extraction algorithm: o Better estimate of flow rate (speed) - some sort of intermittent particle tracking o More rigorous removal of erroneous cross-sectional area Expansion of the smart device’s abilities: Generalize the model for different ingredients – dry ingredients, clear liquids, Machine learning does far better than a baseline prediction using theory: o MSE on test data: 0.016 cups vs. 0.072 cups o Misclassification Error: 25% vs. 75% Non-parametric models perform better than parametric Data sample size was adequate for simple regression models tested. This was confirmed by convergence of test and development errors. However, the data sample size limited the classification models we were able to test. MODEL TESTING Development Set Errors Regression Model MSE (cups) 1) Weighted Least Squares 0.017 2) K-Nearest Neighbors 0.018 3) Ordinary Least Squares 0.021 4) Ridge Regression 0.021 5) Lasso Regression 0.023 Classification Model Misclassification Error (%) 1) Softmax 25 2) K-Nearest Neighbors 26 3) Linear Discriminant Analysis 28 4) Support Vector Machines 42 5) Physical Model (rounded) 78 Chosen Models L OCALLY WEIGHTED LINEAR REGRESSION # =∑ ( ( # ) (*+ =∑ . (ℎ . . ) 2 # .*+ . = exp[− 7 8 97 : 7 8 97 2; < ], Tuned =2.2 Selected 7 features: 3 fundamental features, 3- way interaction, time 2 , , () MSE error on unseen test data was 0.016 cups SOFTMAX ( = |; ) = NOP(Q 8 : 7) NOP(Q R : 7) S RTU Maximize: =∑ NOP(Q 8 : 7) NOP(Q R : 7) S RTU +{[ 8 *+} ] ^*+ # .*+ Selected 6 features: 3 fundamental features, 3-way interaction, 2 ,speed 2 Misclassification error on unseen test data was 25% PHYSICAL MODEL . = + . 2 . . =()()() =∑ [ 8 7 U 8 7 < 8 7 a 8 # .*+

S R MEASUREMENTSWITH LEARNED VOLUME PREDICTION Kurt …cs229.stanford.edu › proj2017 › final-posters › 5148322.pdf · 2018-01-04 · Would you rather chew off your pinky or

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: S R MEASUREMENTSWITH LEARNED VOLUME PREDICTION Kurt …cs229.stanford.edu › proj2017 › final-posters › 5148322.pdf · 2018-01-04 · Would you rather chew off your pinky or

FUTURE WORKCONCLUSIONS

SMART RECIPE MEASUREMENTS WITH LEARNED VOLUME PREDICTION

FEATURE EXTRACTION:

OVERVIEWWouldyouratherchewoffyourpinkyormeasureingredientsfortherestofyourlife?Theresponseisunanimous -

nooneneedsapinkyanyhow.Noonelikesmeasuring,butpreviousresearch(Nelson&Maticka,2017)suggeststhattheItalianGrandmaMethod(IGM)– asplashofthisandadabofthat- producesgastronomicalgrenadesforallbutthemostexperiencedchefs(e.g.IG’s).

ManyofuscasualcooksarenotabletoreproducewinningrecipeswhenapplyingtheIGM,andinsteadareleftwithaone-hit-wonderfollowedbyanonslaughtoffailedrecreationattemptsthatpaleincomparisonandlitteryourfridgewithdreadfulleftovers.Weproposeasolutiontothisdystopia.

Thebroaderpurposeofthisprojectistocreateasmartreciperecorderandinstructor. Youcaneither1)makearecipe-freedish,andaddingredientsatwillwhileasmartdevicefilmsandrecordstherecipe,or2)youcancreateasavedrecipe,andhavethedevicetellyouwhentostoppouringaspecifiedingredient.

Weappliedmachinelearningandcomputervisiontoteachphoneshowtomeasureingredientsforus.Wechosetofocusonpouredliquidsasafirststep.

DATA COLLECTIONFeature

Extraction

PouringVideos

X1:DurationX2:SpeedX3:Area

PredictedVolumes

Machine

Learning

Δy

Speed:Δy/Δt

Start

Stop

Duration:Δt

Δt

L

Area:<L2>

X1

X2

X3

EdgeDetection

FEATURES & SELECTION PROCESSFEATURE PROPERTIES:

• 3fundamentalphysically-relevantfeatures

• Inherentfeaturevariance

• 3-wayinteractiontermisaphysicalestimateofvolume

FEATURE SELECTION PROCESS:

• Forwardfeatureselection foreachmodeltype

• Fullfeatureset:3fundamentalfeatures,2nd-orderterms,2-wayinteractions,and13-wayinteraction(seeFeatureProperties)

• CVerrorwithk=10folds(split:90/10)wasusedastheselectionmetric

• ThefeaturesetthatyieldedthelowestCVerrorwaschosenfortherespectivemodel

5

10

Dur

atio

n (s

)

100

150

200

Spee

d (c

m/s

)

1

2

Area

(cm

2 )

0 0.5 1 1.5 2 2.5Actual Volume (cups)

2

4

6

Area

*Spe

ed*D

urat

ion

MODEL SELECTION/ASSESSMENT METHOD

SplitData:90/10

SelectModelWithLowestDevelopment

Error

KurtNelsonSamMaticka

{knelson3,smaticka}@stanford.edu

Checkifenoughdata

ForA

llMod

els

TestonReservedData(10%)

Tunemodelparameters

0 50 1000.015

0.02

0.025

CV

Err

or

(MSE

or %

wro

ng)

Featureselection

4 6 8 100.018

0.02

0.022

0.024

50 100 1500

0.05

0.1

0.15

0.2

TestOtherModels:• Neuralnetworks.Wewouldneedtocollectalotmoredata• PCAcombinedwithothermethods• RegressionTrees(preliminaryresultsshowpromise)

Thingsthatmayhelpcurrentmodels:• Improveexperimentalsetup- stereocamerasforbettercross-sectionalareaestimate• Improvefeatureextractionalgorithm:

o Betterestimateofflowrate(speed)- somesortofintermittentparticletrackingo Morerigorousremovaloferroneouscross-sectionalarea

Expansionofthesmartdevice’sabilities:• Generalizethemodelfordifferentingredients– dryingredients,clearliquids,

• Machinelearningdoesfarbetterthanabaselinepredictionusingtheory:oMSEontestdata: 0.016cupsvs.0.072cupsoMisclassificationError:25%vs.75%

• Non-parametricmodelsperformbetterthanparametric

• Datasamplesizewasadequateforsimpleregressionmodelstested.Thiswasconfirmedbyconvergenceoftestanddevelopmenterrors.However,thedatasamplesizelimitedtheclassificationmodelswewereabletotest.

MODEL TESTINGDevelopment SetErrors

RegressionModel MSE (cups)

1)Weighted LeastSquares 0.017

2) K-NearestNeighbors 0.018

3)OrdinaryLeastSquares 0.021

4)RidgeRegression 0.021

5)LassoRegression 0.023

ClassificationModel MisclassificationError(%)

1)Softmax 25

2)K-NearestNeighbors 26

3)Linear DiscriminantAnalysis 28

4)SupportVectorMachines 42

5)Physical Model(rounded) 78

Chosen

Mod

els

LOCALLY WEIGHTED LINEAR REGRESSION

• ℎ 𝑥# = ∑ 𝜃(𝑥(#)(*+

• 𝐽 𝜃 = ∑ 𝑤.(ℎ 𝑥. − 𝑥.)2#.*+

• 𝑤. = exp[− 7897:7897

2;<],Tuned 𝜏=2.2

• Selected7features:3fundamental features,3-wayinteraction,time2, 𝑑𝑢𝑟𝑎𝑡𝑖𝑜𝑛 𝑎𝑟𝑒𝑎 ,(𝑠𝑝𝑒𝑒𝑑) 𝑎𝑟𝑒𝑎

• MSEerroronunseentestdatawas 0.016cups

SOFTMAX

• 𝑝(𝑦 = 𝑗|𝑥; 𝜃) = NOP(Q8:7)

∑ NOP(QR:7)S

RTU

• Maximize:ℓ 𝜃 = ∑ 𝑙𝑜𝑔∏ NOP(Q8:7)

∑ NOP(QR:7)S

RTU

+{[8*+}]^*+

#.*+

• Selected6features:3fundamentalfeatures,3-wayinteraction,𝑑𝑢𝑟𝑎𝑡𝑖𝑜𝑛2,speed2

• Misclassificationerroronunseentestdatawas25%

PHYSICAL MODEL

• ℎ 𝑥. = 𝛼𝑥+.𝑥2. 𝑥`.=𝛼(𝑎𝑟𝑒𝑎)(𝑑𝑢𝑟𝑎𝑡𝑖𝑜𝑛)(𝑠𝑝𝑒𝑒𝑑)

• 𝛼 = ∑ [8

7U8 7<8 7a8#.*+