2 ifneq ($(findstring movidius, $(PYTHONPATH)), movidius)
3 export PYTHONPATH:=/opt/movidius/caffe/python:$(PYTHONPATH)
6 NCCOMPILE = mvNCCompile
7 NCPROFILE = mvNCProfile
10 PROTOTXT_FILENAME= deploy.prototxt
11 GET_PROTOTXT = wget -P . https://raw.githubusercontent.com/BVLC/caffe/master/models/bvlc_alexnet/${PROTOTXT_FILENAME}
13 CAFFEMODEL_FILENAME = bvlc_alexnet.caffemodel
14 GET_CAFFEMODEL = wget -P . -N http://dl.caffe.berkeleyvision.org/${CAFFEMODEL_FILENAME}
18 all: profile check compile cpp
22 @echo "\nmaking prereqs"
23 (cd ../../data/ilsvrc12; make)
24 @sed -i 's/\r//' run.py
29 @echo "\nmaking prototxt"
30 @if [ -e ${PROTOTXT_FILENAME} ] ; \
32 echo "Prototxt file already exists"; \
34 echo "Downloading Prototxt file"; \
36 if [ -e ${PROTOTXT_FILENAME} ] ; \
38 echo "Adding input shape to prototxt file."; \
39 awk 'NR <2 {print}' < ${PROTOTXT_FILENAME} > temp; cat input_shape.prototxt >> temp; awk 'NR > 7 {print}' < ${PROTOTXT_FILENAME} >> temp; mv temp ${PROTOTXT_FILENAME}; \
41 echo "***\nError - Could not download prototxt file. Check network and proxy settings \n***\n"; \
48 @echo "\nmaking caffemodel"
49 @if [ -e ${CAFFEMODEL_FILENAME} ] ; \
51 echo "caffemodel file already exists"; \
53 echo "Downloading caffemodel file"; \
55 if ! [ -e ${CAFFEMODEL_FILENAME} ] ; \
57 echo "***\nError - Could not download caffemodel file. Check network and proxy settings \n***\n"; \
64 @echo "\nmaking profile"
65 ${NCPROFILE} ${PROTOTXT_FILENAME} -s 12
67 .PHONY: browse_profile
68 browse_profile: profile
69 @echo "\nmaking browse_profile"
70 @if [ -e output_report.html ] ; \
72 firefox output_report.html & \
74 @echo "***\nError - output_report.html not found" ; \
78 compile: prototxt caffemodel
79 @echo "\nmaking compile"
80 ${NCCOMPILE} -w ${CAFFEMODEL_FILENAME} -s 12 ${PROTOTXT_FILENAME}
83 check: prototxt caffemodel
84 @echo "\nmaking check"
85 #-${NCCHECK} -w ${CAFFEMODEL_FILENAME} -i ../../data/images/cat.jpg -s 12 -id 281 ${PROTOTXT_FILENAME} -S 255 -M ../../data/ilsvrc12/ilsvrc_2012_mean.npy
86 -${NCCHECK} -w ${CAFFEMODEL_FILENAME} -i ../../data/images/cat.jpg -s 12 -id 281 ${PROTOTXT_FILENAME} -M 110 -S 255
95 @echo "\nmaking run_py"
99 cpp: cpp/run.cpp cpp/fp16.c
101 g++ cpp/run.cpp cpp/fp16.c -o cpp/run_cpp -lmvnc
105 @echo "\nmaking run_cpp"
106 cd cpp; ./run_cpp; cd ..
110 @echo "possible make targets: ";
111 @echo " make help - shows this message";
112 @echo " make all - makes the following: prototxt, profile, compile, check, cpp, run_py, run_cpp";
113 @echo " make prototxt - downloads and adds input shape to Caffe prototxt file";
114 @echo " make caffemodel - downloads the caffemodel for the network"
115 @echo " make compile - runs SDK compiler tool to compile the NCS graph file for the network";
116 @echo " make check - runs SDK checker tool to verify an NCS graph file";
117 @echo " make profile - runs the SDK profiler tool to profile the network creating output_report.html";
118 @echo " make browse_profile - runs the SDK profiler tool and brings up report in browser.";
119 @echo " make cpp - builds the run_cpp executable example";
120 @echo " make run_cpp - runs the run_cpp executable example program";
121 @echo " make run_py - runs the run.py python example program:";
122 @echo " make clean - removes all created content"
125 @echo "\nmaking clean_caffe_model"
126 rm -f ${PROTOTXT_FILENAME}
127 rm -f ${CAFFEMODEL_FILENAME}
129 clean: clean_caffe_model
130 @echo "\nmaking clean"
134 rm -f output_report.html
135 rm -f output_expected.npy
136 rm -f zero_weights.caffemodel
137 rm -f output_result.npy