Added init_cpu() function to init CPU just to speedup the 1st detection (if GPU=0)

This commit is contained in:
AlexeyAB 2019-11-25 18:10:39 +03:00
parent dd4dcf20b4
commit 48914023da
5 changed files with 16 additions and 2 deletions

View File

@ -144,6 +144,8 @@ if hasGPU:
set_gpu = lib.cuda_set_device set_gpu = lib.cuda_set_device
set_gpu.argtypes = [c_int] set_gpu.argtypes = [c_int]
init_cpu = lib.init_cpu
make_image = lib.make_image make_image = lib.make_image
make_image.argtypes = [c_int, c_int, c_int] make_image.argtypes = [c_int, c_int, c_int]
make_image.restype = IMAGE make_image.restype = IMAGE

View File

@ -144,6 +144,8 @@ if hasGPU:
set_gpu = lib.cuda_set_device set_gpu = lib.cuda_set_device
set_gpu.argtypes = [c_int] set_gpu.argtypes = [c_int]
init_cpu = lib.init_cpu
make_image = lib.make_image make_image = lib.make_image
make_image.argtypes = [c_int, c_int, c_int] make_image.argtypes = [c_int, c_int, c_int]
make_image.restype = IMAGE make_image.restype = IMAGE

View File

@ -921,6 +921,9 @@ void stop_timer_and_show();
void stop_timer_and_show_name(char *name); void stop_timer_and_show_name(char *name);
void show_total_time(); void show_total_time();
// gemm.h
LIB_API void init_cpu();
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif // __cplusplus #endif // __cplusplus

View File

@ -2855,3 +2855,10 @@ int test_gpu_blas()
return 0; return 0;
} }
#endif #endif
void init_cpu() {
is_avx();
is_fma_avx2();
}

View File

@ -379,7 +379,7 @@ layer parse_yolo(list *options, size_params params)
iou_loss, l.iou_loss, l.iou_normalizer, l.cls_normalizer, l.scale_x_y); iou_loss, l.iou_loss, l.iou_normalizer, l.cls_normalizer, l.scale_x_y);
l.beta_nms = option_find_float_quiet(options, "beta_nms", 0.6); l.beta_nms = option_find_float_quiet(options, "beta_nms", 0.6);
char *nms_kind = option_find_str(options, "nms_kind", "default"); char *nms_kind = option_find_str_quiet(options, "nms_kind", "default");
if (strcmp(nms_kind, "default") == 0) l.nms_kind = DEFAULT_NMS; if (strcmp(nms_kind, "default") == 0) l.nms_kind = DEFAULT_NMS;
else { else {
if (strcmp(nms_kind, "greedynms") == 0) l.nms_kind = GREEDY_NMS; if (strcmp(nms_kind, "greedynms") == 0) l.nms_kind = GREEDY_NMS;
@ -469,7 +469,7 @@ layer parse_gaussian_yolo(list *options, size_params params) // Gaussian_YOLOv3
else l.iou_loss = IOU; else l.iou_loss = IOU;
l.beta_nms = option_find_float_quiet(options, "beta_nms", 0.6); l.beta_nms = option_find_float_quiet(options, "beta_nms", 0.6);
char *nms_kind = option_find_str(options, "nms_kind", "default"); char *nms_kind = option_find_str_quiet(options, "nms_kind", "default");
if (strcmp(nms_kind, "default") == 0) l.nms_kind = DEFAULT_NMS; if (strcmp(nms_kind, "default") == 0) l.nms_kind = DEFAULT_NMS;
else { else {
if (strcmp(nms_kind, "greedynms") == 0) l.nms_kind = GREEDY_NMS; if (strcmp(nms_kind, "greedynms") == 0) l.nms_kind = GREEDY_NMS;