Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
in img.imdecode,when py3 check buf param,if it is str,convert it to b…
Browse files Browse the repository at this point in the history
…ytes.
  • Loading branch information
yajiedesign committed Apr 26, 2018
1 parent 8727cae commit a872b87
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions python/mxnet/image/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import random
import logging
import json
import sys

import numpy as np

try:
Expand Down Expand Up @@ -133,6 +135,9 @@ def imdecode(buf, *args, **kwargs):
"""
if not isinstance(buf, nd.NDArray):
buf = nd.array(np.frombuffer(buf, dtype=np.uint8), dtype=np.uint8)
if sys.version_info[0] == 3:
if isinstance(buf, str):
buf = bytes(buf)
return _internal._cvimdecode(buf, *args, **kwargs)


Expand Down

0 comments on commit a872b87

Please sign in to comment.