Enlighten me on pruning this Detectron2 model?

username: keremnymn
cooked: <p>Hello,<br>
I’m a teacher who is studying computer vision for months. I was very excited when I was able to train my first object detection model using Detectron2’s Faster R-CNN model. And it works like a charm! Super cool! Thanks PyTorch.</p>
<p>But the problem is that, in order to increase the accuracy, I used <a href="https://github.com/facebookresearch/detectron2/blob/master/configs/COCO-Detection/faster_rcnn_X_101_32x8d_FPN_3x.yaml" rel="noopener nofollow ugc">the largest model</a> in the model zoo.</p>
<p>Now I want to deploy this as something people can use to ease their job. But, the model is so large that it takes ~10 seconds to infer a single image on my CPU which is Intel i7-8750h.</p>
<p>Therefore, it’s really difficult to deploy this model even on a regular cloud server. I need to use either GPU servers or latest model CPU servers which are really expensive and I’m not sure if I can even compensate for server expenses for months.</p>
<p>I need to make it smaller and faster for deployment.</p>
<p>So, yesterday I found that there’s something like pruning the model!! I was very excited (since I’m not a computer or data scientists, don’t blame me (((: )</p>
<p>I read <a href="https://pytorch.org/tutorials/intermediate/pruning_tutorial.html" rel="noopener nofollow ugc">official pruning documentation of PyTorch</a>, but it’s really difficult for me to understand.</p>
<p>I found global pruning is of the easiest one to do. <div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/0/3/034e4bc74cfb7fef657ae39a88f50f48a6405ce7.jpeg" data-download-href="https://discuss.pytorch.org/uploads/default/034e4bc74cfb7fef657ae39a88f50f48a6405ce7" title="Ekran Alıntısı"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/0/3/034e4bc74cfb7fef657ae39a88f50f48a6405ce7_2_690x436.jpeg" alt="Ekran Alıntısı" data-base62-sha1="tfbd8WwzfjEc2xMxIXTozsoPRB" width="690" height="436" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/0/3/034e4bc74cfb7fef657ae39a88f50f48a6405ce7_2_690x436.jpeg, https://discuss.pytorch.org/uploads/default/optimized/3X/0/3/034e4bc74cfb7fef657ae39a88f50f48a6405ce7_2_1035x654.jpeg 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/0/3/034e4bc74cfb7fef657ae39a88f50f48a6405ce7.jpeg 2x" data-dominant-color="F1F2F4"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">Ekran Alıntısı</span><span class="informations">1213×767 85.8 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
<p>But the problem is, I have no idea what parameters should I write to prune.</p>
<p>Like I said, I used Faster R-CNN X-101 model. I have it as “<strong>model_final.pth</strong>”. And it uses <a href="https://github.com/facebookresearch/detectron2/blob/master/configs/Base-RCNN-FPN.yaml" rel="noopener nofollow ugc">Base RCNN FPN.yaml</a> and its meta architecture is “GeneralizedRCNN”.</p>
<p>It seems like an easy configuration to do. But like I said, since it’s not my field it’s very hard for a person like me.</p>
<p>I’d be more than happy if you could help me on this step by step.</p>
<p>I’m leaving my cfg.yaml which I used training the model and I saved it using <a href="https://detectron2.readthedocs.io/modules/config.html#detectron2.config.CfgNode.dump" rel="noopener nofollow ugc">“dump”</a> method in Detectron2 config class just in case. Here’s the <a href="https://drive.google.com/file/d/1H1fAYxRuCFK6LmSYq6lmT4kk8vBJ8vai/view?usp=sharing" rel="noopener nofollow ugc">Drive link.</a></p>
<p>Thank you very much in advance.</p>