Training 

MachineBox is a machine learning system as a service. It has, presumably, in some backend somewhere, a general model—say, a convolutional neural network that has been trained with many faces, such that it knows what a face is. It does not provide the specific model that you may require for the task at hand. So instead, we would need to fine-tune the model provided by MachineBox by giving it training data. Per MachineBox's terminology, this is called teaching. As part of a curiosity collection, I have collected a small but usable number of images of MC Hot Dog's face that are suitable for the task of teaching the MachineBox what MC Hot Dog looks like.

For this project, the images are in the hotdog.zip file. Unzip the file into a folder called HotDog. This folder should be at the same level as main.go for this project.

Training the MachineBox model is simple with the SDK provided. The following code illustrates the program:

 import "github.com/machinebox/sdk-go/facebox"

func train(box *facebox.Client) error {
files, err := filepath.Glob("HotDog/*")
if err != nil {
return err
}
for _, filename := range files {
f , err := os.Open(filename)
if err != nil {
return err
}

if err := box.Teach(f, filename, "HotDog"); err != nil {
return err
}
if err := f.Close(); err != nil {
return err
}
}
return nil
}

func main(){
box := facebox.New("http://localhost:8080")
if err := train(box); err !=nil {
log.Fatal(err)
}
}

And there you have it—a complete tutorial on how to teach MachineBox how to recognize MC Hot Dog. MachineBox makes it easy—so easy that you don't need to know the mathematics behind the deep learning systems.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.111.179