如何使用具有不同输入形状的批次制作神经网络 [英] How to make a neural network with batches with different input shapes

查看:55
本文介绍了如何使用具有不同输入形状的批次制作神经网络的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想制作一个可以将灰度图像作为输入并输出彩色图像的CNN或FCN.对我来说非常重要的是图像的大小可以变化.我听说只有在制作FCN并以一个尺寸的图像进行批处理而另一个以另一尺寸的图像进行批处理时才可以执行此操作.但是我不知道如何在Tensorflow Keras(Python版本)中提出这个概念,我想知道您是否可以提供一些示例代码或伪代码?我很感激.谢谢!

I want to make a CNN or FCN that can take grayscale images as an input and outputs a color image. It is very important to me that the size of the images can vary. I heard that I can only do this when I make a FCN and take a batch with images of one size and another batch with images of another size. But I don't know how to make this concept in Tensorflow Keras (the Python version) and I was wondering if you could provide some sample code or pseudo code? I appreciate that. Thanks!

推荐答案

我知道您想将它们全部保留为原始大小,但这是不可能的.不过,请不要担心,因为调整大小可以在将图像馈入模型时(在内存中)进行;除非阅读,否则图像永远不会被触摸.

I know you want to keep them all in their original size, but that's not possible. Don't worry, though, because the resizing can take place while the images are being fed into the model (while in memory); the image will never be touched except to be read.

这是一个很好的例子

这篇关于如何使用具有不同输入形状的批次制作神经网络的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