title: How to increase FPS on YOLOv3
body: <p>I'm a newbie in DL/Real Time Object Detection area and trying to learn some stuff from Youtube. Now my problem is I'm trained a model for real time object detection with using yolov3 in google colabrotary. Now I have <code>yolov3_training_last.weights</code>  <code>yolov3_testing.cfg</code>  <code>classes.txt</code> files for real time object detection. I'm using a python file for it but it gives me 2-3 fps while using my laptop camera. Is there any way to imporve my fps? I'm thinking its using my CPU for real time feed. How can I switch it to GPU? As I said I'm newbie in this area if there is any way, can you explain me how can I do it. If not can you tell me alternative ways to training a model for real time object detection please? I will be appreciated if you can help me. Thanks in advance...</p>
  <p>My GPU: GTX1650</p>
  <p>My CPU: Intel Core i7 9750H</p>
  <p>My python file here:</p>
  <pre><code>import cv2
  import numpy as np
  
  net = cv2.dnn.readNet('yolov3_training_last.weights', 'yolov3_testing.cfg')
  
  classes = []
  with open(&quot;classes.txt&quot;, &quot;r&quot;) as f:
      classes = f.read().splitlines()
  
  cap = cv2.VideoCapture(0)
  font = cv2.FONT_HERSHEY_PLAIN
  colors = np.random.uniform(0, 255, size=(100, 3))
  
  while True:
      _, img = cap.read()
      height, width, _ = img.shape
  
      blob = cv2.dnn.blobFromImage(img, 1/255, (416, 416), (0,0,0), swapRB=True, crop=False)
      net.setInput(blob)
      output_layers_names = net.getUnconnectedOutLayersNames()
      layerOutputs = net.forward(output_layers_names)
  
      boxes = []
      confidences = []
      class_ids = []
  
      for output in layerOutputs:
          for detection in output:
              scores = detection[5:]
              class_id = np.argmax(scores)
              confidence = scores[class_id]
              if confidence &gt; 0.2:
                  center_x = int(detection[0]*width)
                  center_y = int(detection[1]*height)
                  w = int(detection[2]*width)
                  h = int(detection[3]*height)
  
                  x = int(center_x - w/2)
                  y = int(center_y - h/2)
  
                  boxes.append([x, y, w, h])
                  confidences.append((float(confidence)))
                  class_ids.append(class_id)
  
      indexes = cv2.dnn.NMSBoxes(boxes, confidences, 0.2, 0.4)
  
      if len(indexes)&gt;0:
          for i in indexes.flatten():
              x, y, w, h = boxes[i]
              label = str(classes[class_ids[i]])
              confidence = str(round(confidences[i],2))
              color = colors[i]
              cv2.rectangle(img, (x,y), (x+w, y+h), color, 2)
              cv2.putText(img, label + &quot; &quot; + confidence, (x, y+20), font, 2, (255,255,255), 2)
  
      cv2.imshow('Image', img)
      key = cv2.waitKey(1)
      if key==27:
          break
  
  cap.release()
  cv2.destroyAllWindows()
  </code></pre>