tensorflow中load图像

def load_image(img_path,size = (32,32)):
    label = tf.constant(1,tf.int8) if tf.strings.regex_full_match(img_path,".*/automobile/.*") \
            else tf.constant(0,tf.int8)
    img = tf.io.read_file(img_path)
    img = tf.image.decode_jpeg(img) #注意此处为jpeg格式
    img = tf.image.resize(img,size)/255.0
    return(img,label)

ds_train = tf.data.Dataset.list_files("/content/drive/My Drive/eat_tf2_in_30_days_code/data/cifar2/train/*/*.jpg") \
           .map(load_image, num_parallel_calls=tf.data.experimental.AUTOTUNE) \
           .shuffle(buffer_size = 1000).batch(BATCH_SIZE) \
           .prefetch(tf.data.experimental.AUTOTUNE) 
  • 这里的buffer_size是采样池的大小,ds_train包含图片和标签
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Key Features, Learn advanced techniques in deep learning with this example-rich guide on Google's brainchildExplore various neural networks with the help of this comprehensive guideAdvanced guide on machine learning techniques, in particular TensorFlow for deep learning., Book Description, Deep learning is the next step after machine learning. It is machine learning but with a more advanced implementation. As machine learning is no longer an academic topic, but a mainstream practice, deep learning has taken a front seat. With deep learning being used by many data scientists, deeper neural networks are evaluated for accurate results. Data scientists want to explore data abstraction layers and this book will be their guide on this journey. This book evaluates common, and not so common, deep neural networks and shows how these can be exploited in the real world with complex raw data using TensorFlow., The book will take you through an understanding of the current machine learning landscape then delve into TensorFlow and how to use it by considering various data sets and use cases. Throughout the chapters, you'll learn how to implement various deep learning algorithms for your machine learning systems and integrate them into your product offerings such as search, image recognition, and language processing. Additionally, we'll examine its performance by optimizing it with respect to its various parameters, comparing it against benchmarks along with teaching machines to learn from the information and determine the ideal behavior within a specific context, in order to maximize its performance., After finishing the book, you will be familiar with machine learning techniques, in particular TensorFlow for deep learning, and will be ready to apply some of your knowledge in a real project either in a research or commercial setting., What you will learn, Provide an overview of the machine learning landscapeLook at the historical development and progress of deep learningDescribe TensorFlow and become very familiar with it both in theory and in practiceAccess public datasets and use TF to load, process, clean, and transform dataUse TensorFlow on real-world data sets including images and textGet familiar with TensorFlow by applying it in various hands on exercises using the command lineEvaluate the performance of your deep learning modelsQuickly teach machines to learn from data by exploring reinforcement learning techniques.Understand how this technology is being used in the real world by exploring active areas of deep learning research and application.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值