My question is here:
## In caffe root compile and run:
```
./build/examples/cpp_classification/classification.bin \
models/bvlc_reference_caffenet/deploy.prototxt \
models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel \
data/ilsvrc12/imagenet_mean.binaryproto \
data/ilsvrc12/synset_words.txt \
examples/images/cat.jpg
```
The output should look like this:
```
fps: 20.523036
0.3134 - "n02123045 tabby, tabby cat"
0.2380 - "n02123159 tiger cat"
0.1235 - "n02124075 Egyptian cat"
0.1003 - "n02119022 red fox, Vulpes vulpes"
0.0715 - "n02127052 lynx, catamount"
```
## Copy classification.cpp to a seperate folder, write a makefile compile and run:
```
make
./classification.bin \
/media/elab/sdd/caffe/models/bvlc_reference_caffenet/deploy.prototxt \
/media/elab/sdd/caffe/models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel \
/media/elab/sdd/caffe/data/ilsvrc12/imagenet_mean.binaryproto \
/media/elab/sdd/caffe/data/ilsvrc12/synset_words.txt \
/media/elab/sdd/caffe/examples/images/cat.jpg
```
```
fps: 2.953781
0.3132 - "n02123045 tabby, tabby cat"
0.2379 - "n02123159 tiger cat"
0.1235 - "n02124075 Egyptian cat"
0.1005 - "n02119022 red fox, Vulpes vulpes"
0.0715 - "n02127052 lynx, catamount"
Segmentation fault (core dumped)
```
The speed is the same as running on cpu mode in caffe root.
## The problems are:
1. Using exactly the same code, but the first with fps 10 x speed of the second.
2. Why Segmentation fault in the second run?
## Problems may be lies in makefile, my makefile:
```
CC=gcc
CAFFEPATH=/media/elab/sdd/caffe/build/install
VPATH=$(CAFFEPATH)
LDFLAGS= `pkg-config --libs opencv` -L$(CAFFEPATH)/lib -lcaffe-nv -lproto \
-L/usr/local/cuda/lib64 -lcuda -lcudart -lcublas -lcurand -lcudnn \
-lboost_system -lboost_filesystem -lboost_regex -lglog
CXXFLAGS= -Wall `pkg-config --cflags opencv` -lstdc++ -lm -std=c++0x -I$(CAFFEPATH)/include/ \
-I/usr/local/cuda/include/ -DUSE_OPENCV
DEPS = $(wildcard */*.h) $(wildcard $(CAFFEPATH)/include/*/*.hpp)
classification.bin: classification.o
$(CC) -o $@ $^ $(LDFLAGS) $(CXXFLAGS)
.PHONY: clean
clean:
rm -rf */*.o *.o *.bin
```
Any one could help me? It's quite confusing and urgent for me.