2019赛季RM中部分区赛,自瞄和能量机关,完整稳定版。
This commit is contained in:
2
tools/TrainCNN/backward.py
Executable file → Normal file
2
tools/TrainCNN/backward.py
Executable file → Normal file
@@ -75,7 +75,7 @@ def train(dataset, show_bar=False):
|
||||
learning_rate = tf.train.exponential_decay(
|
||||
LEARNING_RATE_BASE,
|
||||
global_step,
|
||||
len(dataset.train_samples) / BATCH / 5,
|
||||
len(dataset.train_samples) / BATCH,
|
||||
LEARNING_RATE_DECAY,
|
||||
staircase=False)
|
||||
train_step = tf.train.AdamOptimizer(learning_rate).minimize(loss, global_step=global_step)
|
||||
|
||||
@@ -71,16 +71,14 @@ def forward(x, regularizer=None):
|
||||
pool_shape = pool2.get_shape().as_list()
|
||||
node = pool_shape[1] * pool_shape[2] * pool_shape[3]
|
||||
reshaped = tf.reshape(pool2, [-1, node])
|
||||
# reshaped = tf.nn.dropout(reshaped, 0.1)
|
||||
|
||||
fc1_w = get_weight([node, FC1_OUTPUT_NODES], regularizer)
|
||||
fc1_w = tf.nn.dropout(get_weight([node, FC1_OUTPUT_NODES], regularizer), 0.1)
|
||||
fc1_b = get_bias([FC1_OUTPUT_NODES])
|
||||
fc1 = tf.nn.relu(tf.matmul(reshaped, fc1_w) + fc1_b)
|
||||
# fc1 = tf.nn.dropout(fc1, 0.2)
|
||||
vars.extend([fc1_w, fc1_b])
|
||||
nodes.extend([fc1])
|
||||
|
||||
fc2_w = get_weight([FC1_OUTPUT_NODES, FC2_OUTPUT_NODES], regularizer)
|
||||
fc2_w = tf.nn.dropout(get_weight([FC1_OUTPUT_NODES, FC2_OUTPUT_NODES], regularizer), 0.1)
|
||||
fc2_b = get_bias([FC2_OUTPUT_NODES])
|
||||
fc2 = tf.nn.softmax(tf.matmul(fc1, fc2_w) + fc2_b)
|
||||
vars.extend([fc2_w, fc2_b])
|
||||
|
||||
@@ -41,13 +41,6 @@ class DataSet:
|
||||
|
||||
def generate_data_sets(self, folder):
|
||||
sets = []
|
||||
mini = 1000000
|
||||
for i in range(OUTPUT_NODES):
|
||||
dir = "%s/%d" % (folder, i)
|
||||
files = os.listdir(dir)
|
||||
if mini > len(files):
|
||||
mini = len(files)
|
||||
|
||||
for i in range(OUTPUT_NODES):
|
||||
dir = "%s/%d" % (folder, i)
|
||||
files = os.listdir(dir)
|
||||
|
||||
Reference in New Issue
Block a user