Thanks to visit codestin.com
Credit goes to github.com

Skip to content

NVJPEG error "2" : nvJPEG error (2): Wrong parameter was passed. For example, a null pointer as input data, or an image index not in the allowed range. #6026

@CoinCheung

Description

@CoinCheung

Version

1.51.2

Describe the bug.

Here is the image:

Image

Here is code to reproduce:

import numpy as np
from nvidia.dali import pipeline_def
import nvidia.dali.fn as fn
import nvidia.dali.types as types


class ExternalInputCallable:
    def __init__(self):
        pass

    def __call__(self, sample_info):
        sample_idx = sample_info.idx_in_epoch
        if sample_idx >= 1000:
            # Indicate end of the epoch
            raise StopIteration()

        with open('./n03287733_3194.JPEG', 'rb') as fr:
            encoded_img = np.frombuffer(fr.read(), dtype=np.uint8)
        return encoded_img, np.array(sample_idx)


@pipeline_def(
    batch_size=1, num_threads=1, device_id=0, py_num_workers=1
)
def loader_pipeline():
    jpegs, inds = fn.external_source(
        source=ExternalInputCallable(),
        num_outputs=2,
        batch=False,
        parallel=True,
        dtype=[types.UINT8, types.INT64],
    )
    decode = fn.decoders.image(jpegs, device="mixed")
    return decode, inds



pipe = loader_pipeline()
pipe.start_py_workers()
pipe.build()


for i in range(10):
    with warnings.catch_warnings():
        warnings.simplefilter('error')
        try:
            one_out = pipe.run()
            img = np.array(one_out[0][0].as_cpu())
            ind = np.array(one_out[1][0])
        except Exception as e:
            print(i, ': ', str(e))

Relevant log output

/opt/dali/dali/operators/decoder/nvjpeg/nvjpeg_decoder_decoupled_api.h:1070] NVJPEG error "2" : nvJPEG error (2): Wrong parameter was passed. For example, a null pointer as input data, or an image index not in the allowed range.

Other/Misc.

No response

Check for duplicates

  • I have searched the open bugs/issues and have found no duplicates for this bug report

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions