►
Description
Update of this using the Microsoft.ML.Vision package is here - https://youtu.be/ppRauvf6uCs
Use ML.NET and the (currently) preview version of 1.4 to create a deep neural network model to classify images.
Data - https://www.kaggle.com/brtknr/sushisandwich
Code - https://github.com/jwood803/MLNetExamples/blob/master/MLNetExamples/DeepNeuralNetwork/Program.cs
Transfer learning video - https://www.youtube.com/watch?v=tAiKAtmPaXU
Contact:
Twitter: https://twitter.com/JWood/
Blog: https://jonwood.co/
Gear used (affiliate links):
Mic - https://amzn.to/2YEXtxI
Mouse - https://amzn.to/2ZtASoQ
A
A
We're
going
to
go
and
new
get
to
get
a
model
net.
Now
for
this
I'm
going
to
get
the
pre-release
versions-
which
this
will
be
1
point
for
preview
and
for
the
deep
neural
network,
part
I'm,
gonna
get
the
Microsoft
@ml
DNN
package
and
that's
the
point.
1
6
preview
package,
alright,
before
we
get
started,
I'm
just
going
to
go
ahead
and
create
these
input
and
output
schema
classes.
A
So
the
first
one
is
going
to
be
image
data
for
my
input
schema,
so
it's
gonna
have
image
path
and
the
label
I'm
also
going
to
create
the
upload
schema,
which
is
going
to
be
image
prediction
and
that
is
going
to
have
a
float
array.
That's
going
to
be
a
scores
here.
We
get
from
the
model
I'm
also
going
to
have
unsigned
integer,
that's
going
to
be
the
predicted
label.
I
have
to
use
the
unsigned
integer,
because
the
DNN
package
doesn't
give
us
a
strain
for
it.
A
A
And
I
started
the
environment
occurring
through
a
tree.
I'm
gonna
go
back
three
levels
and
then
I
go
to
the
images
folder
then
from
there
I
can
get
my
files,
so
I
can
use
to
read
through
that
gif
files
now
start
off.
Looking
in
the
images
folder
there
and
the
search
pattern,
I'm
just
gonna
get
everything
so
I
use
the
wild
card
and
now
the
search
option
I
just
get
all
directories.
A
A
A
And
for
my
image
data
into
context,
data
load
from
innumerable
passing
our
images
I've
renamed
needs,
so
it
makes
a
bit
more
sense
now
I'm
going
to
shuffle
these
contexts.
Our
data
shuffle
rows
passing
the
images
data
data
view
next
I'm
going
to
split
this
data
using
the
contacts
data
that
train
test,
split
method
and
passing
the
shuffled
images
I,
give
it
a
test
fraction
of
20%.
A
A
So
there's
our
validation
data
we'll
pass
that
into
my
pipeline,
so
we're
gonna
do
a
validation
check
on
it,
while
I
built
our
model
speaking
about
pipeline,
let's
go
ahead
and
build
that
so
start
off
with
that
same
conversion,
where
we
map
the
label,
it
will
append
context
to
model
that
image
classification.
This
is
what
we
use
that
DNN
package
that
we
installed
alongside
and
mode
on
it,
and
then
we
give
it
the
image
path.
A
As
our
input,
our
label
column,
is
going
to
label
key
that
we
got
from
this
mouths
diary
to
key
we'll
give
it
architecture
of
ResNet
give
the
number
of
epochs
of
a
hundred.
This
is
how
many
times
it
goes
through
our
image
data
set
then
give
it
a
batch
size
or
just
do
ten,
and
we
can
give
it
a
metrics
call
bag
since
a
function,
I
just
called
console
dot
right,
laying
on
right
line
on
it
and
in
that
validation
data
said
they
were
created
earlier.
A
Don't
you
write
out
our
metrics
here,
it's
going
to
be
a
log
loss,
then
we
get
back
from
it
and
the
closer
to
zero
and
our
log
laws
means
are
the
better.
Our
model
is
and
to
predict
on
a
set
of
images,
and
we
can
create
our
prediction
engine
context,
our
model
and
that
create
prediction
engine
our
input
is
the
image
data
output
is
an
image
prediction.
A
You
pass
in
the
model
and
then
you
can
get
a
reference
to
the
test
images
folder
your
paths
that
combine
permit
that
current
divider,
the
kind
of
same
thing
over
there
before
you
know
being
a
test
folder,
and
then
we
get
the
files
from
it.
So
I
do
not
get
follows
and
from
those
files,
I'm
gonna
create
another
ienumerable
of
our
image.
Data
object
and
I'm.
A
A
I'm
gonna
create
a
V
buffer
I'm,
just
only
read-only
memory
of
card
call,
it
keys
I'll,
give
it
just
a
default
value
right
now
we
get
an
error
from
it,
saying
it's
not
available
in
c-sharp,
seven,
either
upgrade
and
actually
Visual
Studio
can
upgrade
that
for
us
and
to
get
the
key
values.
I'd
be
a
prediction
engine
that
output
schema,
I'll,
get
the
label
key
column
from
it
and
then
from
there.
I
can
get
key
values
and
then
passing
the
keys
as
a
reference
from
those
keys.
A
I
called
dents
values
and
I
get
turn
it
into
an
array,
and
so
with
each
image
and
the
test
images
from
the
prediction
engine,
then
I
can
get
the
label
index
from
the
prediction
that
predicted
label
and
then
from
there.
Let's
write
out
our
predictions.
So
the
image
is
my
path:
I
get
filename
on
the
image
path.
I
can
give
it
the
score.
I
me
a
prediction
score
now
to
take
the
max
value
out
of
those
and
in
the
predicted
label.
A
It's
going
to
be
from
the
original
labels
that
we
got
and
I'll
pass
on,
that
label
index
every
gap
in
the
prediction
and
then
I'll
do
a
console
real
arm,
so
the
console
doesn't
disappear
on
us.
So
it's
run
this
and
see
how
it
works
and,
depending
on
the
number
of
images
that
you
give
it
a
train
on,
it's
gonna
take
some
time
to
train
all
right.
So
we
see
no
output
here.
A
There's
training
up
here
and
notice
are
currently
accuracy
is
man's,
probably
due
to
their
still
being
in
preview,
but
after
it,
trains
and
all
that
you
see
our
load
loss
is
pretty
close
to
zero.
Here
point:
0,
0
of
4
and
on
our
test
images
I
see
both
sandwiches
labeled
as
sandwiches
at
like
99%
sushis
labeled
as
sushi
went
at
84%
and
never
went
at
99%
as
well.