I got Yolo v1 code from https://github.com/lovish1234/YOLOv1 (if adding this link has license issues please contact me)
As far as I know, the code does not contain dropout unlike the Yolo v1 paper. Also according to the original paper, they added a dropout layer with rate=0.5 after the first connected layer to prevent co-adaptation between layers.
So I changed the code as
def build_graph(self):
"""Build the computational graph for the network"""
# Print
if self.verbose:
print('Building Yolo Graph....')
# Reset default graph
tf.reset_default_graph()
# Input placeholder
self.x = tf.placeholder('float32', [None, 448, 448, 3])
self.label_batch = tf.placeholder('float32', [None, 73])
self.keep_prob = tf.placeholder('float32')
# conv1, pool1
self.conv1 = self.conv_layer(1, self.x, 64, 7, 2)
self.pool1 = self.maxpool_layer(2, self.conv1, 2, 2)
# size reduced to 64x112x112
# conv2, pool2
self.conv2 = self.conv_layer(3, self.pool1, 192, 3, 1)
self.pool2 = self.maxpool_layer(4, self.conv2, 2, 2)
# size reduced to 192x56x56
# conv3, conv4, conv5, conv6, pool3
self.conv3 = self.conv_layer(5, self.pool2, 128, 1, 1)
self.conv4 = self.conv_layer(6, self.conv3, 256, 3, 1)
self.conv5 = self.conv_layer(7, self.conv4, 256, 1, 1)
self.conv6 = self.conv_layer(8, self.conv5, 512, 3, 1)
self.pool3 = self.maxpool_layer(9, self.conv6, 2, 2)
# size reduced to 512x28x28
# conv7 - conv16, pool4
self.conv7 = self.conv_layer(10, self.pool3, 256, 1, 1)
self.conv8 = self.conv_layer(11, self.conv7, 512, 3, 1)
self.conv9 = self.conv_layer(12, self.conv8, 256, 1, 1)
self.conv10 = self.conv_layer(13, self.conv9, 512, 3, 1)
self.conv11 = self.conv_layer(14, self.conv10, 256, 1, 1)
self.conv12 = self.conv_layer(15, self.conv11, 512, 3, 1)
self.conv13 = self.conv_layer(16, self.conv12, 256, 1, 1)
self.conv14 = self.conv_layer(17, self.conv13, 512, 3, 1)
self.conv15 = self.conv_layer(18, self.conv14, 512, 1, 1)
self.conv16 = self.conv_layer(19, self.conv15, 1024, 3, 1)
self.pool4 = self.maxpool_layer(20, self.conv16, 2, 2)
# size reduced to 1024x14x14
# conv17 - conv24
self.conv17 = self.conv_layer(21, self.pool4, 512, 1, 1)
self.conv18 = self.conv_layer(22, self.conv17, 1024, 3, 1)
self.conv19 = self.conv_layer(23, self.conv18, 512, 1, 1)
self.conv20 = self.conv_layer(24, self.conv19, 1024, 3, 1)
self.conv21 = self.conv_layer(25, self.conv20, 1024, 3, 1)
self.conv22 = self.conv_layer(26, self.conv21, 1024, 3, 2)
self.conv23 = self.conv_layer(27, self.conv22, 1024, 3, 1)
self.conv24 = self.conv_layer(28, self.conv23, 1024, 3, 1)
# size reduced to 1024x7x7
# fc1, fc2, fc3
self.fc1 = self.fc_layer(29, self.conv24, 512,
flatten=True, linear=False)
self.dropout = tf.nn.dropout(self.fc1, self.keep_prob)
self.fc2 = self.fc_layer(
30, self.dropout, 4096, flatten=False, linear=False)
self.fc3 = self.fc_layer(
31, self.fc2, 1470, flatten=False, linear=True)
I was expecting a positive outcome. But training after adding the dropout decreases it's function. Some doesn't even show the box and for the ones that do, the boxes are wrong and the confidence is lower.
I can't find the reason why I get these results. (My guess is either the trained model includes dropout somewhere or adding dropout layer to a pretrained model decreases it's function.)
This is a important project that I have to do. But I'm a newcomer in Tensorflow. So please forgive me if this was a simple question. Also if someone knows the answer please tell me. Thank you.
Dropout is a hyperparameter; sometimes it helps, sometimes it doesn't. Whether it helps or not depends on other factors such as other hyperparameter values (such as batch size, learning rate, etc) and properties of the dataset.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.