imaginaire icon indicating copy to clipboard operation
imaginaire copied to clipboard

Resolving cv2.imdecode DeprecationWarning: The binary mode of fromstring is deprecated, as it behaves surprisingly on unicode inputs. Use frombuffer instead

Open kingsj0405 opened this issue 3 years ago • 1 comments

https://github.com/NVlabs/imaginaire/blob/master/imaginaire/datasets/lmdb.py#L66

        # Decode and return.
        if is_image:
            try:
                img = cv2.imdecode(np.fromstring(buf, dtype=dtype), mode)
            except Exception:
                print(path)
            # BGR to RGB if 3 channels.
            if img.ndim == 3 and img.shape[-1] == 3:

This should become

        # Decode and return.
        if is_image:
            try:
                img = cv2.imdecode(np.frombuffer(buf, dtype=dtype), mode)
            except Exception:
                print(path)
            # BGR to RGB if 3 channels.
            if img.ndim == 3 and img.shape[-1] == 3:

kingsj0405 avatar Jul 29 '21 15:07 kingsj0405

Thanks, @kingsj0405 !

@arunmallya Could you address the issue?

mingyuliutw avatar Nov 12 '21 19:11 mingyuliutw