How to speed up the running speed of pytorch model

wowdeeply: <p>Now, I want to use a relatively low-performance machine (without GPU) to complete real-time face recognition tasks.</p>
<p>At present, I have used OpenCV to complete the facial image reading through the camera and detect the position of the face.</p>
<p>Then in the next step, I want to cut the detected face and input it into the model.<br>
However, at present, the model does not run very fast and cannot complete real-time tasks.</p>
<p>What should I do?</p>
<p><em>What I think of is to convert the Pytorch model to NumPy, and then use Numda to accelerate.</em><br>
<em>Is this method feasible? If it is feasible, how to convert the model to numpy and use it?</em></p>
<p>Thanks for any help.</p>

temi92: <aside class="quote no-group" data-username="wowdeeply" data-post="1" data-topic="121118">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/wowdeeply/48/38236_2.png" class="avatar"> wowdeeply:</div>
<blockquote>
<p><em>o convert the Pytorch model to NumPy, and then use Numda to accelerate.</em><br>
<em>Is this method feasible? If it is feasible, how to convert the model to numpy and use it?</em></p>
</blockquote>
</aside>
<p>does the bottle neck come from the face detection or the classification pipeline?<br>
you might benefit from a network that does it all at once<br>
see</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://github.com/timesler/facenet-pytorch">
  <header class="source">
      <img src="https://github.githubassets.com/favicons/favicon.svg" class="site-icon" width="32" height="32">

      <a href="https://github.com/timesler/facenet-pytorch" target="_blank" rel="noopener nofollow ugc">GitHub</a>
  </header>

  <article class="onebox-body">
    <div class="aspect-image" style="--aspect-ratio:690/344;"><img src="https://opengraph.githubassets.com/823ff083f63d66da293796b6010a2267217495f2cdc04cb0bb642bd3e6fa23c5/timesler/facenet-pytorch" class="thumbnail" width="690" height="345"></div>

<h3><a href="https://github.com/timesler/facenet-pytorch" target="_blank" rel="noopener nofollow ugc">GitHub - timesler/facenet-pytorch: Pretrained Pytorch face detection (MTCNN)...</a></h3>

  <p>Pretrained Pytorch face detection (MTCNN) and facial recognition (InceptionResnet) models - GitHub - timesler/facenet-pytorch: Pretrained Pytorch face detection (MTCNN) and facial recognition (Ince...</p>


  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>


wowdeeply: <aside class="quote no-group" data-username="temi92" data-post="2" data-topic="121118">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/temi92/48/38193_2.png" class="avatar"> temi92:</div>
<blockquote>
<p>does the bottle neck come from the face detection or the classification pipeline?</p>
</blockquote>
</aside>
<p>I think it should be the part of face classification.</p>
<aside class="quote no-group" data-username="temi92" data-post="2" data-topic="121118">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/temi92/48/38193_2.png" class="avatar"> temi92:</div>
<blockquote>
<p>you might benefit from a network that does it all at once</p>
</blockquote>
</aside>
<p>Thanks for your help.</p>