-
Notifications
You must be signed in to change notification settings - Fork 379
/
Makefile
126 lines (108 loc) · 3.52 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
ifneq ($(findstring movidius, $(PYTHONPATH)), movidius)
export PYTHONPATH:=/opt/movidius/caffe/python:/opt/movidius/mvnc/python:$(PYTHONPATH)
endif
NCCOMPILE = mvNCCompile
NCPROFILE = mvNCProfile
NCCHECK = mvNCCheck
GRAPH_FILENAME = yolo_tiny.graph
GET_GRAPH = wget --no-cache -P . http://ncs-forum-uploads.s3.amazonaws.com/ncappzoo/tiny_yolo/${GRAPH_FILENAME}
PROTOTXT_FILENAME= tiny-yolo-v1.prototxt
GET_PROTOTXT = wget --no-cache -P . http://ncs-forum-uploads.s3.amazonaws.com/ncappzoo/tiny_yolo/${PROTOTXT_FILENAME}
CAFFEMODEL_FILENAME = tiny-yolo-v1_53000.caffemodel
GET_CAFFEMODEL = wget --no-cache -P . -N http://ncs-forum-uploads.s3.amazonaws.com/ncappzoo/tiny_yolo/${CAFFEMODEL_FILENAME}
.PHONY: all
all: profile compile
.PHONY: prototxt
prototxt:
@echo "\nmaking prototxt"
@if [ -e ${PROTOTXT_FILENAME} ] ; \
then \
echo "Prototxt file already exists"; \
else \
echo "Downloading Prototxt file"; \
${GET_PROTOTXT}; \
if [ -e ${PROTOTXT_FILENAME} ] ; \
then \
echo "got prototext file." ; \
else \
echo "***\nError - Could not download prototxt file. Check network and proxy settings \n***\n"; \
exit 1; \
fi ; \
fi
.PHONY: caffemodel
caffemodel:
@echo "\nmaking caffemodel"
@if [ -e ${CAFFEMODEL_FILENAME} ] ; \
then \
echo "caffemodel file already exists"; \
else \
echo "Downloading caffemodel file"; \
${GET_CAFFEMODEL}; \
if ! [ -e ${CAFFEMODEL_FILENAME} ] ; \
then \
echo "***\nError - Could not download caffemodel file. Check network and proxy settings \n***\n"; \
exit 1; \
fi ; \
fi
.PHONY: profile
profile: prototxt
@echo "\nmaking profile"
${NCPROFILE} ${PROTOTXT_FILENAME} -s 12
.PHONY: browse_profile
browse_profile: profile
@echo "\nmaking browse_profile"
@if [ -e output_report.html ] ; \
then \
firefox output_report.html & \
else \
@echo "***\nError - output_report.html not found" ; \
fi ;
.PHONY: compile
compile: prototxt caffemodel
@echo "\nmaking compile"
${NCCOMPILE} -o ${GRAPH_FILENAME} -w ${CAFFEMODEL_FILENAME} -s 12 ${PROTOTXT_FILENAME}
.PHONY: graph
graph:
@echo "\nmaking (downloading) graph"
@if [ -e ${GRAPH_FILENAME} ] ; \
then \
echo "graph file already exists"; \
else \
${GET_GRAPH}; \
if ! [ -e ${GRAPH_FILENAME} ] ; \
then \
echo "***\nError - Could not download graph file. Check network and proxy settings \n***\n"; \
exit 1; \
fi ; \
fi ;
.PHONY: run_py
run_py: compile
@echo "\nmaking run_py"
python3 ./run.py
.PHONY: help
help:
@echo "possible make targets: ";
@echo " make help - shows this message";
@echo " make all - makes the following: prototxt, profile, compile, check, cpp, run_py, run_cpp";
@echo " make prototxt - downloads and adds input shape to Caffe prototxt file";
@echo " make caffemodel - downloads the caffemodel for the network"
@echo " make compile - runs SDK compiler tool to compile the NCS graph file for the network";
@echo " make profile - runs the SDK profiler tool to profile the network creating output_report.html";
@echo " make browse_profile - runs the SDK profiler tool and brings up report in browser.";
@echo " make run_py - runs the run.py python example program";
@echo " make clean - removes all created content"
clean_caffe_model:
@echo "\nmaking clean_caffe_model"
rm -f ${PROTOTXT_FILENAME}
rm -f ${CAFFEMODEL_FILENAME}
clean: clean_caffe_model
@echo "\nmaking clean"
rm -f ${GRAPH_FILENAME}
rm -f graph
rm -f output.gv
rm -f output.gv.svg
rm -f output_report.html
rm -f output_expected.npy
rm -f zero_weights.caffemodel
rm -f output_result.npy
rm -f output_val.csv