Autore Topic: Train Loss & Learning rate (on YOLOv2 )  (Letto 110 volte)

0 Utenti e 1 Visitatore stanno visualizzando questo topic.

Ruggero Respigo

  • Visitatore
Train Loss & Learning rate (on YOLOv2 )
« Risposta #1 il: Giugno 07, 2018, 11:45:12 am »
Advertisement
Train Loss & Learning rate (on YOLOv2 )

    During training any deep learning model, it is vital to look at the loss in order to get some intuition about how network (detector, classifier and etc.) is learning. For example, if you look at the Figure below, training loss for people detector that I am training already stopped decreasing even if it is … Continue reading Train Loss & Learning rate (on YOLOv2 )

 


Credit to Standford cs231n course

 



During training any deep learning model, it is vital to look at the loss in order to get some intuition about how network (detector, classifier and etc.) is learning. For example, if you look at the Figure below, training loss for people detector that I am training already stopped decreasing even if it is only in the initial stages of the training. Usually, in the initial stages, it is common to see a loss decreasing very fast and smoothly.  Since that is not a case here, we can conclude that something is wrong here with Learning-Rate. Learning rate is the parameter that decides how big step network should take when searching for an optimal solution.


biglearningrateproblem
Figure1

If your learning rate is big for your task(dataset) then the case something like below happens. Here network cannot make the small change that is needed to optimize because provided learning rate is too big.


So the loss function that varies a lot and does not decrease is an indication that our learning rate is big. For the training setting above my learning rate was learning_rate=0.0001  . 


Let’s see what would happen if we increase learning rate 3x  (learning_rate=0.0003). Okay, let’s see what our loss function looks like when we have 3x bigger learning_rate (Figure 2).


3xlearning_rate
Figure2: Loss Function for the same architecture as above but 3x bigger learning_rate (learning_rate=0.0003)

Oh boy, that doesn’t look good, does it?  After 160 iterations it starts increasing and then later until 200 iteration network tries to go back to track to – search for the parameters that would minimize loss, but because of too big learning_rate it fails and loss starts increasing again after 200 iterations (Figure 2).


At around 290 iterations there is no point to continue because loss is going towards +infinity (Figure 3)


3xlearning_rate_original
Figure 3: Loss Function for the same architecture as in Figure 1 but 3x bigger learning rate (learning_rate=0.0003)

Takeaway lesson is: when you have slightly large learning_rate for your dataset/task then you see your loss will stop decreasing in the beginning of the training (Figure 1). But if you give too big learning_rate you will have a problem where your loss starts increasing instead of decreasing (Figure2, Figure3).


As we said above the problem in in Figure 1 was big learning rate, so to show you the big learning_rate problem, we tried 3x larger learning rate and see the loss in Figure 2 and Figure 3. Here in Figure 4 you see the the loss function when we provide 3x smaller learning rate compared initial learning_rate (learning_rate=0.0001). Our new learning_rate becomes new learning_rate = 1/3*0.0001 and when we train our network with this learning_rate we see stable loss decrease in the Figure 4 compared to in Figure 1. 3xsmaller_learning_rate.png


In practice, I will try 3-5 learning rate (for example 0.001,0.001*3,0.001*3*3,0.001*3*3). Train for about 1000 iterations, compare their loss, and choose the best learning rate to use during the whole training.


That concludes our explanation about Loss and Learning rate. BTW, the reason I am decreasing or increasing learning_rate by the factors of 3 is because it is  a rule of thumb in machine learning when searching for the right learning_rate to increase or decrease the learning_rate by factor of 3.


Source: Train Loss & Learning rate (on YOLOv2 )



 

Related Topics

  Oggetto / Aperto da Risposte Ultimo post
0 Risposte
188 Visite
Ultimo post Marzo 17, 2018, 02:26:01 pm
da Ruggero Respigo
0 Risposte
45 Visite
Ultimo post Febbraio 05, 2019, 04:05:05 am
da Flavio58
0 Risposte
74 Visite
Ultimo post Marzo 01, 2019, 10:07:08 am
da Flavio58
0 Risposte
10 Visite
Ultimo post Giugno 26, 2019, 04:10:38 pm
da Flavio58
0 Risposte
15 Visite
Ultimo post Giugno 30, 2019, 12:08:15 am
da Flavio58

Sitemap 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326