logo
Browse Source

update

Signed-off-by: junjie.jiang <junjie.jiang@zilliz.com>
main
junjie.jiang 2 years ago
parent
commit
54041911da
  1. 12
      image_decoder.py

12
image_decoder.py

@ -40,11 +40,17 @@ class ImageDecoder(PyOperator):
def __init__(self):
self._nvjpeg = create_pynvjpeg()
def to_device(self, device):
if self._nvjpeg is not None:
if not self._nvjpeg.bind_device(device):
def to_device(self):
if self._nvjpeg is not None and self.device >= 0:
if not self._nvjpeg.bind_device(self.device):
self._nvjpeg = None
@property
def device(self):
if hasattr(self, '_device'):
return self._device
return -1
def _download_image(self, image_url):
image_type = image_url.split('?')[0].split('.')[-1].lower()
is_jpeg = True if image_type == 'jpeg' or image_type == 'jpg' else False

Loading…
Cancel
Save