0
点赞
收藏
分享

微信扫一扫

Nacos和Eureka有什么区别

pipu 2024-05-04 阅读 14

文章目录

深度学习标注

在这里插入图片描述>
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

训练

在这里插入图片描述

推理

推理代码示例

* 获取文件图像路径包含合格和不合格图像
list_files ('C:/Users/Administrator/AppData/Roaming/MVTec/HALCON-23.11-Progress/examples/images/juice_bottle/logical_anomaly', ['files','follow_links'], ImageFiles)
tuple_regexp_select (ImageFiles, ['\\.(tif|tiff|gif|bmp|jpg|jpeg|jp2|png|pcx|pgm|ppm|pbm|xwd|ima|hobj)$','ignore_case'], ImageFiles)

* 读取模型
read_dl_model (TrainedModel, DLModelHandle)
* 设置硬件
 query_available_dl_devices (['runtime', 'runtime', 'id'], ['gpu', 'cpu', 0], DLDeviceHandles)
 set_dl_model_param (DLModelHandle, 'device', DLDeviceHandles[0])

* 创建预处理参数
create_dl_preprocess_param_from_model (DLModelHandle, 'none', 'full_domain', [], [], [], DLPreprocessParam)
* 获取模型参数
get_dl_model_param(DLModelHandle,'meta_data',MetaData)
* 异常值分类阈值
ClassificationThreshold := number(MetaData.anomaly_classification_threshold)
SegmentationThreshold := number(MetaData.anomaly_segmentation_threshold)
* 
* Create a dictionary with dataset parameters used for display.
DLDatasetInfo := dict{class_names: ['ok', 'nok'], class_ids: [0, 1]}
* 
* Apply the model to test images.
WindowDict := dict{}
for IndexInference := 0 to |ImageFiles| - 1 by 1
    * 
    read_image (Image, ImageFiles[IndexInference])
    gen_dl_samples_from_images (Image, DLSample)
    * 获取预处理参数
    preprocess_dl_samples (DLSample, DLPreprocessParam)
    * 分类检测
    apply_dl_model (DLModelHandle, DLSample, [], DLResult)
    * 
    *阈值处理
    threshold_dl_anomaly_results (SegmentationThreshold, ClassificationThreshold, DLResult)
    * 显示结果
    dev_display_dl_data (DLSample, DLResult, DLDatasetInfo, ['anomaly_result', 'anomaly_image'], [], WindowDict)
    dev_disp_text ('Press F5 (continue)', 'window', 'bottom', 'center', 'black', [], [])
    stop ()
endfor
dev_close_window_dict (WindowDict)
return ()
举报

相关推荐

0 条评论