我想训练卷积网络输出0到100的数字.但很快,模型就会停止更新权重,只会更改完全连接图层中的偏差.我无法理解为什么.
我玩了不同数量的层等等,但我总是遇到只有FC偏差变化的同样问题.
这是我目前的代码测试.我剥掉了辍学等事情.此时过度拟合不是问题.事实上,我想尝试过度拟合数据,以便我可以看到我的模型可以学到任何东西
from __future__ import print_function
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
###################################################################################
############################# Read Data ###########################################
with tf.name_scope("READ_DATA"):
def read_my_file_format(filename_queue):
reader = tf.WholeFileReader()
key, record_string = reader.read(filename_queue)
split_res = tf.string_split([key],'_')
key = split_res.values[5]
example = tf.image.decode_png(record_string)
example = tf.image.rgb_to_grayscale(example, name=None)
processed_example = resize_img(example)
processed_example = reshape_img(processed_example)
return processed_example, key
def resize_img(imgg):
return tf.image.resize_images(imgg,[102,525])
def reshape_img(imgg):
return tf.reshape(imgg,shape=[102,525,1])
def input_pipeline( bsize=30, num_epochs=None):
filename_queue = tf.train.string_input_producer(
tf.train.match_filenames_once("./png_imgs/*.png"), num_epochs=num_epochs, shuffle=True) …Run Code Online (Sandbox Code Playgroud) python neural-network deep-learning conv-neural-network tensorflow