MCPcopy Create free account
hub / github.com/Xilinx/CHaiDNN / main

Function main

software/example/sw_layer_plugin.cpp:56–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54using namespace cv;
55
56int main(int argc, char **argv)
57{
58 if(argc < 5) {
59 std::cout << "Usage : ./sw_layer_plugin.elf <quant_mode> <bit_width> <img1_path> <img2_path>" << std::endl;
60 std::cout << "quant_mode : DynamicFixed" << std::endl;
61 std::cout << "bit_width : 6" << std::endl;
62 std::cout << "img1_path : Path to the first image" << std::endl;
63 std::cout << "img2_path : Path to the second image" << std::endl;
64 return -1;
65 }
66
67 string quant_mode_arg(argv[1]);
68 int bit_width_arg = atoi(argv[2]);
69 char *img_path1 = argv[3];
70 char *img_path2 = argv[4];
71
72 char *dirpath;
73 char *caffemodel;
74 char *prototxt;
75
76 int resize_h = 224;
77 int resize_w = 224;
78 bool inp_mode;
79
80 // Xilinx quantmode 6 bit
81 if(quant_mode_arg == "DynamicFixed" && bit_width_arg == 6) {
82 dirpath = "models/GoogleNetWithoutLRN/6Bit";
83 caffemodel = "GoogleNetNoLRN_6Bit_CHaiDNN.caffemodel";
84 prototxt = "GoogleNetNoLRN_6Bit_CHaiDNN_Customlayer.prototxt";
85 inp_mode = 1;
86 }
87 else {
88 std::cout << "Usage : ./custom_ex.elf <quant_mode> <bit_width> <img1_path> <img2_path>" << std::endl;
89 std::cout << "quant_mode : DynamicFixed" << std::endl;
90 std::cout << "bit_width : 6" << std::endl;
91 std::cout << "img1_path : Path to the first image" << std::endl;
92 std::cout << "img2_path : Path to the second image" << std::endl;
93 return -1;
94 }
95
96 std :: cout << "[INFOx] Network Path : " << dirpath << std :: endl;
97
98 //# start layer in the graph
99 string start_layer = "";
100
101 //# end layer in the graph
102 string end_layer = "";
103
104 //# Flag indicate layer1 or not
105 //# 1 - if image data is the for first layer input otherwise 0
106 bool is_first_layer = 1;
107
108 //# Number of images to process
109 //# Supported batch size is 2
110 int numImg_to_process = 2;
111
112 //# Struct which holds the input/output layer info
113 io_layer_info io_layer_info_ptr;

Callers

nothing calls this directly

Calls 10

xiInitFunction · 0.85
inputNormalizationFunction · 0.85
xiInputReadFunction · 0.85
getPerfInfoFunction · 0.85
xiUnpackOutputFunction · 0.85
outputWriteFunction · 0.85
xiReleaseFunction · 0.85
push_backMethod · 0.45
compareMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected