title: Assertion 'GDK_IS_DISPLAY (display)' failed - Cannot decide type for the following arguments: data
body: <p>I'm doing a vehicle tracking and counting program. I encounter an error when I try to run this block of code:</p>
  
  <pre><code>import mxnet
  import gluoncv as gcv
  import cv2.cv2 as cv2
  import matplotlib.pyplot as plt
  import math
  import numpy as np
  import gluoncv.data.transforms.image as image
  import time
  
  def main():
      ctx = mxnet.gpu(1)
      # This bunch of codes used to recognise specific classes
  
      classes = ["Motorbike", "Car/Van"]
      net = gcv.model_zoo.get_model("ssd_512_resnet50_v1_voc", pretrained=True, ctx=ctx)
      net.reset_class(classes)
      net.load_parameters("vehicle_best.params")
  
      cap = cv2.VideoCapture("tang2ngay3_10video2.mp4")
      out = cv2.VideoWriter("result_video.mp4", 0x7634706d, 30.0, (910, 512))
  
      frame_number = 0
      counting_point = 750
      nof_vehicle = [0] * len(classes)
      tracks_active = []
      start = time.time()
      while (cap.isOpened()):
  
          ret, frame = cap.read()
  
          if ret == False:
              break
          # if frame_number == 100:
          #     break
  
  
          frame = mxnet.nd.array(frame)
  
          img_tf, _ = gcv.data.transforms.presets.ssd.transform_test(frame, short=512)
          frame = frame.asnumpy().astype('uint8')
          frame = cv2.resize(frame, (910, 512))
  
          class_IDs, scores, detections = net(img_tf.copyto(ctx))
  
          class_IDs = class_IDs.squeeze().asnumpy()
          scores = scores.squeeze().asnumpy()
          detections = detections.squeeze().asnumpy()
  
          predicts = []        
          for idx, det in enumerate(detections):
              xmin, ymin, xmax, ymax = det
              if scores[idx] &gt; 0.5 and xmin + (xmax - xmin) / 2 &lt; counting_point + 10:
              # if scores[idx] &gt; 0.5 and ymin + (ymax - ymin) / 2 &lt; counting_point + 10:
                  predicts.append({"id": class_IDs[idx], "score": scores[idx], "bbox": list(det)})
  
          updated_tracks = []
  
          for obj in tracks_active:
              # update information of vehicle
              if len(predicts) &gt; 0:
  
                  best_match = max(predicts, key=lambda x: iou(obj["bbox"], x["bbox"]))
  
                  if iou(obj["bbox"], best_match["bbox"]) &gt;= 0.5:
                      obj["bbox"] = best_match["bbox"]
                      if best_match["score"] &gt; obj["score"]:
                          obj["score"] = best_match["score"]
                          obj["id"] = best_match["id"]
                      xmin, ymin, xmax, ymax = obj["bbox"]
                      if xmin + (xmax - xmin) / 2 &gt; counting_point and obj["is_counted"] == False: 
                      # if ymin + (ymax - ymin) / 2 &gt; counting_point and obj["is_counted"] == False: 
                          nof_vehicle[int(obj["id"])] += 1
                          obj["is_counted"] = True
                      updated_tracks.append(obj)
                      del predicts[predicts.index(best_match)]
  
          new_objects = [{"id": pred["id"], "score": pred["score"], "bbox": pred["bbox"], "is_counted": False} for pred in predicts]
          tracks_active = updated_tracks + new_objects
          bboxes = []
          ids = []
  
          for track in tracks_active:
              if (track["is_counted"] == False):
                  bboxes.append(track["bbox"])
                  ids.append(int(track["id"]))
  
          bboxes = np.array(bboxes)
          ids = np.array(ids)
          colors = {0: (82, 7, 242), 1: (215, 242, 5)}
  
          frame = gcv.utils.viz.cv_plot_bbox(frame, bboxes, labels=ids, class_names=classes, colors=colors)
  
          frame_number += 1
  
          cv2.line(frame, (counting_point, 0), (counting_point, 512), (0, 255, 0), 2)
          for i in range(len(classes)):
              text = "{} : {:d}".format(classes[i], nof_vehicle[i])
              cv2.putText(frame, text, (10, 20 * (i + 1)), cv2.FONT_HERSHEY_SIMPLEX, 0.6, (0, 0, 0), 1)
          out.write(frame)
      end = time.time()
      print("Total time: {}".format(end - start))
      print("FPS: {}",format(frame_number / (end - start)))
      cap.release()
      out.release()
  
  if __name__ == "__main__":
      main()
  </code></pre>
  
  <p>I'm not sure what the error means.</p>
  
  <pre><code>Unable to init server: Could not connect: Connection refused
  Unable to init server: Could not connect: Connection refused
  
  (vehicle.py:12794): Gdk-CRITICAL **: 08:57:21.070: gdk_cursor_new_for_display: assertion 'GDK_IS_DISPLAY (display)' failed
  /home/hangnguyen/.local/lib/python3.6/site-packages/mxnet/gluon/block.py:1389: UserWarning: Cannot decide type for the following arguments. Consider providing them as input:
          data: None
    input_sym_arg_type = in_param.infer_type()[0]
  terminate called after throwing an instance of 'dmlc::Error'
    what():  [08:57:21] src/ndarray/ndarray.cc:1288: GPU is not enabled
  Stack trace:
    [bt] (0) /home/hangnguyen/.local/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x307d3b) [0x7f365b03dd3b]
    [bt] (1) /home/hangnguyen/.local/lib/python3.6/site-packages/mxnet/libmxnet.so(mxnet::CopyFromTo(mxnet::NDArray const&amp;, mxnet::NDArray const&amp;, int, bool)+0x6db) [0x7f365e31628b]
  </code></pre>
  
  <p>I tried looking it up on google and StackOverflow, but it seems like no one has this error. The closest article I can found is <a href="https://github.com/apache/incubator-mxnet/issues/15281" rel="nofollow noreferrer">this one</a>, but I already have mxnet 1.6 installed. I'm running this code on a remote server, is that the problem?</p>
  
  <p>Could anyone help me out? Thank you so much.</p>