Skip to content

Show how to use Caffe2 in C++ through a simple LeNet sample project

Notifications You must be signed in to change notification settings

zhaiyuqiang/Caffe2-C-demo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Caffe2 C++ demo

Introduction

This demo shows how Caffe2 trains models, saves params and works with C++ language. Generally, Caffe2 has a tool called run_plan which is a counterpart of the executable caffe of Caffe1. We can train model with run_plan in command line and use the trained params in C++. The process is almost the same as Caffe1.

modify Makefile

change the value of CAFFE2_PREFIX in the makefile according to your customized installation location.

download mnist dataset and convert it into leveldb format

make dataset

train on mnist dataset and save params into lmdb format

make clean && make train

test on mnist dataset

make test

check out accuracy.txt to verify whether the model is properly trained.

make handwriting predictor

make predictor

you can use the predictor to classify single channel 28x28 mnist like handwriting pics. There are some samples extracted from MNIST. You can test on them with the following command.

./predictor -i imgs/0.bmp

About

Show how to use Caffe2 in C++ through a simple LeNet sample project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 75.9%
  • Makefile 24.1%