Hello everybody,
i want to use a Pytorch Image Tensor for an ObjectDetector.detect_object_in_image() (from Nvidia/Dope) and need it as Opencv Image. But everything I try crashes… like the following":
  File "test2.py", line 1844, in <module>
    _runnetwork(epoch, testingdata, train=False)
  File "test2.py", line 1809, in _runnetwork
    config_detect
  File "/home/nils/catkin_ws/src/dope/src/inference/detector.py", line 263, in detect_object_in_image
    image_tensor = transform(in_img)
  File "/home/nils/catkin_ws/local/lib/python2.7/site-packages/torchvision/transforms/transforms.py", line 49, in __call__
    img = t(img)
  File "/home/nils/catkin_ws/local/lib/python2.7/site-packages/torchvision/transforms/transforms.py", line 76, in __call__
    return F.to_tensor(pic)
  File "/home/nils/catkin_ws/local/lib/python2.7/site-packages/torchvision/transforms/functional.py", line 44, in to_tensor
    raise TypeError('pic should be PIL Image or ndarray. Got {}'.format(type(pic)))
TypeError: pic should be PIL Image or ndarray. Got <class 'torch.Tensor'>

Traceback (most recent call last):
  File "test2.py", line 1844, in <module>
    _runnetwork(epoch, testingdata, train=False)
  File "test2.py", line 1802, in _runnetwork
    rgb_image = pil2tensor(img)           # rgb_image = pil2tensor(images['img'])
  File "/home/user/catkin_ws/local/lib/python2.7/site-packages/torchvision/transforms/transforms.py", line 76, in __call__
    return F.to_tensor(pic)
  File "/home/user/catkin_ws/local/lib/python2.7/site-packages/torchvision/transforms/functional.py", line 44, in to_tensor
    raise TypeError('pic should be PIL Image or ndarray. Got {}'.format(type(pic)))
TypeError: pic should be PIL Image or ndarray. Got <type 'numpy.ndarray'>