设置首页收藏本站
开启左侧

HDevelop24.11如何获取深度学习模型的预测结果

[复制链接]
lm520203 发表于 2025-3-7 15:36:34 | 显示全部楼层 |阅读模式
HDevelop24.11联合 DL24.12进行深度学习开发时,引入DL导出的语义分割模型,在HDevelop中没有相关算子来获取模型检测的结果,有大神知道该怎么弄嘛
  1. //这是导出的模型文件


  2. PathToPreprocessParamFile := 'C:/Users/18301/Desktop/缺陷检测/model_训练-250219_opt_dl_preprocess_params.hdict'
  3. PathToTrainedModel := 'C:/Users/18301/Desktop/缺陷检测/model_训练-250219_opt.hdl'



  4. //后续代码是这样的,只有显示数据的算子,没有获取数据的算子

  5. read_dict (PathToPreprocessParamFile, [], [], DLPreprocessParam)
  6. read_dl_model (PathToTrainedModel, DLModelHandle)
  7. stop ()
  8. query_available_dl_devices (['runtime', 'runtime'], ['gpu', 'cpu'], DLDeviceHandles)
  9. if (|DLDeviceHandles| == 0)
  10.     throw ('No supported device found to continue this example.')
  11. endif

  12. DLDevice := DLDeviceHandles[0]

  13. BatchSizeInference := 1
  14. set_dl_model_param (DLModelHandle, 'batch_size', BatchSizeInference)

  15. set_dl_model_param (DLModelHandle, 'device', DLDevice)
  16. DLDataInfo := dict{}
  17. get_dl_model_param (DLModelHandle, 'class_names', DLDataInfo.class_names)
  18. get_dl_model_param (DLModelHandle, 'class_ids', DLDataInfo.class_ids)

  19. read_image (Image, 'C:/Users/18301/Desktop/缺陷检测/LAM540B-043#-20250210/Image_20250110002806865.bmp')
  20. dev_display (Image)
  21. gen_dl_samples_from_images (Image, DLSample)
  22. preprocess_dl_samples (DLSample, DLPreprocessParam)
  23. apply_dl_model (DLModelHandle, DLSample, [], DLResult)
  24. WindowHandleDict := dict{}
  25. dev_display_dl_data (DLSample, DLResult, DLDataInfo, 'segmentation_image_result', [], WindowHandleDict)

  26. //
复制代码
奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
x55admin 发表于 2025-3-8 08:46:57 | 显示全部楼层
  1. create_dict (GenParamDisplay)
  2. set_dict_tuple (GenParamDisplay, 'segmentation_exclude_class_ids', 0)
  3. set_dict_tuple (GenParamDisplay, 'segmentation_transparency', '80')
  4. set_dict_tuple (GenParamDisplay, 'font_size', 16)
  5. dev_display_dl_data (DLSampleBatch[SampleIndex], DLResultBatch[SampleIndex], DatasetInfo, 'segmentation_image_result', GenParamDisplay, WindowHandleDict)
  6. get_dict_tuple (WindowHandleDict, 'segmentation_image_result', WindowHandles)
复制代码

接下来应该会了吧
奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
 楼主| lm520203 发表于 2025-3-28 12:48:49 | 显示全部楼层
x55admin 发表于 2025-3-8 08:46
接下来应该会了吧

感谢大神,此前已经琢磨出来啦
奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表