5int smp_change_cpu_device(
const char* model_name,
const char* img_name)
13 INT n_target_device = 2;
22 ret = fnFIE_load_img_file(img_name, &hsrc, F_COLOR_IMG_TYPE_UC8);
23 printf_s(
"img: %d\r\n", ret);
24 if (F_ERR_NONE != ret) {
goto finally; }
28 printf_s(
"lic : %d\r\n", ret);
32 if (NULL == hmodel) { printf_s(
"failed to create handle\r\n"); }
33 else { printf_s(
"handle created\r\n"); }
36 for(
auto i_device=0; i_device<n_target_device; i_device++)
38 OV_DEVICE device = target_devices[i_device];
39 std::chrono::system_clock::time_point start, end;
43 printf_s(
"set device=%s", device);
45 if (F_ERR_NONE != ret) { printf_s(
"device set error=%d\r\n", ret);
goto finally; }
49 if (F_ERR_NONE != ret) { printf_s(
"load error=%d\r\n", ret);
goto finally; }
53 printf_s(
"par : %d category=%d\r\n", ret, model_category);
56 switch (model_category)
67 start = std::chrono::system_clock::now();
73 end = std::chrono::system_clock::now();
75 if (NULL != scores) { fnOAL_free(scores); }
82 FHANDLE *hsrcs = NULL;
88 if (F_ERR_NONE != ret) { printf_s(
"get how many view error=%d\r\n", ret);
goto finally; }
89 hsrcs = (FHANDLE*)fnOAL_calloc(
sizeof(FHANDLE), n_views);
90 for (
auto i_view = 0; i_view < n_views; i_view++) { hsrcs[i_view] = hsrc; }
93 start = std::chrono::system_clock::now();
99 end = std::chrono::system_clock::now();
101 if (NULL != hsrcs) { fnOAL_free(hsrcs); }
102 if (NULL != scores) { fnOAL_free(scores); }
107 FHANDLE hdst = fnFIE_img_root_alloc(F_IMG_US16, 1, fnFIE_img_get_width(hsrc), fnFIE_img_get_height(hsrc));
110 start = std::chrono::system_clock::now();
116 end = std::chrono::system_clock::now();
118 if (NULL != hdst) { fnFIE_free_object(hdst); }
126 elapsed = std::chrono::duration_cast<std::chrono::microseconds>(end - start).count() / (double)1000;
127 printf_s(
"%.3e [msec]\r\n", elapsed);
132 if (NULL != hsrc) { fnFIE_free_object(hsrc); }
138int smp_save_optimized_model(
const char* original_model_name,
const char* save_model_name)
140 INT ret = F_ERR_NONE;
148 printf_s(
"lic : %d\r\n", ret);
154 if (NULL == hmodel) { printf_s(
"failed to create handle\r\n");
goto finally; }
155 else { printf_s(
"handle created\r\n"); }
159 std::chrono::system_clock::time_point start, end;
163 start = std::chrono::system_clock::now();
169 end = std::chrono::system_clock::now();
172 elapsed = std::chrono::duration_cast<std::chrono::microseconds>(end - start).count() / (double)1000;
175 printf_s(
"load time ( original ) = %.3e msec ( return code = %d )\r\n", elapsed, ret);
176 if (F_ERR_NONE != ret) {
goto finally; }
181 if (F_ERR_NONE != ret) { printf_s(
"error = %d\r\n", ret);
goto finally; }
185 std::chrono::system_clock::time_point start, end;
189 start = std::chrono::system_clock::now();
195 end = std::chrono::system_clock::now();
198 elapsed = std::chrono::duration_cast<std::chrono::microseconds>(end - start).count() / (double)1000;
201 printf_s(
"load time ( original ) = %.3e msec ( return code = %d )\r\n", elapsed, ret);
202 if (F_ERR_NONE != ret) {
goto finally; }
OV_DEVICE
CPU 推論のデバイス種別
Definition: fv_pdl.h:71
MODEL_CATEGORY
モデルの種別
Definition: fv_pdl.h:46
INT fnPDL_check_license()
ライセンス確認
Definition: check_licence.cpp:158
INT FVALGAPI fnPDL_get_model_category(const H_MODEL hmodel, MODEL_CATEGORY *model_category)
モデルの種別の取得
Definition: prediction_cpp.cpp:1628
INT FVALGAPI fnPDL_get_how_many_views(const H_MODEL hmodel, INT *num_views)
モデルパラメータの取得
Definition: prediction_cpp.cpp:1704
INT FVALGAPI fnPDL_predict_multi_images(const H_MODEL hmodel, INT num_images, FHANDLE *hsrcs, FLOAT **scores, size_t *num_scores)
推論の実行 ( 多視点画像分類、多視点アノマリー検出 )
Definition: prediction_cpp.cpp:1937
VOID FVALGAPI fnPDL_dispose(H_MODEL hmodel)
モデルハンドルの解放
Definition: prediction_cpp.cpp:2110
INT FVALGAPI fnPDL_predict(const H_MODEL hmodel, const FHANDLE hsrc, FLOAT **scores, size_t *num_scores)
推論の実行
Definition: prediction_cpp.cpp:1881
INT FVALGAPI fnPDL_load_model(const CHAR *filename, H_MODEL hmodel)
モデルの読み込み
Definition: prediction_cpp.cpp:1501
INT FVALGAPI fnPDL_set_cpu_device(H_MODEL hmodel, OV_DEVICE cpu_device)
CPU 推論デバイスの設定
Definition: prediction_cpp.cpp:1474
INT FVALGAPI fnPDL_predict_segmentation(const H_MODEL hmodel, const FHANDLE hsrc, FHANDLE hdst)
推論の実行 ( セグメンテーション )
Definition: prediction_cpp.cpp:1989
VOID * H_MODEL
モデルハンドル
Definition: fv_pdl.h:18
INT FVALGAPI fnPDL_save_optimized_model(const CHAR *filename, H_MODEL hmodel)
動作環境に最適化されたモデルの保存
Definition: prediction_cpp.cpp:1534
H_MODEL *FVALGAPI fnPDL_create_handle()
モデルハンドルの生成
Definition: prediction_cpp.cpp:1446
@ OV_DEVICE_CPU
Definition: fv_pdl.h:73
@ OV_DEVICE_GPU
Definition: fv_pdl.h:75
@ MULTI_VIEW_AD
Definition: fv_pdl.h:56
@ UNKNOWN
Definition: fv_pdl.h:48
@ SEMANTIC_SEGMENTATION
Definition: fv_pdl.h:58
@ CLASSIFICATION
Definition: fv_pdl.h:50
@ ANOMALY_DETECTION
Definition: fv_pdl.h:52
@ MULTI_VIEW_CNN
Definition: fv_pdl.h:54