title: How to transfer learning or fine tune YOLOv4-darknet with freeze some layers?
body: <p>I'm a beginner in object detection field.</p>
  <p>First, I followed YOLOv4 custom-train from <a href="https://www.youtube.com/watch?v=mmj3nxGT2YQ" rel="nofollow noreferrer">here</a>, I have successfully followed the tutorial. Then I started to think that if I have a new task which is similar to YOLOv4 pre-trained (which using COCO 80 classes) and I have only small dataset size, then I think it would be great if I can fine tune the model (unfreeze only the last layer) to keep or even to increase the detector performance by using only small &amp; similar dataset. <a href="https://towardsdatascience.com/transfer-learning-from-pre-trained-models-f2393f124751" rel="nofollow noreferrer">This reference</a> seems to legitimate my thought about the fine-tuning I wanted to do.</p>
  <p>Then I go to Alexey github <a href="https://github.com/AlexeyAB/darknet#yolo-v4-v3-and-v2-for-windows-and-linux" rel="nofollow noreferrer">here</a> to check how to freeze layers, and found that I should use <code>stopbackward=1</code>. It says that</p>
  <blockquote>
  <p>&quot;...set param stopbackward=1 for layer-136 in cfg-file&quot;</p>
  </blockquote>
  <p>But I have no idea about where is &quot;layer-136&quot; in the cfg-file <a href="https://github.com/AlexeyAB/darknet/blob/master/cfg/yolov4-custom.cfg" rel="nofollow noreferrer">here</a> and also I have no idea where to put <code>stopbackward=1</code> if I only want to unfreeze the last layer (with freezing all the other layers). So to summarize my questions.</p>
  <ol>
  <li>Where (in which line) to put <code>stopbackward=1</code> in the yolov4-custom.cfg if I want to unfreeze last layer and freeze the other layers?</li>
  <li>What is &quot;layer-136&quot; which mentioned in Alexey github reference? (is it one of the classifier layer? or else?)</li>
  <li>In which line of yolov4-custom.cfg should I put the <code>stopbackward=1</code> for that layer-136?</li>
  </ol>
  <p>Any further information from you is really appreciated. Please advise.</p>
  <p>Thank you in advance.</p>
  <p>Regards,
  Sona</p>