【发布时间】:2018-01-31 22:01:42
【问题描述】:
我正在尝试使用深度神经网络检测图像上的路标(基于the tflearn example):
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)
它适用于小图像(32 x 32 像素)非常好,但我想改进我的网络以处理更大的图像(500 x 500 像素或更大,如果可能的话),在背景、角落等有路标. 尝试使用 shape=[None, 500, 500, 3] 运行此代码杀死了我的计算机 :)
我正在考虑这种方式(伪代码):
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
...或类似的东西,但我仍然想要更大的 SIZE_GOOD_ENOUGH,因为一些调整大小的路标即使对我来说也很难识别。有什么方法可以改善我的网络以更好地处理(例如)200 x 200 像素的图像?对我来说更好的意思是“不要杀死我的 GPU”,并且仍然以 > 0.9 的精度获得结果。也许我的 conv_2d/max_pool_2d 没有很好地选择?如有任何建议,我将不胜感激。
【问题讨论】:
标签: tensorflow neural-network deep-learning image-recognition