Skip to content

Commit c8ed6d7

Browse files
committed
all test ok
1 parent d4e0d07 commit c8ed6d7

File tree

16 files changed

+63
-63
lines changed

16 files changed

+63
-63
lines changed

include/tkDNN/DarknetParser.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ namespace tk { namespace dnn {
124124
}
125125

126126
tk::dnn::Network *darknetAddNet(darknetFields_t &fields) {
127-
std::cout<<"Add Net: "<<fields.type<<"\n";
127+
//std::cout<<"Add Net: "<<fields.type<<"\n";
128128
dataDim_t dim(1, fields.channels, fields.height, fields.width);
129129
return new tk::dnn::Network(dim);
130130
}
@@ -138,10 +138,10 @@ namespace tk { namespace dnn {
138138
if(f.pad == 1) {
139139
f.padding_x = f.padding_y = f.size_x /2;
140140
}
141-
std::cout<<"Add layer: "<<f.type<<"\n";
141+
//std::cout<<"Add layer: "<<f.type<<"\n";
142142
if(f.type == "convolutional") {
143143
std::string wgs = wgs_path + "/c" + std::to_string(netLayers.size()) + ".bin";
144-
printf("%d (%d,%d) (%d,%d) (%d,%d) %s %d %d\n", f.filters, f.size_x, f.size_y, f.stride_x, f.stride_y, f.padding_x, f.padding_y, wgs.c_str(), f.batch_normalize, f.groups);
144+
//printf("%d (%d,%d) (%d,%d) (%d,%d) %s %d %d\n", f.filters, f.size_x, f.size_y, f.stride_x, f.stride_y, f.padding_x, f.padding_y, wgs.c_str(), f.batch_normalize, f.groups);
145145
tk::dnn::Conv2d *l= new tk::dnn::Conv2d(net, f.filters, f.size_x, f.size_y, f.stride_x,
146146
f.stride_y, f.padding_x, f.padding_y, wgs, f.batch_normalize, false, f.groups);
147147
netLayers.push_back(l);
@@ -163,7 +163,7 @@ namespace tk { namespace dnn {
163163
if(layerIdx < 0)
164164
layerIdx = netLayers.size() + layerIdx;
165165
if(layerIdx < 0 || layerIdx >= netLayers.size()) FatalError("impossible to shortcut\n");
166-
std::cout<<"shortcut to "<<layerIdx<<" "<<netLayers[layerIdx]->getLayerName()<<"\n";
166+
//std::cout<<"shortcut to "<<layerIdx<<" "<<netLayers[layerIdx]->getLayerName()<<"\n";
167167
netLayers.push_back(new tk::dnn::Shortcut(net, netLayers[layerIdx]));
168168

169169
} else if(f.type == "upsample") {
@@ -177,7 +177,7 @@ namespace tk { namespace dnn {
177177
if(layerIdx < 0)
178178
layerIdx = netLayers.size() + layerIdx;
179179
if(layerIdx < 0 || layerIdx >= netLayers.size()) FatalError("impossible to route\n");
180-
std::cout<<"Route to "<<layerIdx<<" "<<netLayers[layerIdx]->getLayerName()<<"\n";
180+
//std::cout<<"Route to "<<layerIdx<<" "<<netLayers[layerIdx]->getLayerName()<<"\n";
181181
layers.push_back(netLayers[layerIdx]);
182182
}
183183
netLayers.push_back(new tk::dnn::Route(net, layers.data(), layers.size()));
@@ -190,7 +190,7 @@ namespace tk { namespace dnn {
190190

191191
} else if(f.type == "yolo") {
192192
std::string wgs = wgs_path + "/g" + std::to_string(netLayers.size()) + ".bin";
193-
printf("%d %d %s %d %f\n", f.classes, f.num/f.n_mask, wgs.c_str(), f.n_mask, f.scale_xy);
193+
//printf("%d %d %s %d %f\n", f.classes, f.num/f.n_mask, wgs.c_str(), f.n_mask, f.scale_xy);
194194
tk::dnn::Yolo *l = new tk::dnn::Yolo(net, f.classes, f.num/f.n_mask, wgs, f.n_mask, f.scale_xy);
195195
if(names.size() != f.classes)
196196
FatalError("Mismatch between number of classes and names");

include/tkDNN/DetectionNN.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,14 @@ class DetectionNN {
106106
originalSize.clear();
107107
if(TKDNN_VERBOSE) printCenteredTitle(" TENSORRT detection ", '=', 30);
108108
{
109-
TIMER_START
109+
TKDNN_TSTART
110110
for(int bi=0; bi<cur_batches;++bi){
111111
if(!frames[bi].data)
112112
FatalError("No image data feed to detection");
113113
originalSize.push_back(frames[bi].size());
114114
preprocess(frames[bi], bi);
115115
}
116-
TIMER_STOP
116+
TKDNN_TSTOP
117117
if(save_times) *times<<t_ns<<";";
118118
}
119119

@@ -122,20 +122,20 @@ class DetectionNN {
122122
dim.n = cur_batches;
123123
{
124124
if(TKDNN_VERBOSE) dim.print();
125-
TIMER_START
125+
TKDNN_TSTART
126126
netRT->infer(dim, input_d);
127-
TIMER_STOP
127+
TKDNN_TSTOP
128128
if(TKDNN_VERBOSE) dim.print();
129129
stats.push_back(t_ns);
130130
if(save_times) *times<<t_ns<<";";
131131
}
132132

133133
batchDetected.clear();
134134
{
135-
TIMER_START
135+
TKDNN_TSTART
136136
for(int bi=0; bi<cur_batches;++bi)
137137
postprocess(bi, mAP);
138-
TIMER_STOP
138+
TKDNN_TSTOP
139139
if(save_times) *times<<t_ns<<"\n";
140140
}
141141
}

include/tkDNN/test.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ int testInference(std::vector<std::string> input_bins, std::vector<std::string>
3434
tk::dnn::dataDim_t dim1 = net->input_dim; //input dim
3535
printCenteredTitle(" CUDNN inference ", '=', 30); {
3636
dim1.print();
37-
TIMER_START
37+
TKDNN_TSTART
3838
net->infer(dim1, data);
39-
TIMER_STOP
39+
TKDNN_TSTOP
4040
dim1.print();
4141
}
4242
for(int i=0; i<outputs.size(); i++) cudnn_out[i] = outputs[i]->dstData;
@@ -45,9 +45,9 @@ int testInference(std::vector<std::string> input_bins, std::vector<std::string>
4545
tk::dnn::dataDim_t dim2 = net->input_dim;
4646
printCenteredTitle(" TENSORRT inference ", '=', 30); {
4747
dim2.print();
48-
TIMER_START
48+
TKDNN_TSTART
4949
netRT->infer(dim2, data);
50-
TIMER_STOP
50+
TKDNN_TSTOP
5151
dim2.print();
5252
}
5353
for(int i=0; i<outputs.size(); i++) rt_out[i] = (dnnType*)netRT->buffersRT[i+1];

include/tkDNN/utils.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@
3939
#define TKDNN_VERBOSE 0
4040

4141
// Simple Timer
42-
#define TIMER_START timespec start, end; \
42+
#define TKDNN_TSTART timespec start, end; \
4343
clock_gettime(CLOCK_MONOTONIC, &start);
4444

45-
#define TIMER_STOP_C(col, show) clock_gettime(CLOCK_MONOTONIC, &end); \
45+
#define TKDNN_TSTOP_C(col, show) clock_gettime(CLOCK_MONOTONIC, &end); \
4646
double t_ns = ((double)(end.tv_sec - start.tv_sec) * 1.0e9 + \
4747
(double)(end.tv_nsec - start.tv_nsec))/1.0e6; \
4848
if(show) std::cout<<col<<"Time:"<<std::setw(16)<<t_ns<<" ms\n"<<COL_END;
4949

50-
#define TIMER_STOP TIMER_STOP_C(COL_CYANB, TKDNN_VERBOSE)
50+
#define TKDNN_TSTOP TKDNN_TSTOP_C(COL_CYANB, TKDNN_VERBOSE)
5151

5252
/********************************************************
5353
* Prints the error message, and exits

tests/backbones/dla34/dla34.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,9 @@ int main()
312312
printCenteredTitle(" CUDNN inference ", '=', 30);
313313
{
314314
dim1.print();
315-
TIMER_START
315+
TKDNN_TSTART
316316
net.infer(dim1, data);
317-
TIMER_STOP
317+
TKDNN_TSTOP
318318
dim1.print();
319319
}
320320
cudnn_out = net.layers[net.num_layers-1]->dstData;
@@ -326,9 +326,9 @@ int main()
326326
printCenteredTitle(" TENSORRT inference ", '=', 30);
327327
{
328328
dim2.print();
329-
TIMER_START
329+
TKDNN_TSTART
330330
netRT.infer(dim2, data);
331-
TIMER_STOP
331+
TKDNN_TSTOP
332332
dim2.print();
333333
}
334334
rt_out = (dnnType *)netRT.buffersRT[1];

tests/backbones/resnet101/resnet101.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,9 @@ int main()
301301
printCenteredTitle(" CUDNN inference ", '=', 30);
302302
{
303303
dim1.print();
304-
TIMER_START
304+
TKDNN_TSTART
305305
net.infer(dim1, data);
306-
TIMER_STOP
306+
TKDNN_TSTOP
307307
dim1.print();
308308
}
309309
cudnn_out = net.layers[net.num_layers-1]->dstData;
@@ -314,9 +314,9 @@ int main()
314314
printCenteredTitle(" TENSORRT inference ", '=', 30);
315315
{
316316
dim2.print();
317-
TIMER_START
317+
TKDNN_TSTART
318318
netRT.infer(dim2, data);
319-
TIMER_STOP
319+
TKDNN_TSTOP
320320
dim2.print();
321321
}
322322
rt_out = (dnnType *)netRT.buffersRT[1];

tests/centernet/dla34_cnet/dla34_cnet.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -486,19 +486,19 @@ int main()
486486
printCenteredTitle(" CUDNN inference ", '=', 30);
487487
{
488488
dim1.print();
489-
TIMER_START
489+
TKDNN_TSTART
490490
net.infer(dim1, data);
491-
TIMER_STOP
491+
TKDNN_TSTOP
492492
dim1.print();
493493
}
494494

495495
tk::dnn::dataDim_t dim2 = dim;
496496
printCenteredTitle(" TENSORRT inference ", '=', 30);
497497
{
498498
dim2.print();
499-
TIMER_START
499+
TKDNN_TSTART
500500
netRT.infer(dim2, data);
501-
TIMER_STOP
501+
TKDNN_TSTOP
502502
dim2.print();
503503
}
504504

tests/centernet/resnet101_cnet/resnet101_cnet.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,9 @@ int main()
361361
printCenteredTitle(" CUDNN inference ", '=', 30);
362362
{
363363
dim1.print();
364-
TIMER_START
364+
TKDNN_TSTART
365365
net.infer(dim1, data);
366-
TIMER_STOP
366+
TKDNN_TSTOP
367367
dim1.print();
368368
}
369369

@@ -373,9 +373,9 @@ int main()
373373
printCenteredTitle(" TENSORRT inference ", '=', 30);
374374
{
375375
dim2.print();
376-
TIMER_START
376+
TKDNN_TSTART
377377
netRT.infer(dim2, data);
378-
TIMER_STOP
378+
TKDNN_TSTOP
379379
dim2.print();
380380
}
381381

tests/imuodom/imuodom.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ int main() {
4646
int ret_cudnn = 0;
4747
for(int i=0; i<N; i++) {
4848
std::cout<<"i: "<<i<<"\n";
49-
//TIMER_START
49+
//TKDNN_TSTART
5050
// Inference
5151
ImuNet.update(i0_h, i1_h, i2_h);
52-
//TIMER_STOP
52+
//TKDNN_TSTOP
5353

5454
// log path
5555
path<<ImuNet.odomPOS(0)<<" "<<ImuNet.odomPOS(1)<<" "<< ImuNet.odomPOS(2)<<" ";

tests/mnist/test_mnist.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ int main() {
3535

3636
std::cout<<"CUDNN inference:\n"; {
3737
dim.print(); //print initial dimension
38-
TIMER_START
38+
TKDNN_TSTART
3939
out_data = net.infer(dim, data);
40-
TIMER_STOP
40+
TKDNN_TSTOP
4141
dim.print();
4242
}
4343

@@ -49,9 +49,9 @@ int main() {
4949

5050
std::cout<<"TENSORRT inference:\n"; {
5151
dim2.print();
52-
TIMER_START
52+
TKDNN_TSTART
5353
out_data2 = netRT.infer(dim2, data);
54-
TIMER_STOP
54+
TKDNN_TSTOP
5555
dim2.print();
5656
}
5757

tests/mnist/test_mnistRT.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ int main() {
4949

5050
// Inference
5151
{
52-
TIMER_START
52+
TKDNN_TSTART
5353
data = net.infer(dim, data);
54-
TIMER_STOP
54+
TKDNN_TSTOP
5555
dim.print();
5656
}
5757

@@ -157,9 +157,9 @@ int main() {
157157
{
158158
checkCuda(cudaMemcpyAsync(buffers[inputIndex], input_h, 1 * 28*28* sizeof(float), cudaMemcpyHostToDevice, stream));
159159
cudaStreamSynchronize(stream); //want to test only the inference time
160-
TIMER_START
160+
TKDNN_TSTART
161161
context->enqueue(1, buffers, stream, nullptr);
162-
TIMER_STOP
162+
TKDNN_TSTOP
163163
checkCuda(cudaMemcpyAsync(output, buffers[outputIndex],10*sizeof(float), cudaMemcpyDeviceToHost, stream));
164164
cudaStreamSynchronize(stream);
165165
}

tests/mobilenet/bdd-mobilenetv2ssd/bdd-mobilenetv2ssd.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -477,9 +477,9 @@ int main()
477477
printCenteredTitle(" CUDNN inference ", '=', 30);
478478
{
479479
dim1.print();
480-
TIMER_START
480+
TKDNN_TSTART
481481
net.infer(dim1, data);
482-
TIMER_STOP
482+
TKDNN_TSTOP
483483
dim1.print();
484484
}
485485

@@ -492,9 +492,9 @@ int main()
492492
printCenteredTitle(" TENSORRT inference ", '=', 30);
493493
{
494494
dim2.print();
495-
TIMER_START
495+
TKDNN_TSTART
496496
netRT.infer(dim2, data);
497-
TIMER_STOP
497+
TKDNN_TSTOP
498498
dim2.print();
499499
}
500500

tests/mobilenet/mobilenetv2ssd/mobilenetv2ssd.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -477,9 +477,9 @@ int main()
477477
printCenteredTitle(" CUDNN inference ", '=', 30);
478478
{
479479
dim1.print();
480-
TIMER_START
480+
TKDNN_TSTART
481481
net.infer(dim1, data);
482-
TIMER_STOP
482+
TKDNN_TSTOP
483483
dim1.print();
484484
}
485485

@@ -492,9 +492,9 @@ int main()
492492
printCenteredTitle(" TENSORRT inference ", '=', 30);
493493
{
494494
dim2.print();
495-
TIMER_START
495+
TKDNN_TSTART
496496
netRT.infer(dim2, data);
497-
TIMER_STOP
497+
TKDNN_TSTOP
498498
dim2.print();
499499
}
500500

tests/mobilenet/mobilenetv2ssd512/mobilenetv2ssd512.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -476,9 +476,9 @@ int main()
476476
printCenteredTitle(" CUDNN inference ", '=', 30);
477477
{
478478
dim1.print();
479-
TIMER_START
479+
TKDNN_TSTART
480480
net.infer(dim1, data);
481-
TIMER_STOP
481+
TKDNN_TSTOP
482482
dim1.print();
483483
}
484484

@@ -491,9 +491,9 @@ int main()
491491
printCenteredTitle(" TENSORRT inference ", '=', 30);
492492
{
493493
dim2.print();
494-
TIMER_START
494+
TKDNN_TSTART
495495
netRT.infer(dim2, data);
496-
TIMER_STOP
496+
TKDNN_TSTOP
497497
dim2.print();
498498
}
499499

tests/simple/test_simple.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,18 @@ int main() {
3838
tk::dnn::dataDim_t dim1 = dim; //input dim
3939
printCenteredTitle(" CUDNN inference ", '=', 30); {
4040
dim1.print();
41-
TIMER_START
41+
TKDNN_TSTART
4242
out_data = net.infer(dim1, data);
43-
TIMER_STOP
43+
TKDNN_TSTOP
4444
dim1.print();
4545
}
4646

4747
tk::dnn::dataDim_t dim2 = dim;
4848
printCenteredTitle(" TENSORRT inference ", '=', 30); {
4949
dim2.print();
50-
TIMER_START
50+
TKDNN_TSTART
5151
out_data2 = netRT.infer(dim2, data);
52-
TIMER_STOP
52+
TKDNN_TSTOP
5353
dim2.print();
5454
}
5555

tests/test_rtinference/rtinference.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ int main(int argc, char *argv[]) {
4242
checkCuda(cudaMemcpy(input_d, input, idim.tot()*sizeof(dnnType), cudaMemcpyHostToDevice));
4343

4444
tk::dnn::dataDim_t dim = idim;
45-
TIMER_START
45+
TKDNN_TSTART
4646
netRT.infer(dim, input_d);
47-
TIMER_STOP
47+
TKDNN_TSTOP
4848
total_time+= t_ns;
4949

5050
// control output

0 commit comments

Comments
 (0)