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

HALCON如何构建UNet网络模型

[复制链接]
freekun139com 发表于 2024-9-13 08:24:44 | 显示全部楼层 |阅读模式
哪位大佬有用Halcon构造过UNet网络模型指点一下如何对下采样数据进行裁剪
如图中的灰色箭头copy and crop操作,需要裁剪下采样数据再与上采样数据进行拼接,这个裁剪如何实现

UNet.png

奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
 楼主| freekun139com 发表于 2024-9-18 11:03:52 | 显示全部楼层
本帖最后由 freekun139com 于 2024-9-20 11:40 编辑

https://github.com/bubbliiiing/unet-pytorch
参照PyTorch实现搭建分割网络模型, 有兴趣的参考一下
*默认图像大小WHC(512 * 512 * 1)
create_dl_layer_input ('segmentation_image_target', [ImageWidth,ImageHeight,ImageDepth], [], [], DLLayerImageTarget)
create_dl_layer_class_id_conversion (DLLayerImageTarget, 'target_internal', 'from_class_id', [], [], DLLayerTargetInternal)
create_dl_layer_input ('image', [ImageWidth,ImageHeight,ImageDepth], [], [], DLLayerImage)
create_dl_layer_input ('weight_image', [ImageWidth,ImageHeight,ImageDepth], [], [], DLLayerWeight)

**************************************** DW_SAMPLE ****************************************
*下采样第一次操作
*[512, 512, 3, 1] ==> [512, 512, 64, 1]
create_dl_layer_convolution (DLLayerImage, 'dw_sample_block1_conv1', 3, 1, 1, 64, 1, 1, 'relu', ['weight_filler'], ['const'], DLLayerConvolution)
*[512, 512, 64, 1] ==> [512, 512, 64, 1]
create_dl_layer_convolution (DLLayerConvolution, 'dw_sample_block1_conv2', 3, 1, 1, 64, 1, 1, 'relu', ['weight_filler'], ['const'], DLLayerConvolution1)

*下采样第二次操作
*[512, 512, 64, 1] ==> [256, 256, 64, 1]
create_dl_layer_pooling (DLLayerConvolution1, 'dw_sample_block2_pool', 2, 2, 'none', 'maximum', [], [], DLLayerPooling)
*[256, 256, 64, 1] ==> [256, 256, 128, 1]
create_dl_layer_convolution (DLLayerPooling, 'dw_sample_block2_conv1', 3, 1, 1, 128, 1, 1, 'relu', ['weight_filler'], ['const'], DLLayerConvolution2)
*[256, 256, 128, 1] ==> [256, 256, 128, 1]
create_dl_layer_convolution (DLLayerConvolution2, 'dw_sample_block2_conv2', 3, 1, 1, 128, 1, 1, 'relu', ['weight_filler'], ['const'], DLLayerConvolution3)

dl_UNet.hdev

18.25 KB, 下载次数: 4

售价: 1 视觉币  [记录]

奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
wcy123 发表于 2024-10-30 21:00:31 | 显示全部楼层
为什么我构建的unet模型,在后面设置模型参数时就一直报错啊?set_dl_model_param (DLModeHandle, 'image_width', InputWidth)这句,图像大小设置的512×512,我检查了每一层的输出结果,都是正确的大小和通道数,总是出现下面这个错误

HALCON算子错误
当在函数 'main' 中调用 'set_dl_model_param'时.line: 102.

CNN-Graph: Architecture not suitable for the adaption of the image size (HALCON错误代码: 7775)

希望楼主可以帮忙看一下

奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
linlianghe 发表于 2024-10-31 11:20:08 | 显示全部楼层
学习中学习中
奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
 楼主| freekun139com 发表于 2024-11-1 13:22:13 | 显示全部楼层
wcy123 发表于 2024-10-30 21:00
为什么我构建的unet模型,在后面设置模型参数时就一直报错啊?set_dl_model_param (DLModeHandle, 'image_w ...

HALCON版本是哪个,更新到最新试试
我没遇到类似问题,模型构建成功设置属性没遇到过错误
一般设置device的时候gpu内存可能不足,训练过程可能报错
奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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