title: TypeError: Unsupported type <type 'numpy.ndarray'>
body: <p>I needed to run some parts of the code in GPU using <code>cupy</code> instead of <code>numpy</code>. So, I only made comment out for this line <code># import numpy as np</code> and used this line instead of it <code>import cupy as np</code></p>
  
  <p>the full code:</p>
  
  <pre><code>from imutils.video import VideoStream
  from imutils.video import FPS
  # import numpy as np
  import cupy as np
  import argparse
  import imutils
  import time
  import cv2
  net = cv2.dnn.readNetFromCaffe('prototxt.txt', 'caffemodel')
  vs = cv2.VideoCapture(0)
  vs.release()
  vs = cv2.VideoCapture(0)
  time.sleep(2.0)
  fps = FPS().start()
  while True:
      ret, frame = vs.read()  # add ret,
      frame = imutils.resize(frame, width=400)
      (h, w) = frame.shape[:2]
      blob = cv2.dnn.blobFromImage(cv2.resize(frame, (300, 300)),0.007843, (300, 300), 127.5)
      net.setInput(blob)
      detections = net.forward()
      big_area = 0
      big_center = 320
      detected = 0
      for i in np.arange(0, detections.shape[2]):
          confidence = detections[0, 0, i, 2]
          object_type = int(detections[0, 0, i, 1])
          if object_type == 15 and confidence &gt; 0.2:
              box = detections[0, 0, i, 3:7] * np.array([w, h, w, h])
              (startX, startY, endX, endY) = box.astype("int")
              label = "{}: {:.2f}%".format('person', confidence * 100)
              cv2.rectangle(frame, (startX, startY), (endX, endY), [0, 0, 255], 2)
              y = startY - 15 if startY - 15 &gt; 15 else startY + 15
              cv2.putText(frame, label, (startX, y), cv2.FONT_HERSHEY_SIMPLEX, 0.5, [0, 0, 255], 2)
              rect_area = (endX - startX) * (endY - startY)
              detected = 1
              if rect_area &gt; big_area:
                  big_area = rect_area
      cv2.imshow("Frame", frame)
      key = cv2.waitKey(1) &amp; 0xFF
      if key == ord("q"):
          break
  vs.release()
  cv2.destroyAllWindows()
  </code></pre>
  
  <p>how to fix this error so that use cupy.</p>
  
  <pre><code>/home/redhwan/learn1.py:26: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
    confidence = detections[0, 0, i, 2]
  /home/redhwan/learn1.py:27: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
    object_type = int(detections[0, 0, i, 1])
  /home/redhwan/learn1.py:29: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
    box = detections[0, 0, i, 3:7] * np.array([w, h, w, h])
  Traceback (most recent call last):
    File "/home/redhwan/learn1.py", line 29, in &lt;module&gt;
      box = detections[0, 0, i, 3:7] * np.array([w, h, w, h])
    File "cupy/core/core.pyx", line 940, in cupy.core.core.ndarray.__mul__
    File "cupy/core/_kernel.pyx", line 811, in cupy.core._kernel.ufunc.__call__
    File "cupy/core/_kernel.pyx", line 89, in cupy.core._kernel._preprocess_args
  TypeError: Unsupported type &lt;type 'numpy.ndarray'&gt;
  </code></pre>
  
  <p>data <a href="https://github.com/jakelarsen17/TurtleBot-Follow-Person" rel="nofollow noreferrer">here</a></p>
  
  <p>please, your ideas or any suggestions?</p>