Skip to content

Commit ecbd78a

Browse files
authored
Remove debug code (#266)
* Rename Frontend to ModelFormat in documents * Remove useless debug flag
1 parent 82f0d2b commit ecbd78a

File tree

15 files changed

+0
-224
lines changed

15 files changed

+0
-224
lines changed

CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ option(ORT_DIRECTORY "User can specify the installed onnxruntime directory.")
5555

5656
# Please don't open this flag now, some bugs exists.
5757
# option(ENABLE_OPENCV_CUDA "Whether to enable opencv with cuda, this will allow process image with GPU." OFF)
58-
option(ENABLE_DEBUG "Whether to enable print debug information, this may reduce performance." OFF)
5958

6059
# Whether to build fastdeply with vision/text/... examples, only for testings.
6160
option(BUILD_EXAMPLES "Whether to build fastdeply with vision examples" OFF)
@@ -90,9 +89,6 @@ if(WIN32 AND ENABLE_VISION)
9089
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
9190
endif()
9291

93-
if(ENABLE_DEBUG)
94-
add_definitions(-DFASTDEPLOY_DEBUG)
95-
endif()
9692
if(NOT CUDA_DIRECTORY)
9793
set(CUDA_DIRECTORY "/usr/local/cuda")
9894
endif()

fastdeploy/core/config.h.in

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
// limitations under the License.
1414
#pragma once
1515

16-
#ifndef FASTDEPLOY_DEBUG
17-
#cmakedefine FASTDEPLOY_DEBUG
18-
#endif
19-
2016
#ifndef FASTDEPLOY_LIB
2117
#cmakedefine FASTDEPLOY_LIB
2218
#endif

fastdeploy/fastdeploy_model.cc

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -200,18 +200,4 @@ std::map<std::string, float> FastDeployModel::PrintStatisInfoOfRuntime() {
200200
statis_info_of_runtime_dict["iterations"] = time_of_runtime_.size();
201201
return statis_info_of_runtime_dict;
202202
}
203-
204-
void FastDeployModel::EnableDebug() {
205-
#ifdef FASTDEPLOY_DEBUG
206-
debug_ = true;
207-
#else
208-
FDWARNING << "The compile FastDeploy is not with -DENABLE_DEBUG=ON, so "
209-
"cannot enable debug mode."
210-
<< std::endl;
211-
debug_ = false;
212-
#endif
213-
}
214-
215-
bool FastDeployModel::DebugEnabled() { return debug_; }
216-
217203
} // namespace fastdeploy

fastdeploy/fastdeploy_model.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,30 +54,15 @@ class FASTDEPLOY_DECL FastDeployModel {
5454
}
5555

5656
virtual std::map<std::string, float> PrintStatisInfoOfRuntime();
57-
virtual void EnableDebug();
58-
virtual bool DebugEnabled();
5957

6058
private:
6159
std::unique_ptr<Runtime> runtime_;
6260
bool runtime_initialized_ = false;
6361
// whether to record inference time
6462
bool enable_record_time_of_runtime_ = false;
65-
bool debug_ = false;
6663

6764
// record inference time for backend
6865
std::vector<double> time_of_runtime_;
6966
};
7067

71-
#define TIMERECORD_START(id) \
72-
TimeCounter tc_##id; \
73-
tc_##id.Start();
74-
75-
#define TIMERECORD_END(id, prefix) \
76-
if (DebugEnabled()) { \
77-
tc_##id.End(); \
78-
FDLogger() << __FILE__ << "(" << __LINE__ << "):" << __FUNCTION__ << " " \
79-
<< prefix << " duration = " << tc_##id.Duration() << "s." \
80-
<< std::endl; \
81-
}
82-
8368
} // namespace fastdeploy

