Browse Source
update
Signed-off-by: junjie.jiang <junjie.jiang@zilliz.com>
main
1 changed files with
9 additions and
3 deletions
-
image_decoder.py
|
@ -40,11 +40,17 @@ class ImageDecoder(PyOperator): |
|
|
def __init__(self): |
|
|
def __init__(self): |
|
|
self._nvjpeg = create_pynvjpeg() |
|
|
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 |
|
|
self._nvjpeg = None |
|
|
|
|
|
|
|
|
|
|
|
@property |
|
|
|
|
|
def device(self): |
|
|
|
|
|
if hasattr(self, '_device'): |
|
|
|
|
|
return self._device |
|
|
|
|
|
return -1 |
|
|
|
|
|
|
|
|
def _download_image(self, image_url): |
|
|
def _download_image(self, image_url): |
|
|
image_type = image_url.split('?')[0].split('.')[-1].lower() |
|
|
image_type = image_url.split('?')[0].split('.')[-1].lower() |
|
|
is_jpeg = True if image_type == 'jpeg' or image_type == 'jpg' else False |
|
|
is_jpeg = True if image_type == 'jpeg' or image_type == 'jpg' else False |
|
|