Book Image

Neural Network Projects with Python

By : James Loy
Book Image

Neural Network Projects with Python

By: James Loy

Overview of this book

Neural networks are at the core of recent AI advances, providing some of the best resolutions to many real-world problems, including image recognition, medical diagnosis, text analysis, and more. This book goes through some basic neural network and deep learning concepts, as well as some popular libraries in Python for implementing them. It contains practical demonstrations of neural networks in domains such as fare prediction, image classification, sentiment analysis, and more. In each case, the book provides a problem statement, the specific neural network architecture required to tackle that problem, the reasoning behind the algorithm used, and the associated Python code to implement the solution from scratch. In the process, you will gain hands-on experience with using popular Python libraries such as Keras to build and train your own neural networks from scratch. By the end of this book, you will have mastered the different neural network architectures and created cutting-edge AI projects in Python that will immediately strengthen your machine learning portfolio.
Table of Contents (10 chapters)

To get the most out of this book

You should have some basic familiarity with programming in Python in order to get the most out of this book. Nevertheless, the book will take you through every step in the project and explain the code as much as possible.

In terms of hardware, you should be running the code on a fairly modern computer with at least 8 GB of RAM and 15 GB of hard disk space (for the datasets). Training deep neural networks requires strong computational resources, and can be sped up significantly if you have a dedicated GPU. However, it is perfectly fine to run the code without a GPU, as well (such as on a laptop). Throughout the book, we will alert you if certain code will take some time to run if you do not have a GPU.

At the start of each chapter, we will inform you of the necessary Python libraries required for the project. To simplify the set-up process, we have provided an environment.yml file together with the code. The environment.yml file allows you to easily set up a virtual environment with the specific Python version and the requisite libraries installed in it. This way, you can be assured that your code will be running in a standardized virtual environment that we have designed. Detailed instructions will be provided in Chapter 1, Machine Learning and Neural Networks 101, under the Setting up your computer for machine learning section, as well as at the start of each chapter.

Download the example code files

You can download the example code files for this book from your account at www.packt.com. If you purchased this book elsewhere, you can visit www.packt.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at www.packt.com.
  2. Select the SUPPORT tab.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows
  • Zipeg/iZip/UnRarX for Mac
  • 7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Neural-Network-Projects-with-Python. In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "We apply the detect_faces function that we defined earlier on these images."

A block of code is set as follows:

def detect_faces(img, draw_box=True):
# convert image to grayscale
grayscale_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

Any command-line input or output is written as follows:

$ cd Neural-Network-Projects-with-Python

Bold: Indicates a new term, an important word, or words that you see on screen. For example, words in menus or dialog boxes appear in the text like this.

Warnings or important notes appear like this.
Tips and tricks appear like this.