2 ifneq ($(findstring movidius, $(PYTHONPATH)), movidius)
3 export PYTHONPATH:=/opt/movidius/caffe/python:$(PYTHONPATH)
6 NCCOMPILE = mvNCCompile
7 NCPROFILE = mvNCProfile
11 PROTOTXT_FILENAME= deploy.prototxt
12 GET_PROTOTXT = wget -P . https://raw.githubusercontent.com/BVLC/caffe/master/models/bvlc_googlenet/deploy.prototxt
14 CAFFEMODEL_FILENAME = bvlc_googlenet.caffemodel
15 GET_CAFFEMODEL = wget -P . -N http://dl.caffe.berkeleyvision.org/${CAFFEMODEL_FILENAME}
19 all: profile check compile cpp
23 @echo "\nmaking prereqs"
24 (cd ../../data/ilsvrc12; make)
25 @sed -i 's/\r//' run.py
30 @echo "\nmaking prototxt"
31 @if [ -e ${PROTOTXT_FILENAME} ] ; \
33 echo "Prototxt file already exists"; \
35 echo "Downloading Prototxt file"; \
37 if [ -e ${PROTOTXT_FILENAME} ] ; \
39 echo "Adding input shape to prototxt file."; \
40 awk 'NR <2 {print}' < ${PROTOTXT_FILENAME} > temp; cat input_shape.prototxt >> temp; awk 'NR > 7 {print}' < ${PROTOTXT_FILENAME} >> temp; mv temp ${PROTOTXT_FILENAME}; \
42 echo "***\nError - Could not download prototxt file. Check network and proxy settings \n***\n"; \
49 @echo "\nmaking caffemodel"
50 @if [ -e ${CAFFEMODEL_FILENAME} ] ; \
52 echo "caffemodel file already exists"; \
54 echo "Downloading caffemodel file"; \
56 if ! [ -e ${CAFFEMODEL_FILENAME} ] ; \
58 echo "***\nError - Could not download caffemodel file. Check network and proxy settings \n***\n"; \
65 @echo "\nmaking profile"
66 ${NCPROFILE} ${PROTOTXT_FILENAME} -s 12
68 .PHONY: browse_profile
69 browse_profile: profile
70 @echo "\nmaking browse_profile"
71 @if [ -e output_report.html ] ; \
73 firefox output_report.html & \
75 @echo "***\nError - output_report.html not found" ; \
79 compile: prototxt caffemodel
80 @echo "\nmaking compile"
81 ${NCCOMPILE} -w ${CAFFEMODEL_FILENAME} -s 12 ${PROTOTXT_FILENAME}
84 check: prototxt caffemodel
85 @echo "\nmaking check"
86 #-${NCCHECK} -w ${CAFFEMODEL_FILENAME} -i ../../data/images/cat.jpg -s 12 -id 281 ${PROTOTXT_FILENAME} -S 255 -M ../../data/ilsvrc12/ilsvrc_2012_mean.npy
87 ${NCCHECK} -w ${CAFFEMODEL_FILENAME} -i ../../data/images/nps_electric_guitar.png -s 12 -id 546 ${PROTOTXT_FILENAME} -S 255 -M 110
96 @echo "\nmaking run_py"
100 cpp: cpp/run.cpp cpp/fp16.c
102 g++ cpp/run.cpp cpp/fp16.c -o cpp/run_cpp -lmvnc
106 @echo "\nmaking run_cpp"
107 cd cpp; ./run_cpp; cd ..
111 @echo "possible make targets: ";
112 @echo " make help - shows this message";
113 @echo " make all - makes the following: prototxt, profile, compile, check, cpp, run_py, run_cpp";
114 @echo " make prototxt - downloads and adds input shape to Caffe prototxt file";
115 @echo " make caffemodel - downloads the caffemodel for the network"
116 @echo " make compile - runs SDK compiler tool to compile the NCS graph file for the network";
117 @echo " make check - runs SDK checker tool to verify an NCS graph file";
118 @echo " make profile - runs the SDK profiler tool to profile the network creating output_report.html";
119 @echo " make browse_profile - runs the SDK profiler tool and brings up report in browser.";
120 @echo " make cpp - builds the run_cpp executable example";
121 @echo " make run_cpp - runs the run_cpp executable example program";
122 @echo " make run_py - runs the run.py python example program";
123 @echo " make clean - removes all created content"
126 @echo "\nmaking clean_caffe_model"
127 rm -f ${PROTOTXT_FILENAME}
128 rm -f ${CAFFEMODEL_FILENAME}
130 clean: clean_caffe_model
131 @echo "\nmaking clean"
135 rm -f output_report.html
136 rm -f output_expected.npy
137 rm -f zero_weights.caffemodel
138 rm -f output_result.npy