Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On Reinforcement Learning with Python

You're reading from   Hands-On Reinforcement Learning with Python Master reinforcement and deep reinforcement learning using OpenAI Gym and TensorFlow

Arrow left icon
Product type Paperback
Published in Jun 2018
Publisher Packt
ISBN-13 9781788836524
Length 318 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Sudharsan Ravichandiran Sudharsan Ravichandiran
Author Profile Icon Sudharsan Ravichandiran
Sudharsan Ravichandiran
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

Preface 1. Introduction to Reinforcement Learning 2. Getting Started with OpenAI and TensorFlow FREE CHAPTER 3. The Markov Decision Process and Dynamic Programming 4. Gaming with Monte Carlo Methods 5. Temporal Difference Learning 6. Multi-Armed Bandit Problem 7. Deep Learning Fundamentals 8. Atari Games with Deep Q Network 9. Playing Doom with a Deep Recurrent Q Network 10. The Asynchronous Advantage Actor Critic Network 11. Policy Gradients and Optimization 12. Capstone Project – Car Racing Using DQN 13. Recent Advancements and Next Steps 14. Assessments 15. Other Books You May Enjoy

Classifying fashion products using CNN

We will now see how to use CNN for classifying fashion products.

First, we will import our required libraries as usual:

import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

Now, we will read the data. The dataset is available in tensorflow.examples, so we can directly extract the data as follows:

from tensorflow.examples.tutorials.mnist import input_data
fashion_mnist = input_data.read_data_sets('data/fashion/', one_hot=True)

We will check what we have in our data:

print("No of images in training set {}".format(fashion_mnist.train.images.shape))
print("No of labels in training set {}".format(fashion_mnist.train.labels.shape))

print("No of images in test set {}".format(fashion_mnist.test.images.shape))
print("No of labels in test set {}".format(fashion_mnist...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime