代码拉取完成,页面将自动刷新
tf.io.decode_image(
contents,
channels=None,
dtype=tf.dtypes.uint8,
name=None,
expand_animations=True
)
For more information, see tf.io.decode_image.
class mindspore.dataset.vision.Decode(
to_pil=False
)
For more information, see mindspore.dataset.vision.Decode.
TensorFlow: Decode the raw image bytes into an image with the specified number of channels and data type. It supports decoding GIF images.
MindSpore: Decode the raw image bytes into a RGB image, to_pil
decides that whether output in PIL format or NumPy Format.
# The following implements Decode with MindSpore.
import numpy as np
import mindspore.dataset as ds
image = np.fromfile("/tmp/file.jpg", dtype=np.uint8)
result = ds.vision.Decode()(image)
# The following implements decode_image with TensorFlow.
import tensorflow as tf
raw = tf.io.read_file("/tmp/file.jpg")
result = tf.io.decode_image(raw, channels=3)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。