fastdeploy/vision/detection/contrib/nanodet_plus.cc

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,6 @@ bool NanoDetPlus::Postprocess(
302302

303303
bool NanoDetPlus::Predict(cv::Mat* im, DetectionResult* result,
304304
float conf_threshold, float nms_iou_threshold) {
305-
#ifdef FASTDEPLOY_DEBUG
306-
TIMERECORD_START(0)
307-
#endif
308-
309305
Mat mat(*im);
310306
std::vector<FDTensor> input_tensors(1);
311307

@@ -322,31 +318,18 @@ bool NanoDetPlus::Predict(cv::Mat* im, DetectionResult* result,
322318
return false;
323319
}
324320

325-
#ifdef FASTDEPLOY_DEBUG
326-
TIMERECORD_END(0, "Preprocess")
327-
TIMERECORD_START(1)
328-
#endif
329-
330321
input_tensors[0].name = InputInfoOfRuntime(0).name;
331322
std::vector<FDTensor> output_tensors;
332323
if (!Infer(input_tensors, &output_tensors)) {
333324
FDERROR << "Failed to inference." << std::endl;
334325
return false;
335326
}
336-
#ifdef FASTDEPLOY_DEBUG
337-
TIMERECORD_END(1, "Inference")
338-
TIMERECORD_START(2)
339-
#endif
340327

341328
if (!Postprocess(output_tensors[0], result, im_info, conf_threshold,
342329
nms_iou_threshold)) {
343330
FDERROR << "Failed to post process." << std::endl;
344331
return false;
345332
}
346-
347-
#ifdef FASTDEPLOY_DEBUG
348-
TIMERECORD_END(2, "Postprocess")
349-
#endif
350333
return true;
351334
}
352335

fastdeploy/vision/detection/contrib/yolov5.cc

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,6 @@ bool YOLOv5::Postprocess(
256256

257257
bool YOLOv5::Predict(cv::Mat* im, DetectionResult* result, float conf_threshold,
258258
float nms_iou_threshold) {
259-
#ifdef FASTDEPLOY_DEBUG
260-
TIMERECORD_START(0)
261-
#endif
262259

263260
Mat mat(*im);
264261
std::vector<FDTensor> input_tensors(1);
@@ -272,31 +269,18 @@ bool YOLOv5::Predict(cv::Mat* im, DetectionResult* result, float conf_threshold,
272269
return false;
273270
}
274271

275-
#ifdef FASTDEPLOY_DEBUG
276-
TIMERECORD_END(0, "Preprocess")
277-
TIMERECORD_START(1)
278-
#endif
279-
280272
input_tensors[0].name = InputInfoOfRuntime(0).name;
281273
std::vector<FDTensor> output_tensors;
282274
if (!Infer(input_tensors, &output_tensors)) {
283275
FDERROR << "Failed to inference." << std::endl;
284276
return false;
285277
}
286-
#ifdef FASTDEPLOY_DEBUG
287-
TIMERECORD_END(1, "Inference")
288-
TIMERECORD_START(2)
289-
#endif
290278

291279
if (!Postprocess(output_tensors, result, im_info, conf_threshold,
292280
nms_iou_threshold, multi_label_)) {
293281
FDERROR << "Failed to post process." << std::endl;
294282
return false;
295283
}
296-
297-
#ifdef FASTDEPLOY_DEBUG
298-
TIMERECORD_END(2, "Postprocess")
299-
#endif
300284
return true;
301285
}
302286

fastdeploy/vision/detection/contrib/yolov5lite.cc

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,6 @@ bool YOLOv5Lite::Postprocess(
339339

340340
bool YOLOv5Lite::Predict(cv::Mat* im, DetectionResult* result,
341341
float conf_threshold, float nms_iou_threshold) {
342-
#ifdef FASTDEPLOY_DEBUG
343-
TIMERECORD_START(0)
344-
#endif
345342
Mat mat(*im);
346343
std::vector<FDTensor> input_tensors(1);
347344

@@ -358,21 +355,12 @@ bool YOLOv5Lite::Predict(cv::Mat* im, DetectionResult* result,
358355
return false;
359356
}
360357

361-
#ifdef FASTDEPLOY_DEBUG
362-
TIMERECORD_END(0, "Preprocess")
363-
TIMERECORD_START(1)
364-
#endif
365-
366358
input_tensors[0].name = InputInfoOfRuntime(0).name;
367359
std::vector<FDTensor> output_tensors;
368360
if (!Infer(input_tensors, &output_tensors)) {
369361
FDERROR << "Failed to inference." << std::endl;
370362
return false;
371363
}
372-
#ifdef FASTDEPLOY_DEBUG
373-
TIMERECORD_END(1, "Inference")
374-
TIMERECORD_START(2)
375-
#endif
376364

377365
if (is_decode_exported) {
378366
if (!Postprocess(output_tensors[0], result, im_info, conf_threshold,
@@ -387,10 +375,6 @@ bool YOLOv5Lite::Predict(cv::Mat* im, DetectionResult* result,
387375
return false;
388376
}
389377
}
390-
391-
#ifdef FASTDEPLOY_DEBUG
392-
TIMERECORD_END(2, "Postprocess")
393-
#endif
394378
return true;
395379
}
396380

fastdeploy/vision/detection/contrib/yolov6.cc

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,6 @@ bool YOLOv6::Postprocess(
214214

215215
bool YOLOv6::Predict(cv::Mat* im, DetectionResult* result, float conf_threshold,
216216
float nms_iou_threshold) {
217-
#ifdef FASTDEPLOY_DEBUG
218-
TIMERECORD_START(0)
219-
#endif
220-
221217
Mat mat(*im);
222218
std::vector<FDTensor> input_tensors(1);
223219

@@ -234,31 +230,18 @@ bool YOLOv6::Predict(cv::Mat* im, DetectionResult* result, float conf_threshold,
234230
return false;
235231
}
236232

237-
#ifdef FASTDEPLOY_DEBUG
238-
TIMERECORD_END(0, "Preprocess")
239-
TIMERECORD_START(1)
240-
#endif
241-
242233
input_tensors[0].name = InputInfoOfRuntime(0).name;
243234
std::vector<FDTensor> output_tensors;
244235
if (!Infer(input_tensors, &output_tensors)) {
245236
FDERROR << "Failed to inference." << std::endl;
246237
return false;
247238
}
248-
#ifdef FASTDEPLOY_DEBUG
249-
TIMERECORD_END(1, "Inference")
250-
TIMERECORD_START(2)
251-
#endif
252239

253240
if (!Postprocess(output_tensors[0], result, im_info, conf_threshold,
254241
nms_iou_threshold)) {
255242
FDERROR << "Failed to post process." << std::endl;
256243
return false;
257244
}
258-
259-
#ifdef FASTDEPLOY_DEBUG
260-
TIMERECORD_END(2, "Postprocess")
261-
#endif
262245
return true;
263246
}
264247

fastdeploy/vision/detection/contrib/yolox.cc

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,6 @@ bool YOLOX::PostprocessWithDecode(
279279

280280
bool YOLOX::Predict(cv::Mat* im, DetectionResult* result, float conf_threshold,
281281
float nms_iou_threshold) {
282-
#ifdef FASTDEPLOY_DEBUG
283-
TIMERECORD_START(0)
284-
#endif
285-
286282
Mat mat(*im);
287283
std::vector<FDTensor> input_tensors(1);
288284

@@ -299,21 +295,12 @@ bool YOLOX::Predict(cv::Mat* im, DetectionResult* result, float conf_threshold,
299295
return false;
300296
}
301297

302-
#ifdef FASTDEPLOY_DEBUG
303-
TIMERECORD_END(0, "Preprocess")
304-
TIMERECORD_START(1)
305-
#endif
306-
307298
input_tensors[0].name = InputInfoOfRuntime(0).name;
308299
std::vector<FDTensor> output_tensors;
309300
if (!Infer(input_tensors, &output_tensors)) {
310301
FDERROR << "Failed to inference." << std::endl;
311302
return false;
312303
}
313-
#ifdef FASTDEPLOY_DEBUG
314-
TIMERECORD_END(1, "Inference")
315-
TIMERECORD_START(2)
316-
#endif
317304

318305
if (is_decode_exported) {
319306
if (!Postprocess(output_tensors[0], result, im_info, conf_threshold,
@@ -328,10 +315,6 @@ bool YOLOX::Predict(cv::Mat* im, DetectionResult* result, float conf_threshold,
328315
return false;
329316
}
330317
}
331-
332-
#ifdef FASTDEPLOY_DEBUG
333-
TIMERECORD_END(2, "Postprocess")
334-
#endif
335318
return true;
336319
}
337320

fastdeploy/vision/facedet/contrib/retinaface.cc

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,6 @@ bool RetinaFace::Postprocess(
257257

258258
bool RetinaFace::Predict(cv::Mat* im, FaceDetectionResult* result,
259259
float conf_threshold, float nms_iou_threshold) {
260-
#ifdef FASTDEPLOY_DEBUG
261-
TIMERECORD_START(0)
262-
#endif
263-
264260
Mat mat(*im);
265261
std::vector<FDTensor> input_tensors(1);
266262

@@ -277,31 +273,18 @@ bool RetinaFace::Predict(cv::Mat* im, FaceDetectionResult* result,
277273
return false;
278274
}
279275

280-
#ifdef FASTDEPLOY_DEBUG
281-
TIMERECORD_END(0, "Preprocess")
282-
TIMERECORD_START(1)
283-
#endif
284-
285276
input_tensors[0].name = InputInfoOfRuntime(0).name;
286277
std::vector<FDTensor> output_tensors;
287278
if (!Infer(input_tensors, &output_tensors)) {
288279
FDERROR << "Failed to inference." << std::endl;
289280
return false;
290281
}
291-
#ifdef FASTDEPLOY_DEBUG
292-
TIMERECORD_END(1, "Inference")
293-
TIMERECORD_START(2)
294-
#endif
295282

296283
if (!Postprocess(output_tensors, result, im_info, conf_threshold,
297284
nms_iou_threshold)) {
298285
FDERROR << "Failed to post process." << std::endl;
299286
return false;
300287
}
301-
302-
#ifdef FASTDEPLOY_DEBUG
303-
TIMERECORD_END(2, "Postprocess")
304-
#endif
305288
return true;
306289
}
307290

fastdeploy/vision/facedet/contrib/scrfd.cc

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,6 @@ bool SCRFD::Postprocess(
318318

319319
bool SCRFD::Predict(cv::Mat* im, FaceDetectionResult* result,
320320
float conf_threshold, float nms_iou_threshold) {
321-
#ifdef FASTDEPLOY_DEBUG
322-
TIMERECORD_START(0)
323-
#endif
324321
Mat mat(*im);
325322
std::vector<FDTensor> input_tensors(1);
326323

@@ -337,31 +334,18 @@ bool SCRFD::Predict(cv::Mat* im, FaceDetectionResult* result,
337334
return false;
338335
}
339336

340-
#ifdef FASTDEPLOY_DEBUG
341-
TIMERECORD_END(0, "Preprocess")
342-
TIMERECORD_START(1)
343-
#endif
344-
345337
input_tensors[0].name = InputInfoOfRuntime(0).name;
346338
std::vector<FDTensor> output_tensors;
347339
if (!Infer(input_tensors, &output_tensors)) {
348340
FDERROR << "Failed to inference." << std::endl;
349341
return false;
350342
}
351-
#ifdef FASTDEPLOY_DEBUG
352-
TIMERECORD_END(1, "Inference")
353-
TIMERECORD_START(2)
354-
#endif
355343

356344
if (!Postprocess(output_tensors, result, im_info, conf_threshold,
357345
nms_iou_threshold)) {
358346
FDERROR << "Failed to post process." << std::endl;
359347
return false;
360348
}
361-
362-
#ifdef FASTDEPLOY_DEBUG
363-
TIMERECORD_END(2, "Postprocess")
364-
#endif
365349
return true;
366350
}
367351

0 commit comments

Comments
 (0)