image-processing - Keras、图像配准、全卷积网络
问题描述
我正在做图像配准,主要是找出 60x60 图像在较大的 74x74 图像上的位置。图像是不同的模式 - 一个是视觉的,另一个是 IR - 所以简单的匹配(openCV - matchTemplate)或其他技术(如互信息)不起作用。所以我正在尝试一个完全卷积的连体网络。(最后有两个参考 - 但都没有来源。)
我希望网络的连体部分在结构/权重方面相同,以便识别的特征具有可比性。我的挑战是“完全卷积”部分。从最新论文“受益于完全卷积结构,我们能够为左右分支提供不同大小的输入图像块”。
问题 - 全卷积网络是如何做到的?我该如何修复我的代码? 我想要什么/我得到什么
代码:
def convUnit(model,nFilters,strides=1):
model.add(Conv2D(nFilters, padding="same", kernel_size=(3, 3), strides=strides))
model.add(BatchNormalization(epsilon=0.0001, scale=False, center=False))
model.add(Lambda(K.relu))
def getL2(): # From 'hardnet', w/ minor modes
model = Sequential()
model.add(Conv2D(32, padding="same", kernel_size=(3, 3), input_shape=(dimT,dimT,1)))
model.add(BatchNormalization(epsilon=0.0001, scale=False, center=False))
model.add(Lambda(K.relu))
convUnit(model,32)
convUnit(model,64,strides=2)
convUnit(model,64)
convUnit(model,128,strides=2)
convUnit(model,128,strides=2
model.add(Conv2D(128, kernel_size=(8,8)))
model.add(BatchNormalization(epsilon=0.0001, scale=False, center=False))
return model # of size 1,1,128
def createNewModel():
model = getL2() # One model for images
left_unk = Input(shape=(None,None,1))
right_unk = Input(shape=(None,None,1))
encode_L = model(left_unk)
encode_R = model(right_unk)
# Combine - options include 1x1 Conv (per paper), dot product,
# some matmul, ...
#m2 = Dot( 3 )([encode_L, encode_R]) # not sure of axes here - tried combos
siamese_net = Model([left_unk,right_unk],m2)
return siamese_net
结果: 当我运行一个简单的预测时,点积失败了......
In[0].dim(1) and In[1].dim(1) must be the same: [1,1,1,128] vs [1,3,3,128] on node dot_11/MatMul
谢谢!
参考文献: - Zhang, et al, Registration of Multi-Modal Remote Sensing Image based on Deep Fully Convolutional Neural Network
解决方案
推荐阅读
- reactjs - 向 PWA 的 API 平台公开 Next.js 环境变量
- javascript - Apollo 客户端和过滤查询
- ios - 错误:IOS版本代码属性必须是整数并且必须设置
- javascript - 无论系列是否切换,我如何始终保持所有 YAXIS 可见
- angular - Laravel + Angular api 无法正常工作?
- discord.js - 这个消息是什么意思?我怎样才能删除它?
- ios - UIStackView 中的动画隐藏子视图超出屏幕
- python - 将dict(具有整数值)转换为json
- ionic-framework - Ionic HttpClient 正在发送 GET 请求而不是 POST
- java - 单击项目时将数据从 RecyclerView 传递到 Fragment