S.E*_*.EB 1 computer-vision neural-network image-segmentation deep-learning caffe
我已经用 256x256 的固定尺寸图像训练了FCN 模型。我能否请教专家,一旦图像的大小从一张图像变为另一张图像,我该如何训练相同的模型?
我真的很感谢你的建议。谢谢
您可以选择以下策略之一:
通过将每个图像训练为不同的批次,您可以在数据层reshape的forward()(而不是reshape())中设置网络,从而在每次迭代时更改网络。
+reshape在forward方法中写入一次,您不再需要担心输入的形状和大小。
-reshape网络通常需要分配/解除分配 CPU/GPU 内存,因此需要时间。
- 您可能会发现批次中的单个图像太小了。
例如(假设您使用"Python"图层进行输入):
def reshape(self, bottom, top):
pass # you do not reshape here.
def forward(self, bottom, top):
top[0].data.reshape( ... ) # reshape the blob - this will propagate the reshape to the rest of the net at each iteration
top[1].data.reshape( ... ) #
# feed the data to the net
top[0].data[...] = current_img
top[1].data[...] = current_label
Run Code Online (Sandbox Code Playgroud)
您可以决定固定的输入大小,然后随机裁剪所有输入图像(以及相应的基本事实)。
+无需reshape每次迭代(更快)。
+在训练过程中控制模型大小。
- 需要对图片和标签进行随机裁剪
将所有图像调整为相同大小(如在 SSD 中)。
+简单
- 如果并非所有图像都具有相同的纵横比,图像就会失真。
- 你对缩放没有不变性
| 归档时间: |
|
| 查看次数: |
1282 次 |
| 最近记录: |