分割模型
语义分割
1.对图像上的每个像素进行绘制标注类别,其他为BG背景
2.调用hdl模型可得每个像素的类别和每个每个像素是该类别的置信度
dev_get_window (WindowHandle)
*读取神经网络模型
read_dl_model ('C:/Users/zhang/Desktop/MVTecDLT/hdl调用/语义分割药片模型.hdl', DLModelHandle)
*设置模型参数
set_dl_model_param (DLModelHandle, 'runtime', 'cpu')
*获取模型参数
get_dl_model_param(DLModelHandle, 'image_dimensions', ImageDimensions) //获取图像的尺寸224*224*3通道
get_dl_model_param(DLModelHandle, 'class_ids', ClassIDs) //获取ClassIDs,一共5类
get_dl_model_param (DLModelHandle, 'class_names', ClassNames)//获取类别的名字
*从模型里面获取图像前处理参数到字典里
create_dl_preprocess_param_from_model (DLModelHandle, 'none', 'full_domain', [], [], [], DLPreprocessParam)
*读取图像
read_image (Image, 'C:/Users/zhang/Desktop/MVTecDLT/hdl调用/pill/ginseng/contamination/pill_ginseng_contamination_002.png')
*用图像生成一个样本字典
gen_dl_samples_from_images (Image, DLSample)
*对图像的样本字典进行前处理
preprocess_dl_samples (DLSample, DLPreprocessParam)
*对处理后的样本字典送进模型进行推理,得到推理结果
apply_dl_model (DLModelHandle, DLSample, [], DLResult)
* 获取推理数据
get_dict_object (Object, DLResult, 'segmentation_image')
get_dict_object (Object1, DLResult, 'segmentation_confidence')