Tensorflow 如何改进深度神经网络以处理较大的输入图像?
我正在尝试使用深度神经网络检测图像上的路标(基于): 它对小图像(32 x 32px)的效果非常好,但我想改进我的网络,以处理背景、角落等有路标的大图像(500 x 500px或更大,如果可能)。尝试使用shape=[None,500,500,3]运行此代码会杀死我的计算机:) 我正在考虑这种方式(伪代码):Tensorflow 如何改进深度神经网络以处理较大的输入图像?,tensorflow,neural-network,deep-learning,image-recognition,Tensorflow,Neural Network,Deep Learning,Image Recognition,我正在尝试使用深度神经网络检测图像上的路标(基于): 它对小图像(32 x 32px)的效果非常好,但我想改进我的网络,以处理背景、角落等有路标的大图像(500 x 500px或更大,如果可能)。尝试使用shape=[None,500,500,3]运行此代码会杀死我的计算机:) 我正在考虑这种方式(伪代码): SIZE\u GOOD\u ough=32 def try_detect(图像): 如果图像太小(图像):#宽度时图像太小 返回FALSE#或高度
SIZE\u GOOD\u ough=32
def try_detect(图像):
如果图像太小(图像):#宽度时图像太小
返回FALSE#或高度
…或类似的东西,但我还是希望有更大的尺寸足够好,因为一些调整尺寸的路标即使对我来说也很难识别。是否有任何方法可以改进我的网络以更好地处理(例如)200 x 200px图像?对我来说更好意味着“不要杀死我的GPU”,结果的准确度仍然大于0.9。也许我的conv_2d/max_pool_2d没有被很好地选择?如果有任何建议,我将不胜感激。为了减少GPU内存使用,您可以在网络开始时进一步减小要素地图的空间大小。为了训练更大的网络,需要一个4G或更多内存的GPU,或者几个GPU
另一点,我假设32x32的示例以道路标志为中心,而500x500的图像是道路场景,而不仅仅是标志。在这种情况下,你最好做一些类似于物体检测的事情 谢谢你的回答。我找到了这个链接:使用你的建议,这看起来是解决我所有问题的简单方法!:)
dataset_file = [path_to_dataset_file]
X, Y = image_preloader(dataset_file, image_shape=(32, 32), mode='file',
categorical_labels=True, normalize=True)
X, Y = shuffle(X, Y)
network = input_data(shape=[None, 32, 32, 3])
network = conv_2d(network, 32, 3, activation='relu')
network = max_pool_2d(network, 2)
network = conv_2d(network, 64, 3, activation='relu')
network = conv_2d(network, 64, 3, activation='relu')
network = fully_connected(network, 512, activation='relu')
network = dropout(network, 0.5)
network = fully_connected(network, 2, activation='softmax')
network = regression(network)
model = tflearn.DNN(network, tensorboard_verbose=0)
model.fit(X, Y, n_epoch=1000, show_metric=True)
SIZE_GOOD_ENOUGH = 32
def try_detect(image):
if image_too_small(image): # image is too small when width
return FALSE # or height < SIZE_GOOD_ENOUGH
resized_image = image.resize_to(SIZE_GOOD_ENOUGH, SIZE_GOOD_ENOUGH)
result = detect_with_DNN(resized_image) # returns TRUE if detected
if result:
return TRUE
smaller_images_list = cut_into_pieces(image) # list of smaller images
for smaller_image in smaller_images_list:
result = try_detect(smaller_image) # recursion
if result:
return TRUE
return FALSE