You are on page 1of 54

Deep Learning with Applications Using

Python Chatbots and Face, Object, and


Speech Recognition With TensorFlow
and Keras Springerlink (Online Service)
Visit to download the full and correct content document:
https://textbookfull.com/product/deep-learning-with-applications-using-python-chatbot
s-and-face-object-and-speech-recognition-with-tensorflow-and-keras-springerlink-onli
ne-service/
More products digital (pdf, epub, mobi) instant
download maybe you interests ...

Deep Learning with Python Develop Deep Learning Models


on Theano and TensorFLow Using Keras Jason Brownlee

https://textbookfull.com/product/deep-learning-with-python-
develop-deep-learning-models-on-theano-and-tensorflow-using-
keras-jason-brownlee/

Deep Learning Projects Using TensorFlow 2: Neural


Network Development with Python and Keras 1st Edition
Vinita Silaparasetty

https://textbookfull.com/product/deep-learning-projects-using-
tensorflow-2-neural-network-development-with-python-and-
keras-1st-edition-vinita-silaparasetty/

Reinforcement Learning: With Open AI, TensorFlow and


Keras Using Python 1st Edition Abhishek Nandy

https://textbookfull.com/product/reinforcement-learning-with-
open-ai-tensorflow-and-keras-using-python-1st-edition-abhishek-
nandy/

Applied Reinforcement Learning with Python: With OpenAI


Gym, Tensorflow, and Keras Beysolow Ii

https://textbookfull.com/product/applied-reinforcement-learning-
with-python-with-openai-gym-tensorflow-and-keras-beysolow-ii/
Beginning Anomaly Detection Using Python-Based Deep
Learning: With Keras and PyTorch Sridhar Alla

https://textbookfull.com/product/beginning-anomaly-detection-
using-python-based-deep-learning-with-keras-and-pytorch-sridhar-
alla/

Computer Vision Using Deep Learning Neural Network


Architectures with Python and Keras 1st Edition Vaibhav
Verdhan

https://textbookfull.com/product/computer-vision-using-deep-
learning-neural-network-architectures-with-python-and-keras-1st-
edition-vaibhav-verdhan/

Biota Grow 2C gather 2C cook Loucas

https://textbookfull.com/product/biota-grow-2c-gather-2c-cook-
loucas/

Applied Neural Networks with TensorFlow 2: API Oriented


Deep Learning with Python Orhan Gazi Yalç■n

https://textbookfull.com/product/applied-neural-networks-with-
tensorflow-2-api-oriented-deep-learning-with-python-orhan-gazi-
yalcin/

Practical Machine Learning and Image Processing: For


Facial Recognition, Object Detection, and Pattern
Recognition Using Python Himanshu Singh

https://textbookfull.com/product/practical-machine-learning-and-
image-processing-for-facial-recognition-object-detection-and-
pattern-recognition-using-python-himanshu-singh/
Deep Learning
with Applications
Using Python
Chatbots and Face, Object, and Speech
Recognition With TensorFlow and Keras

Navin Kumar Manaswi
Foreword by Tarry Singh
Deep Learning with
Applications Using
Python
Chatbots and Face, Object,
and Speech Recognition
With TensorFlow and Keras

Navin Kumar Manaswi


Foreword by Tarry Singh
Deep Learning with Applications Using Python
Navin Kumar Manaswi
Bangalore, Karnataka, India

ISBN-13 (pbk): 978-1-4842-3515-7 ISBN-13 (electronic): 978-1-4842-3516-4


https://doi.org/10.1007/978-1-4842-3516-4
Library of Congress Control Number: 2018938097

Copyright © 2018 by Navin Kumar Manaswi


This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or
part of the material is concerned, specifically the rights of translation, reprinting, reuse of
illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way,
and transmission or information storage and retrieval, electronic adaptation, computer software,
or by similar or dissimilar methodology now known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark
symbol with every occurrence of a trademarked name, logo, or image we use the names, logos,
and images only in an editorial fashion and to the benefit of the trademark owner, with no
intention of infringement of the trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if
they are not identified as such, is not to be taken as an expression of opinion as to whether or not
they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of
publication, neither the authors nor the editors nor the publisher can accept any legal
responsibility for any errors or omissions that may be made. The publisher makes no warranty,
express or implied, with respect to the material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Celestin Suresh John
Development Editor: Matthew Moodie
Coordinating Editor: Divya Modi
Cover designed by eStudioCalamar
Cover image designed by Freepik (www.freepik.com)
Distributed to the book trade worldwide by Springer Science+Business Media New York,
233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505,
e-mail orders-ny@springer-sbm.com, or visit www.springeronline.com. Apress Media, LLC is a
California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc
(SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.
For information on translations, please e-mail rights@apress.com, or visit www.apress.com/
rights-permissions.
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook
versions and licenses are also available for most titles. For more information, reference our Print
and eBook Bulk Sales web page at www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is
available to readers on GitHub via the book’s product page, located at www.apress.
com/9781484235157. For more detailed information, please visit www.apress.com/source-code.
Printed on acid-free paper
Table of Contents
Foreword by Tarry Singh���������������������������������������������������������������������ix

About the Author�������������������������������������������������������������������������������xiii


About the Technical Reviewer������������������������������������������������������������xv

Chapter 1: Basics of TensorFlow����������������������������������������������������������1


Tensors������������������������������������������������������������������������������������������������������������������2
Computational Graph and Session������������������������������������������������������������������������3
Constants, Placeholders, and Variables����������������������������������������������������������������6
Placeholders���������������������������������������������������������������������������������������������������������9
Creating Tensors�������������������������������������������������������������������������������������������������12
Fixed Tensors�������������������������������������������������������������������������������������������������13
Sequence Tensors�����������������������������������������������������������������������������������������14
Random Tensors��������������������������������������������������������������������������������������������15
Working on Matrices�������������������������������������������������������������������������������������������16
Activation Functions��������������������������������������������������������������������������������������������17
Tangent Hyperbolic and Sigmoid�������������������������������������������������������������������18
ReLU and ELU������������������������������������������������������������������������������������������������19
ReLU6������������������������������������������������������������������������������������������������������������20
Loss Functions����������������������������������������������������������������������������������������������������22
Loss Function Examples��������������������������������������������������������������������������������23
Common Loss Functions�������������������������������������������������������������������������������23

iii
Table of Contents

Optimizers�����������������������������������������������������������������������������������������������������������25
Loss Function Examples��������������������������������������������������������������������������������26
Common Optimizers��������������������������������������������������������������������������������������27
Metrics����������������������������������������������������������������������������������������������������������������28
Metrics Examples������������������������������������������������������������������������������������������28
Common Metrics�������������������������������������������������������������������������������������������29

Chapter 2: Understanding and Working with Keras���������������������������31


Major Steps to Deep Learning Models����������������������������������������������������������������32
Load Data������������������������������������������������������������������������������������������������������33
Preprocess the Data��������������������������������������������������������������������������������������33
Define the Model�������������������������������������������������������������������������������������������34
Compile the Model�����������������������������������������������������������������������������������������36
Fit the Model��������������������������������������������������������������������������������������������������37
Evaluate Model����������������������������������������������������������������������������������������������38
Prediction������������������������������������������������������������������������������������������������������38
Save and Reload the Model���������������������������������������������������������������������������39
Optional: Summarize the Model��������������������������������������������������������������������39
Additional Steps to Improve Keras Models���������������������������������������������������������40
Keras with TensorFlow����������������������������������������������������������������������������������������42

Chapter 3: Multilayer Perceptron�������������������������������������������������������45


Artificial Neural Network�������������������������������������������������������������������������������������45
Single-Layer Perceptron�������������������������������������������������������������������������������������47
Multilayer Perceptron������������������������������������������������������������������������������������������47
Logistic Regression Model����������������������������������������������������������������������������������49

iv
Table of Contents

Chapter 4: Regression to MLP in TensorFlow�������������������������������������57


TensorFlow Steps to Build Models����������������������������������������������������������������������57
Linear Regression in TensorFlow������������������������������������������������������������������������58
Logistic Regression Model����������������������������������������������������������������������������������62
Multilayer Perceptron in TensorFlow������������������������������������������������������������������65

Chapter 5: Regression to MLP in Keras����������������������������������������������69


Log-Linear Model������������������������������������������������������������������������������������������������69
Keras Neural Network for Linear Regression������������������������������������������������������71
Logistic Regression���������������������������������������������������������������������������������������������73
scikit-learn for Logistic Regression���������������������������������������������������������������74
Keras Neural Network for Logistic Regression����������������������������������������������74
Fashion MNIST Data: Logistic Regression in Keras���������������������������������������77
MLPs on the Iris Data������������������������������������������������������������������������������������������80
Write the Code�����������������������������������������������������������������������������������������������80
Build a Sequential Keras Model���������������������������������������������������������������������81
MLPs on MNIST Data (Digit Classification)����������������������������������������������������������84
MLPs on Randomly Generated Data��������������������������������������������������������������������88

Chapter 6: Convolutional Neural Networks�����������������������������������������91


Different Layers in a CNN������������������������������������������������������������������������������������91
CNN Architectures�����������������������������������������������������������������������������������������������95

Chapter 7: CNN in TensorFlow������������������������������������������������������������97


Why TensorFlow for CNN Models?����������������������������������������������������������������������97
TensorFlow Code for Building an Image Classifier for MNIST Data��������������������98
Using a High-Level API for Building CNN Models����������������������������������������������104

v
Table of Contents

Chapter 8: CNN in Keras�������������������������������������������������������������������105


Building an Image Classifier for MNIST Data in Keras��������������������������������������105
Define the Network Structure����������������������������������������������������������������������107
Define the Model Architecture���������������������������������������������������������������������108
Building an Image Classifier with CIFAR-10 Data���������������������������������������������110
Define the Network Structure����������������������������������������������������������������������111
Define the Model Architecture��������������������������������������������������������������������������112
Pretrained Models���������������������������������������������������������������������������������������������113

Chapter 9: RNN and LSTM�����������������������������������������������������������������115


The Concept of RNNs����������������������������������������������������������������������������������������115
The Concept of LSTM����������������������������������������������������������������������������������������118
Modes of LSTM�������������������������������������������������������������������������������������������������118
Sequence Prediction�����������������������������������������������������������������������������������������119
Sequence Numeric Prediction���������������������������������������������������������������������120
Sequence Classification������������������������������������������������������������������������������120
Sequence Generation����������������������������������������������������������������������������������121
Sequence-to-Sequence Prediction��������������������������������������������������������������121
Time-Series Forecasting with the LSTM Model������������������������������������������������122

Chapter 10: Speech to Text and Vice Versa��������������������������������������127


Speech-to-Text Conversion�������������������������������������������������������������������������������128
Speech as Data�������������������������������������������������������������������������������������������������128
Speech Features: Mapping Speech to a Matrix������������������������������������������������129
Spectrograms: Mapping Speech to an Image���������������������������������������������������131
Building a Classifier for Speech Recognition Through MFCC Features�������������132
Building a Classifier for Speech Recognition Through a Spectrogram�������������133
Open Source Approaches����������������������������������������������������������������������������������135

vi
Table of Contents

Examples Using Each API����������������������������������������������������������������������������������135


Using PocketSphinx�������������������������������������������������������������������������������������135
Using the Google Speech API�����������������������������������������������������������������������136
Using the Google Cloud Speech API�������������������������������������������������������������137
Using the Wit.ai API�������������������������������������������������������������������������������������137
Using the Houndify API��������������������������������������������������������������������������������138
Using the IBM Speech to Text API����������������������������������������������������������������138
Using the Bing Voice Recognition API����������������������������������������������������������139
Text-to-Speech Conversion�������������������������������������������������������������������������������140
Using pyttsx�������������������������������������������������������������������������������������������������140
Using SAPI���������������������������������������������������������������������������������������������������140
Using SpeechLib������������������������������������������������������������������������������������������140
Audio Cutting Code��������������������������������������������������������������������������������������141
Cognitive Service Providers������������������������������������������������������������������������������142
Microsoft Azure�������������������������������������������������������������������������������������������143
Amazon Cognitive Services�������������������������������������������������������������������������143
IBM Watson Services�����������������������������������������������������������������������������������144
The Future of Speech Analytics������������������������������������������������������������������������144

Chapter 11: Developing Chatbots�����������������������������������������������������145


Why Chatbots?��������������������������������������������������������������������������������������������������146
Designs and Functions of Chatbots������������������������������������������������������������������146
Steps for Building a Chatbot�����������������������������������������������������������������������������147
Preprocessing Text and Messages��������������������������������������������������������������148
Chatbot Development Using APIs����������������������������������������������������������������166
Best Practices of Chatbot Development������������������������������������������������������������169
Know the Potential Users����������������������������������������������������������������������������169
Read the User Sentiments and Make the Bot Emotionally Enriching����������169

vii
Table of Contents

Chapter 12: Face Detection and Recognition������������������������������������171


Face Detection, Face Recognition, and Face Analysis��������������������������������������172
OpenCV�������������������������������������������������������������������������������������������������������������172
Eigenfaces���������������������������������������������������������������������������������������������������173
LBPH������������������������������������������������������������������������������������������������������������175
Fisherfaces��������������������������������������������������������������������������������������������������176
Detecting a Face�����������������������������������������������������������������������������������������������177
Tracking the Face����������������������������������������������������������������������������������������������179
Face Recognition����������������������������������������������������������������������������������������������182
Deep Learning–Based Face Recognition����������������������������������������������������������185
Transfer Learning����������������������������������������������������������������������������������������������188
Why Transfer Learning?�������������������������������������������������������������������������������188
Transfer Learning Example��������������������������������������������������������������������������189
Calculate the Transfer Value������������������������������������������������������������������������191
APIs�������������������������������������������������������������������������������������������������������������������197

Appendix 1: Keras Functions for Image Processing�������������������������201

Appendix 2: Some of the Top Image Data Sets Available�����������������207

Appendix 3: Medical Imaging: DICOM File Format���������������������������211


W
 hy DICOM?�����������������������������������������������������������������������������������������������������211
What Is the DICOM File Format?�����������������������������������������������������������������������211

Index�������������������������������������������������������������������������������������������������213

viii
Foreword by Tarry Singh
Deep Learning has come a really long way.
From the birth of the idea to understand
human mind and the concept of
associationism — how we perceive things
and how relationships of objects and views
influence our thinking and doing, to the
modelling of associationism which started in
the 1870s when Alexander Bain introduced the
first concert of Artificial Neural Networks by grouping the neurons.
Fast forward it to today 2018 and we see how Deep Learning has
dramatically improved and is in all forms of life — from object detection,
speech recognition, machine translation, autonomous vehicles, face
detection and the use of face detection from mundane tasks such as
unlocking your iPhoneX to doing more profound tasks such as crime
detection and prevention.
Convolutional Neural Networks and Recurrent Neural Networks
are shining brightly as they continue to help solve the world problems
in literally all industry areas such as Automotive & Transportation,
Healthcare & Medicine, Retail to name a few. Great progress is being made
in these areas and just metrics like these say enough about the palpability
of the deep learning industry:

–– Number of Computer Science academic papers have soared to almost


10x since 1996

–– VCs are investing 6x more in AI startups since 2000

–– There are 14x more active AI startups since 2000

ix
Foreword by Tarry Singh

–– AI related jobs market is hiring 5x more since 2013 and Deep Learning is
the most sought after skill in 2018

–– 84% of enterprises believe investing in AI will give them a great competi-


tive edge
And finally,

–– the error rate of image classification has dropped from 28% in 2012 to
2.5% in 2017 and it is going down all the time!

Still the research community is not satisfied. We are pushing


boundaries and I am moving ahead with my peers to develop models
around the bright and shiny Capsule Networks and give Deep Learning
a huge edge. I am not the only one in this battle. It is with great pleasure I
put this foreword for Navin, a respected professional in the Deep Learning
community I have come to know so well.
His book is coming just at the right moment. The industry as well as
learners are in need of practical means to strengthen their knowledge in
Deep Learning and apply in their job.
I am convinced that Navin’s book will give the learners what they need.
TensorFlow is increasingly becoming the market leader and Keras too is
being adopted by professionals to solve difficult problems in computer
vision and NLP (Natural Language Processing). There is no single
company on this planet who isn’t investing in these two application areas.
I look forward to this book being published and will be the first in line
to get it. And my advice to you is: you should too!
—Tarry Singh

x
Foreword by Tarry Singh

About Tarry Singh


Tarry Singh is the Founder and AI Neuroscience Researcher
@deepkapha.ai | Mentor DeepLearning @Coursera. A thought-leader,
entrepreneur, and SME with deep industry knowledge in deep learning,
machine learning, artificial intelligence. Internationally acknowledged
speaker, author, and mentor and startup coach. An organizationally
sensitive advisor with a deep understanding of both subjective and
objective challenges within the organization; His goal is to help improve
the individual and organizational performance of his clients by supporting
in transformational change management programs specifically
digital/data analytics transformation.

xi
About the Author
Navin Kumar Manaswi has been developing
AI solutions with the use of cutting-­edge
technologies and sciences related to artificial
intelligence for many years. Having worked for
consulting companies in Malaysia, Singapore,
and the Dubai Smart City project, as well
as his own company, he has developed a
rare mix of skills for delivering end-to-end
artificial intelligence solutions, including
video intelligence, document intelligence, and
human-like chatbots. Currently, he solves B2B problems in the verticals of
healthcare, enterprise applications, industrial IoT, and retail at Symphony
AI Incubator as a deep learning AI architect. With this book, he wants to
democratize the cognitive computing and services for everyone, especially
developers, data scientists, software engineers, database engineers, data
analysts, and C-level managers.

xiii
About the Technical Reviewer
Sundar Rajan Raman has more than 14 years
of full stack IT experience in machine
learning, deep learning, and natural language
processing. He has six years of big data
development and architect experience,
including working with Hadoop and
its ecosystems as well as other NoSQL
technologies such as MongoDB and
Cassandra. In fact, he has been the technical
reviewer of several books on these topics.
He is also interested in strategizing using Design Thinking principles
and coaching and mentoring people.

xv
CHAPTER 1

Basics of TensorFlow
This chapter covers the basics of TensorFlow, the deep learning
framework. Deep learning does a wonderful job in pattern recognition,
especially in the context of images, sound, speech, language, and time-­
series data. With the help of deep learning, you can classify, predict,
cluster, and extract features. Fortunately, in November 2015, Google
released TensorFlow, which has been used in most of Google’s products
such as Google Search, spam detection, speech recognition, Google
Assistant, Google Now, and Google Photos. Explaining the basic
components of TensorFlow is the aim of this chapter.
TensorFlow has a unique ability to perform partial subgraph
computation so as to allow distributed training with the help of
partitioning the neural networks. In other words, TensorFlow allows model
parallelism and data parallelism. TensorFlow provides multiple APIs.
The lowest level API—TensorFlow Core—provides you with complete
programming control.
Note the following important points regarding TensorFlow:

• Its graph is a description of computations.

• Its graph has nodes that are operations.


• It executes computations in a given context of a session.

• A graph must be launched in a session for any


computation.

© Navin Kumar Manaswi 2018 1


N. K. Manaswi, Deep Learning with Applications Using Python,
https://doi.org/10.1007/978-1-4842-3516-4_1
Chapter 1 Basics of TensorFlow

• A session places the graph operations onto devices


such as the CPU and GPU.

• A session provides methods to execute the graph


operations.
For installation, please go to https://www.tensorflow.org/install/.
I will discuss the following topics:

T ensors
Before you jump into the TensorFlow library, let’s get comfortable with
the basic unit of data in TensorFlow. A tensor is a mathematical object
and a generalization of scalars, vectors, and matrices. A tensor can be
represented as a multidimensional array. A tensor of zero rank (order) is
nothing but a scalar. A vector/array is a tensor of rank 1, whereas a

2
Chapter 1 Basics of TensorFlow

matrix is a tensor of rank 2. In short, a tensor can be considered to be an


n-­dimensional array.
Here are some examples of tensors:

• 5: This is a rank 0 tensor; this is a scalar with shape [ ].


• [2.,5., 3.]: This is a rank 1 tensor; this is a vector
with shape [3].

• [[1., 2., 7.], [3., 5., 4.]]: This is a rank 2


tensor; it is a matrix with shape [2, 3].

• [[[1., 2., 3.]], [[7., 8., 9.]]]: This is a rank 3


tensor with shape [2, 1, 3].

Computational Graph and Session


TensorFlow is popular for its TensorFlow Core programs where it has two
main actions.

• Building the computational graph in the construction


phase

• Running the computational graph in the execution


phase

Let’s understand how TensorFlow works.

• Its programs are usually structured into a construction


phase and an execution phase.

• The construction phase assembles a graph that has


nodes (ops/operations) and edges (tensors).

• The execution phase uses a session to execute ops


(operations) in the graph.

3
Chapter 1 Basics of TensorFlow

• The simplest operation is a constant that takes no


inputs but passes outputs to other operations that do
computation.

• An example of an operation is multiplication


(or addition or subtraction that takes two matrices as
input and passes a matrix as output).

• The TensorFlow library has a default graph to which


ops constructors add nodes.

So, the structure of TensorFlow programs has two phases, shown here:

A computational graph is a series of TensorFlow operations arranged


into a graph of nodes.
Let’s look at TensorFlow versus Numpy. In Numpy, if you plan to
multiply two matrices, you create the matrices and multiply them. But in
TensorFlow, you set up a graph (a default graph unless you create another
graph). Next, you need to create variables, placeholders, and constant
values and then create the session and initialize variables. Finally, you feed
that data to placeholders so as to invoke any action.

4
Chapter 1 Basics of TensorFlow

To actually evaluate the nodes, you must run the computational graph
within a session.
A session encapsulates the control and state of the TensorFlow runtime.
The following code creates a Session object:

sess = tf.Session()

It then invokes its run method to run enough of the computational


graph to evaluate node1 and node2.
The computation graph defines the computation. It neither computes
anything nor holds any value. It is meant to define the operations
mentioned in the code. A default graph is created. So, you don’t need to
create it unless you want to create graphs for multiple purposes.
A session allows you to execute graphs or parts of graphs. It allocates
resources (on one or more CPUs or GPUs) for the execution. It holds the
actual values of intermediate results and variables.
The value of a variable, created in TensorFlow, is valid only within
one session. If you try to query the value afterward in a second session,
TensorFlow will raise an error because the variable is not initialized there.
To run any operation, you need to create a session for that graph. The
session will also allocate memory to store the current value of the variable

5
Chapter 1 Basics of TensorFlow

Here is the code to demonstrate:

Constants, Placeholders, and Variables


TensorFlow programs use a tensor data structure to represent all data—
only tensors are passed between operations in the computation graph. You
can think of a TensorFlow tensor as an n-dimensional array or list. A tensor
has a static type, a rank, and a shape. Here the graph produces a constant
result. Variables maintain state across executions of the graph.

6
Chapter 1 Basics of TensorFlow

Generally, you have to deal with many images in deep learning, so you
have to place pixel values for each image and keep iterating over all images.
To train the model, you need to be able to modify the graph to tune
some objects such as weight and bias. In short, variables enable you to
add trainable parameters to a graph. They are constructed with a type and
initial value.
Let’s create a constant in TensorFlow and print it.

Here is the explanation of the previous code in simple terms:

1. Import the tensorflow module and call it tf.

2. Create a constant value (x) and assign it the


numerical value 12.

3. Create a session for computing the values.

4. Run just the variable x and print out its current


value.
The first two steps belong to the construction phase, and the last two
steps belong to the execution phase. I will discuss the construction and
execution phases of TensorFlow now.
You can rewrite the previous code in another way, as shown here:

7
Chapter 1 Basics of TensorFlow

Now you will explore how you create a variable and initialize it. Here is
the code that does it:

Here is the explanation of the previous code:

1. Import the tensorflow module and call it tf.

2. Create a constant value called x and give it the


numerical value 12.

3. Create a variable called y and define it as being the


equation 12+11.

4. Initialize the variables with tf.global_variables_


initializer().

5. Create a session for computing the values.

6. Run the model created in step 4.


7. Run just the variable y and print out its current
value.

Here is some more code for your perusal:

8
Chapter 1 Basics of TensorFlow

Placeholders
A placeholder is a variable that you can feed something to at a later time. It
is meant to accept external inputs. Placeholders can have one or multiple
dimensions, meant for storing n-dimensional arrays.

Here is the explanation of the previous code:

1. Import the tensorflow module and call it tf.

2. Create a placeholder called x, mentioning the


float type.

3. Create a tensor called y that is the operation of


multiplying x by 10 and adding 500 to it. Note that
any initial values for x are not defined.

4. Create a session for computing the values.


5. Define the values of x in feed_dict so as to run y.

6. Print out its value.

In the following example, you create a 2×4 matrix (a 2D array) for


storing some numbers in it. You then use the same operation as before to
do element-wise multiplying by 10 and adding 1 to it. The first dimension
of the placeholder is None, which means any number of rows is allowed.

9
Chapter 1 Basics of TensorFlow

You can also consider a 2D array in place of the 1D array. Here is the
code:

This is a 2×4 matrix. So, if you replace None with 2, you can see the
same output.

But if you create a placeholder of [3, 4] shape (note that you will feed
a 2×4 matrix at a later time), there is an error, as shown here:

10
Chapter 1 Basics of TensorFlow

################# What happens in a linear model ##########


# Weight and Bias as Variables as they are to be tuned
W = tf.Variable([2], dtype=tf.float32)
b = tf.Variable([3], dtype=tf.float32)
# Training dataset that will be fed while training as Placeholders
x = tf.placeholder(tf.float32)
# Linear Model
y = W * x + b

Constants are initialized when you call tf.constant, and their values
can never change. By contrast, variables are not initialized when you call
tf.Variable. To initialize all the variables in a TensorFlow program, you
must explicitly call a special operation as follows.

It is important to realize init is a handle to the TensorFlow subgraph


that initializes all the global variables. Until you call sess.run, the
variables are uninitialized.

11
Chapter 1 Basics of TensorFlow

Creating Tensors
An image is a tensor of the third order where the dimensions belong to
height, width, and number of channels (Red, Blue, and Green).
Here you can see how an image is converted into a tensor:

12
Chapter 1 Basics of TensorFlow

You can generate tensors of various types such as fixed tensors,


random tensors, and sequential tensors.

Fixed Tensors
Here is a fixed tensor:

13
Chapter 1 Basics of TensorFlow

tf:.fill creates a tensor of shape (2×3) having a unique number.

tf.diag creates a diagonal matrix having specified diagonal elements.

tf.constant creates a constant tensor.

Sequence Tensors
tf.range creates a sequence of numbers starting from the specified value
and having a specified increment.

tf.linspace creates a sequence of evenly spaced values.

14
Chapter 1 Basics of TensorFlow

Random Tensors
tf.random_uniform generates random values from uniform distribution
within a range.

tf.random_normal generates random values from the normal


distribution having the specified mean and standard deviation.

15
Another random document with
no related content on Scribd:
Ziegler of the ear department of the Hospital of the University of
Pennsylvania showed atrophy of this membrane.

Eulenburg speaks of one case in which the external atrophy had


reached as far as the larynx, and in which the pronunciation of the
letter r was somewhat impeded. Beverly Robinson,17 reports a case
accompanied with slight paralysis of the adductors of the vocal
cords. The laryngeal paralysis in this case improved under
treatment, which led Robinson to believe that the relation between
the two affections might have been only one of coincidence.
17 Am. Journ. Med. Sci., October, 1878, p. 437.

Flascher18 has described a unique case of bilateral facial atrophy


occurring in a woman twenty-three years old. When an infant she fell
and injured her forehead, and soon afterward had an attack of
measles without eruption. Shortly afterward the atrophy appeared.
Tactile sensibility was diminished and the secretion of sweat absent.
The masseter, temporal, and facial muscles and bones were
atrophied. External strabismus of the left eye was present; the pupil
of this eye was dilated, irregular, and non-reactile; sight was
diminished, the optic disc atrophied. This case would appear to differ
somewhat from true facial hemiatrophy. It was probably a peripheral
nerve affection following measles.
18 Berliner klin. Wochenschr., 1880, No. 31.

Mitchell19 has reported a case of absence of adipose matter in the


upper half of the body. I had an opportunity of examining this patient,
who was exhibited at a meeting of the Philadelphia Neurological
Society, and noticed that both sides of the face presented a striking
similarity to the affected side in cases of unilateral atrophy. The
muscles were apparently not affected. Mitchell suggests the
possibility of separate centres capable of restraining deposits of
adipose tissue.
19 Am. Journ. Med. Sci., July, 1885.
DURATION AND TERMINATION.—The disease pursues a slow but
generally progressive course. In a few instances, after having
attained a certain development, it seems to have remained
stationary for many years. Nothing could better illustrate the slow
progress or stationary character of this affection than the study which
Virchow made in 1880 of a patient whose case had been described
by Romberg more than twenty years before. After comparing the
patient's present condition with that described in notes taken twenty-
one years before, Virchow was not able to convince himself that any
material alteration had occurred in the atrophic parts; in fact, he
regarded the disease as having long ago become stationary. Cases
reported by Tanturri, Baerwinkel, and others bear out the same view
as to the stationary character of the affection in some cases.

COMPLICATIONS.—In a case of Virchow's, in addition to the facial


atrophy the patient presented atrophy which, commencing in the
distribution of some of the dorsal cutaneous nerves of the scapular
region, affected the musculo-spiral nerve from its origin downward,
most markedly in the forearm and head. Mendel20 describes a case
of facial hemiatrophy occurring in a monomaniac, the diagnosis
being complicated by the somatic signs of degeneracy—congenital
facial and bodily asymmetry. The patient was twenty-eight years old,
and the disease could be traced back to the seventh year. In several
reported cases the disease has followed or has been associated with
epileptic seizures. Buzzard21 has published a case in which the
affection came on in a girl aged thirteen in the course of a second
attack of chorea. In another it followed typhoid fever. In a case
reported by Parry22 left hemiplegia with temporary disturbance of
intelligence preceded the disease by about two years. In another,
observed by Axman and Hueter, the patient, a man aged thirty-two,
had suffered from irregular contractures of the left masticator
muscle, which commenced in the seventh year. These spasms were
associated with an increased delicacy of sensation in the region of
the left trigeminus. Neuralgia is sometimes a complication. In a case
reported by Holland,23 the patient for several years suffered from
paroxysms of fronto-temporal neuralgia.
20 Neurologisches Centralblatt, June 15, 1883, quoted in Journal of Nervous and
Mental Disease, 1883, x. p. 571.

21 Transactions of the Clinical Society of London, vol. v., 1872, p. 146.

22 Eulenburg.

23 American Practitioner, vol. xxxi. No. 182, Feb., 1885, p. 72.

PATHOLOGY.—Up to the present time, so far as I have been able to


learn, not a single autopsy in a case of typical progressive unilateral
facial atrophy has been made. Conclusions as to pathology can
therefore only be drawn from an analysis and study of symptoms
and from comparisons with other degenerative affections. Most
authorities hold that it is neurotic in origin. Lande, however, regarded
it as having its origin in the connective tissue, affecting the nutrition
of the other tissues by interfering with the circulation.

Different views have been held by those who have believed in its
neurotic origin. Moore regarded it as a form of progressive muscular
atrophy attacking the muscles supplied by the portio dura, but what
has already been shown with reference to the symptomatology is
sufficient to show that this is an erroneous hypothesis. The muscles
supplied by the facial nerve may diminish in volume, but they do not
undergo a true degeneration.

Brunner attributed the affection to continued irritation of the cervical


sympathetic by some continuing lesion. Irritation of such a lesion,
according to him, causes vascular spasms, diminishes blood-supply,
and thus leads to the gradual development of the atrophy. This view,
to say the least, has not been made out.

Virchow holds that the affection is peripheral, and not central. He


believes, however, that a primary process being once set up in the
nerve-trunks, owing to inflammations of the surrounding tissues it
may then extend upward to the spinal and basal ganglia. The
disease, according to this view, has some analogy to herpes zoster.
The manner in which nerve-districts are unequally attacked is similar
to what is observed in the various forms of lepra and in morphœa.
The doctrine of a tropho-neurosis is the one that is best upheld by
clinical facts. In the first place, various arguments can be adduced to
show that the disease is neurotic in origin. It is limited to one side of
the face and to special nerve-distributions. Affections of sensibility in
the domain of the trigeminal nerve are frequently present. In the
case given under Symptomatology, although anæsthesia was
absent, the patient complained of peculiar paræsthesia in the form of
stinging sensation. Either trophic centres or trophic fibres, which
have the same connection and course as the trigeminal, are affected
by a degenerative process. Whether nuclei, ganglia, or peripheral
fibres are primarily affected has not yet been satisfactorily
determined.

The case of Romberg, observed by Virchow twenty years after, was


considered by the latter to entirely overthrow the vaso-motor theory,
owing to the condition of the blood-vessels. While the surrounding
tissues from the skin inward were wasted and shrunken, the veins
and arteries of the parts appeared absolutely unchanged, the larger
even projecting above the surface of the skin. Under stimulation the
vessel dilated as in a normal individual, appearing to take no part in
the atrophy.

DIAGNOSIS.—The chief affections from which progressive unilateral


facial atrophy are to be diagnosticated are congenital asymmetry of
the face and head, facial paralysis, progressive muscular atrophy,
and hypertrophy of the opposite side of the face.

Congenital asymmetry of the face is observed in institutions for the


idiotic and feeble-minded. Such asymmetry, however, is usually
associated with corresponding defects of other parts of the body, as
of the head and limbs. In the nervous wards of the Philadelphia
Hospital is now, for instance, a patient the entire right half of whose
body is very decidedly wasted, the case being one of epileptic idiocy
with paralytic and choreic manifestations which point to atrophy of
the opposite half of the cerebrum. At the Pennsylvania Training-
School for Feeble-minded Children want of development of one-half
of the head is often observed, but in these and in other congenital
cases the special changes in nutrition, in the skin, in the color and
growth of the hair, and in sensation, are absent. In some cases of
congenital asymmetry of the head atrophy of the face or limbs, if
present, will be upon the opposite side of the body; and this is what
might be expected, as arrested development of the cranial vault will
probably correspond with arrested development of the cerebrum of
the same side and bodily defects of the opposite side.

Eulenburg, Maragliano, and others refer to an acquired want of


symmetry of the face sometimes observed in cases of wry neck or
scoliosis with deviation of the spinal column. Eulenburg especially
speaks of the so-called habitual scoliosis, where a curve in the
dorsal region in one direction has a compensatory cervical curve, the
side of the face which corresponds to the dorsal curve being often
smaller than the other. This asymmetry is supposed to result from
compression of the vessels and nerve-roots in the concavity of the
cervical curve. Here, again, the absence of special nutritional
changes will assist in the diagnosis. A study of the spinal curvature
will also be of value. Indeed, only the most careless observation
would allow this mistake in diagnosis to be made.

Facial paralysis—Bell's palsy of the usual type—would not be likely,


except by a careless observer, to be confounded with the disease
under consideration. When the muscles in the facial distribution are
involved, it is only in a very slowly progressive deterioration, which
may be due to mechanical causes, as compression by the
contracting skin. Moore,24 as already stated, was wrong in speaking
of the morbid changes as entirely confined to the portio dura of the
left side. It is the fat, the connective tissue, and the skin which are
first and chiefly affected. In unilateral facial atrophy no true paralysis
of the facial muscles is present; consequently, the forehead can be
wrinkled, the eye closed, the mouth drawn up or down, or sideways,
etc.; in short, all the movements of the face are possible. The
opposite of this, it goes without saying, is present in general facial
paralysis. The drawing of the face to the side opposite the paralysis
in Bell's palsy is not here observed; the mouth is sometimes drawn
upward slightly on the atrophied side. In facial paralysis of any
severity reactions of degeneration are present. In unilateral facial
atrophy, as in progressive muscular atrophy, the muscles respond
both to faradism and galvanism. As minor aids in making the
diagnosis, the absence of loss of taste in one-half of the tip of the
tongue, and of deflection of the tongue and uvula, are in favor of
facial atrophy.
24 Dublin Journal of Medical Science, vol. xiv., August and Nov., 1852, p. 245.

It is possible that a case of progressive muscular atrophy might


begin in almost any muscle or group of muscles in the body. In
progressive muscular atrophy, however, the appearance of the skin
is different; it is not mottled; it is not thin, as can be demonstrated by
manipulation of it; it can be raised by the fingers; it is soft and flaccid.
In progressive muscular atrophy also first one muscle and then
another, just as likely as not at some distance from each other, are
attacked by the wasting process; in unilateral facial atrophy the
affection spreads uniformly and regularly over one-half of the face.
According to Duchenne of Boulogne, when progressive muscular
atrophy first appears in the face the orbicularis oris is the muscle
most likely to be attacked, causing the lips to appear enlarged and
pendent, and giving a stupid look to the patient. In unilateral facial
atrophy this appearance is not present. Progressive muscular
atrophy commonly begins at a later age than unilateral facial atrophy.

Hypertrophy of the opposite side of the face is suggested by


Eulenburg as a possible source of mistake; but a little study,
however, will suffice to exclude this affection.

The following points are given by Eulenburg with reference to vitiligo


and porrigo decalvans: “In vitiligo we find the same white
decoloration of the skin, the cicatricial feel, the turning gray and
falling out of the hair, but not the loss of volume, which is the special
characteristic of this disease. In porrigo decalvans inflammatory
symptoms and œdema of the skin come first; the disease first
appears in regular circular spots; the hairs fall out without previous
loss of color; and finally, the disease is contagious, and fungi can be
demonstrated (microsporon Audouini).”

PROGNOSIS.—The prognosis as to recovery is bad, but, as already


shown, the disease may long remain stationary.

TREATMENT.—No well-authenticated case of cure under any method


of treatment has yet been reported. Electricity, either in the form of
galvanism or faradism, has been resorted to in a majority of cases.
In most of these temporary benefit has been produced by the
employment of these agencies. Baerensprung reports two cases as
having been greatly benefited by faradism. In Moore's case it also
produced temporary improvement. Carefully administered massage
should be tried. With reference to friction or massage, however, it is
well, as advised by Eulenburg, to be cautious, as excoriations are
easily produced. Measures directed to building up the nervous
centres are indicated—such medicinal agents, for instance, as the
salts of silver, gold, zinc, and copper, arsenical preparations,
strychnia, and iron.

DISEASES OF THE MEMBRANES OF THE BRAIN


AND SPINAL CORD.

BY FRANCIS MINOT, M.D.


The membranes or envelopes of the brain and cord were formerly
reckoned as three in number: the dura mater, lying next to the inner
surface of the bones of the cranium and spinal column, forming an
internal periosteum; the pia mater, which is in immediate contact with
the brain and cord; and the arachnoid, which was described as a
distinct membrane loosely attached to the pia mater, but more firmly
united to the dura, and constituting a closed sac or serous cavity
called the cavity of the arachnoid. This view is now abandoned by
most anatomists, who regard the external arachnoid as simply a
pavement epithelium covering the internal surface of the dura, and
the visceral arachnoid as constituting the external layer of the pia.
The term cavity of the arachnoid has, however, been generally
retained for the sake of convenience; and it gives rise to no obscurity
if we remember that by it we simply mean the space between the
dura and the pia.

The diseases of the membranes which I shall consider are—


congestion and inflammation of the dura, including hæmatoma;
congestion and simple and tubercular inflammation of the pia; and
meningeal apoplexy.

The membranes of the brain and those of the cord may be


separately diseased, or both may be affected at the same time.
Simultaneous inflammation of the cerebral and spinal meninges is
apt to occur epidemically, and is supposed to be zymotic in its origin.
This is described in another article. (See EPIDEMIC CEREBRO-SPINAL
MENINGITIS, Vol. I. p. 795.)

Inflammation of the Dura Mater of the Brain.

SYNONYM.—Pachymeningitis. Either surface of the dura may be


inflamed separately, and in many cases the symptoms are
sufficiently definite to render it possible to diagnosticate the situation
of the disease in this respect during life, especially when taken in
connection with the causes. For this reason it is usual to speak of
external and internal pachymeningitis. A peculiar form of the latter is
accompanied by the effusion of blood upon the arachnoidal surface,
which sometimes forms a tumor called hæmatoma. Congestion is
also sometimes included in the diseases of the dura mater, but is
rarely alluded to by writers on pathology or clinical medicine.

Congestion of the Dura Mater.

Except as the first stage of inflammation, congestion of the dura can


hardly exist unless in connection with the same condition of the pia
or of the brain. Its causes are either local, such as thrombosis of the
sinuses, syphilitic or other growths in the membranes; or remote, the
principal being obstructions to the general circulation, including
valvular disease of the heart, emphysema and other affections of the
lungs, renal disease, compression of the superior cava or jugulars by
aneurism and other tumors, delayed or suppressed menstruation,
etc. The symptoms cannot be distinguished from those of congestion
of the pia or of the brain—namely, headache, a sensation of
throbbing, pressure, or weight in the head, somnolence, etc. The
absence of fever would serve to distinguish the affection from an
inflammatory condition of the membranes or brain.

Inflammation of the External Surface of the Dura.

SYNONYM.—External pachymeningitis.

ETIOLOGY.—The most frequent causes of external pachymeningitis


are injuries to the cranial bones from violence, caries and necrosis of
the same, and concussion from blows on the head. Next in order of
frequency, if not even more common, comes the propagation of
inflammation from disease of the inner ear and of the mastoid cells.
It is only of late years that this important subject has been brought
prominently forward and the danger of ear diseases in this respect
fully pointed out. The channels of communication, as indicated by
Von Tröltsch1 in his valuable article on diseases of the ear, are along
the arteries and veins which pass from the skin of the meatus and
the mucous periosteal lining of the middle ear to the contiguous
bone, while the capillaries of the petrous bone are in direct
connection with the dura mater, so that the vessels of the latter are in
communication with the soft parts of the external and middle ear.
The vessels of the ear and the membranes of the brain are also
directly connected through the diploëtic veins of the temporal bone,
which discharge into the sinuses of the dura, as well as through the
venæ emissariæ, which, arising from the sinuses, pass through the
bone and discharge their contents into the external veins of the
head. Von Tröltsch also points out that the extension of an
inflammatory process may occur along the sheath of the facial nerve,
the canal of which (canalis Fallopii) is a branch of the internal
auditory canal and is lined by the dura mater. The latter is separated
from the mucosa of the tympanum only by a thin, transparent, and
often defective plate of bone. Inflammation may also be transmitted
from the scalp by means of the vessels which pass through the
bones of the skull. In this way erysipelas and other diseases of the
integument sometimes give rise to external pachymeningitis.
1 “Die Krankheiten des Gehörorganes,” von Anton von Tröltsch, in Gerhardt's Handb.
der Kinderkrankheiten, Tübingen, 1879, 5 B., ii. Abt., p. 150; also English translation
of the same, by J. O. Green, M.D., New York, 1882, p. 107.

SYMPTOMS.—There are no known symptoms which are characteristic


of inflammation of the external surface of the dura. In cases of death
from other diseases an autopsy may show traces of previous
inflammation, such as thickening of the membrane and its firm
adhesion to the cranial bones, which were not manifested during life
by other symptoms than those which accompany meningeal disease
in general; and in some instances none at all were known to have
occurred. At a variable time after the receipt of an injury to the head
the patient may complain of headache, followed by a chill, with high
fever, vomiting, vertigo, delirium, unconsciousness, convulsions, etc.,
arising from compression by the products of inflammation. The same
phenomena may follow the transmission of inflammation to the dura
from caries or other disease of the bones, or from otitis medea
purulenta. These symptoms usually continue without interruption,
though there is sometimes more or less complete remission of the
pain, and the patient may recover his consciousness for a time, thus
giving rise to fallacious hopes. In a large proportion of cases the
disease extends to the inner surface of the membrane and to the pia,
without any noticeable change in his condition other than coma. In
chronic external pachymeningitis the principal symptom is pain in the
head, which may persist for weeks or months without other
manifestations except drowsiness. Sometimes, on the contrary, there
is obstinate vigilance. Mental symptoms, such as loss of memory,
hallucinations, dementia, or mania, are sometimes noticed, ending,
as in the acute form, in coma.

PATHOLOGICAL ANATOMY.—In chronic cases often nothing is found but


thickening of the membrane, which generally becomes firmly united
to the inner surface of the cranium. Indeed, these appearances are
not unfrequently observed, to a limited extent, when there has been
no history of disease to account for them. In other chronic cases the
connective tissue of the membrane is found to be in part ossified,
and the osteophytes of the cranium sometimes found in pregnant
women and in patients with rheumatic cachexia are supposed to be
due to a chronic inflammatory process of the dura. The first changes
observed in acute external pachymeningitis are increased
vascularization, shown by red lines corresponding to the blood-
vessels, with punctiform extravasations, swelling, and softening of
the tissue. Later, there is thickening of the membrane from new
formation of connective tissue, and exudation of lymph, and
sometimes of pus, which latter may accumulate between the dura
and the cranial bones, or in traumatic cases may escape through
openings in the skull. The dura and the pia become united in most
cases of acute inflammation. The lateral sinuses frequently contain
thrombi, which, when ante-mortem, are firm in structure, reddish-
brown in color, often closely adherent to the walls of the vessel, and
may extend to other veins, sometimes reaching as far as the
jugulars. When purulent inflammation of a sinus occurs, its walls are
thickened, softened, and discolored, and the inner surface is
roughened. The thrombus becomes more or less purulent or
sanious, disintegrates, and the infecting particles are carried into the
circulation, giving rise to embolism and disseminated abscesses of
the lungs, kidneys, liver, or spleen. Other lesions, such as injury or
caries of the cranial bones and purulent inflammation of the middle
ear and of the mastoid cells, are frequently found in conjunction with
pachymeningitis, to which they have given rise. When the disease of
the dura extends to the pia, the adjacent portion of the brain is often
found implicated in the inflammation. In traumatic cases the dura
may be detached from the bone and lacerated to a greater or less
extent.

DIAGNOSIS.—The existence of external pachymeningitis may be


suspected from cerebral symptoms following traumatic injury of the
skull, erysipelas, or suppurative otitis medea, but apart from the
etiology it would not be possible to distinguish it from internal
inflammation of the membrane, or even from leptomeningitis.

PROGNOSIS.—In cases of suspected external pachymeningitis the


prognosis will depend upon the evidence of effusion of pus or blood
between the dura and the skull, and the possibility of their removal. A
large proportion of cases are fatal, especially those arising from
caries of the cranial bones and from the propagation of disease from
the middle ear, the mastoid process, or the external surface of the
skull, the inflammation extending through the membrane to the
arachnoid surface of the dura, and also to the pia mater. This would
be shown by a high temperature, rapid pulse, pain, and delirium,
followed by coma and perhaps convulsions. The frequency with
which external pachymeningitis occurs in connection with diseases
of the ear should put the physician on his guard in cases of otorrhœa
or pain in the ear, that he may warn the patient or his friends of the
possibility of danger, and may employ an appropriate treatment.
TREATMENT.—In all cases of injury to the skull or of severe
concussion the possibility of subsequent external meningitis should
be borne in mind. The patient should be confined to the bed and be
carefully secluded from excitement. Cold applications should be
made to the head, the diet should be simple and somewhat
restricted, and the bowels kept free without active purging. If there
be evidence or suspicion of the presence of pus or of blood between
the dura and the skull, means should be taken to evacuate the
effusion. In case of inflammatory symptoms leeches should be
applied behind the ears, and a stimulating liniment or croton oil
rubbed on the scalp. There is no specific treatment. Pain and
sleeplessness must be relieved by opiates and sedatives, and the
strength must be sustained by nourishing diet and stimulants.

Internal Pachymeningitis.

Internal pachymeningitis is of two kinds: 1st, simple inflammation,


which may be accompanied by purulent exudation and by a
corresponding affection of the pia mater: 2d, hemorrhagic
inflammation or hæmatoma of the dura mater. Simple inflammation
of the internal or lower surface of the dura, without the coexistence
of external pachymeningitis is rarely found in the adult. The morbid
appearances differ but little from that of the external form, and the
causes and the diagnosis are also similar. In children, however, it is
not uncommon, according to Steffen.2 The pus may discharge itself
spontaneously through the fontanels or the sutures, or caries of the
cranial bones may open a passage for its exit. It has also been
evacuated artificially when the symptoms have indicated its
presence. In other cases more or less extensive firm adhesions
between the dura and pia mater have shown the previous existence
of inflammation, but it would be difficult to say in which membrane it
began. In some instances no symptoms are observed during life; in
others the coexistence of inflammation of the pia, effusion into the
ventricles, etc. prevent an exact diagnosis.
2 “Die Krankheiten des Gehirns in Kindesalter,” von Dr. A. Steffen, in Gerhardt's
Handb., 5 B., i. Abt., 2te Hälfte, p. 380.

The TREATMENT does not differ from that of inflammation of the


external layer of the pia.

Hæmatoma of the Dura Mater.

SYNONYM.—Hemorrhagic pachymeningitis.

DEFINITION.—A chronic inflammation of the dura mater, resulting in


the formation upon its inner surface of successive layers of false
membrane, into and between which there is usually an effusion of
blood, the whole sometimes forming a large solid mass between the
dura and the cavity of the arachnoid.

ETIOLOGY.—Hemorrhagic pachymeningitis never occurs in healthy


persons except from traumatic causes. It is most frequently observed
in advanced life, and especially in the male sex. In a large number of
cases the blood is in an unhealthy condition, and hence the disease
is seen in alcoholism, in scurvy, in acute articular rheumatism, and in
the acute febrile affections, as typhoid fever, pleuro-pneumonia, and
pernicious anæmia, of which last, according to Huguenin,3 it
complicates one-third of the cases. It is frequent among the chronic
insane. It is occasionally met with in young children, but with them its
causes are mostly unknown; according to Steffen,4 they may consist
in alterations of the blood resulting from insufficient nourishment or
from the infectious diseases, and from abnormal blood-pressure, as
in whooping cough, asthma, etc., as well as from blows on the head.
3 G. Huguenin, “Acute and Chronic Inflammations of the Brain,” in Ziemssen's
Encylop., Am. translation, New York, 1877, vol. xii. p. 401 et seq.

4 Op. cit., p. 386.


SYMPTOMS.—Many cases of hemorrhagic pachymeningitis
complicating other cerebral diseases can be distinguished by no
special symptom from the original malady. Thus, in cases of chronic
insanity its existence may not be suspected during the lifetime of the
patient. Steffen quotes5 the case, reported by Moses, of a child
seven months old who died of catarrhal pneumonia, and who
exhibited no symptom which could suggest any disease of the brain
or its membranes. The autopsy revealed a pachymeningitic cyst
extending over the anterior half of the right hemisphere. When
symptoms are present they vary in different cases according to the
acuteness of the inflammatory process, the amount and situation of
the effusion, and the participation of the pia mater and brain in the
disease. In the beginning they are usually indefinite, headache being
the most common and often the only complaint. This may continue
for weeks without any other indication of disease, but it is frequently
accompanied by tinnitus aurium, vertigo, muscular weakness, and
contraction of the pupils. Wakefulness and restlessness at night and
slight twitching of the facial muscles or of the limbs sometimes occur.
There may be no change in the condition of the patient for a
considerable length of time (weeks or months), or he may improve to
some extent, owing to the absorption of the serous portion of the
effusion or to the tolerance of the foreign body acquired by the brain.
Sooner or later a fresh hemorrhage is followed by a recurrence, and
usually an aggravation, of all the symptoms. Sometimes the patient
becomes comatose, and dies speedily with apoplectic symptoms,
but this is not common at an early period. The extravasation of blood
generally takes place in small quantities at a time, without giving rise
to unconsciousness or paralysis. After a period of uncertain duration,
when the tumor has attained considerable dimensions a condition of
somnolence may take place, the patient sometimes sleeping twenty-
four hours or longer at a time. Distinct paralysis rarely occurs, though
hemiplegia is sometimes seen, and the paralysis has been observed
on the same side with the lesion. When symptoms of compression
appear the pupils become dilated. Toward the end of life the patient
is usually in a state of profound coma, the pulse is slow and irregular,
and the sphincters are relaxed.
5 Op. cit., p. 394.

The distinctive features of internal pachymeningitis, therefore, so far


as they are at present known, are those which would depend upon a
primary cerebral irritation, followed by those of compression of the
brain—persistent, often severe, headache, with contracted pupils,
and occasionally motor and sensory disturbances; afterward, coma,
dilated pupils, and involuntary discharges from the bowels and
bladder.

The DURATION of the disease is exceedingly variable, extending from


a few days to more than a year. According to a table made from
carefully observed cases by Huguenin, 74 per cent. of patients die
within thirty days; 18 per cent. live from one to six months; 4 per
cent. live from six months to one year; and 4 per cent. live over one
year.

PATHOLOGY.—A difference of opinion has existed among pathologists


concerning the true nature of hemorrhagic effusions of the inner
surface of the dura mater, especially as to whether the membrane in
which they are enclosed is formed by a deposit of fibrin from the
effused blood itself, or whether the disease consists essentially in an
inflammation of the dura, followed by a pseudo-membranous deposit
into which blood is afterward extravasated. The latter explanation,
offered by Virchow, has been generally accepted, but Huguenin,
whose opportunities for observing the disease were unusually good,
believes that the first stage of hæmatoma is not the formation of
connective tissue, but simply an extravasation of blood.

The disease begins with hyperæmia of the dura mater in the area of
distribution of the middle meningeal artery, followed by the formation
upon its inner surface of an extremely delicate membrane in small
patches of a yellowish color and studded with innumerable bloody
points. If the membrane be carefully raised, it is found to be
connected with the dura by very delicate blood-vessels, and to
contain an immense number of very wide and thin-walled vessels,
much larger than ordinary capillaries.6 At a later stage we find the
membranes to be made up of several distinct layers, of which the
innermost exhibits the character of the primary deposit, being thin
and abundantly supplied with blood-vessels, while those of older
formation have become successively thicker and are composed of
tough, lustrous fibres of connective tissue almost as dense as that of
the dura mater itself. The delicate structure of the false membranes
and of the vessels which they contain leads almost inevitably to the
effusion of blood, which increases in quantity with the thickness of
the whole growth, so that in an advanced stage it is not uncommon
to find large pools of blood, partly clotted and partly fluid, constituting
what is called hæmatoma of the dura mater. The small bloody points
are within the substance of the false membrane; the extravasations
are interstitial, the largest being always found between the youngest
membrane and the older layers. In some cases serous transudations
also occur between the false membranes. In still rarer instances no
blood or serum is found between or beneath the layers. Occasionally
small quantities of blood escape by leakage through the delicate
membrane into the cavity of the arachnoid.
6 See Rindfleisch's Manual of Pathological Histology, New Sydenham Soc.'s
translation, 1873, vol. ii. p. 302.

The usual situation of internal pachymeningitis is the vault of the


cranium, near the median line, the upper or external layer of the
tumor being in relation with the dura mater, to which it is adherent,
and the lower or internal with the arachnoid and pia mater. If the
effusion be extensive, it spreads downward over the frontal and
occipital lobes of the brain, and laterally toward the fissure of Sylvius.
In the majority of cases the disease occupies both sides of the
median line symmetrically, but it may be limited to one side only.
According to Huguenin, 56 per cent. of the cases embrace the
surfaces of both hemispheres; 44 per cent., that of one only.
Hæmatoma very rarely occupies the base of the cranium. The
thickness and consistency of the deposit vary in different cases,
depending upon the number of successive exudations, and hence
are most marked in cases of the longest duration.
Hemorrhagic pachymeningitis is occasionally met with in young
children, but much more rarely than in adults. The disease is usually
more acute than in older persons, but the anatomical appearances
are essentially the same.7
7 For an able description of the lesions of hemorrhagic pachymeningitis in children
see the third edition of Rilliet and Barthez's Maladies des Enfants, by Barthez and
Sanné, Paris, 1884, vol. i. p. 152.

PROGNOSIS.—The great majority of cases end fatally. A few instances


of recovery are reported in which the diagnosis seems justified by
the symptoms. Moreover, it is not very rare to find, on post-mortem
examination of those who have died of other diseases, evidence of
the former existence of hemorrhagic pachymeningitis. According to
Steffen, while the prognosis of simple pachymeningitis in children is
frequently good, owing to the favorable conditions for the exit of pus
through the open fontanels and sutures, in hemorrhagic
pachymeningitis recovery is rare.

DIAGNOSIS.—In a disease whose symptoms are so vague the


diagnosis must of necessity be difficult and often impossible. The
chief elements for the formation of the diagnosis are the slow and
interrupted progress of the affection, persistent headache, tendency
to prolonged slumber, and final coma; the absence of paralysis of the
cranial nerves, of vomiting, and of general convulsions; the age of
the patient, the coexistence of alcoholism, chronic insanity, or acute
rheumatism, and traumatism. The diseases for which hæmatoma
would be most likely mistaken are acute inflammation of the
meninges, apoplexy from cerebral hemorrhage, tumor in the
substance of the brain, and necrobiosis from thrombus or embolus.
The absence of symptoms characteristic of these affections might
lead to a probable diagnosis by exclusion, but in many cases the
existence of the disease cannot be determined with certainty. In
children it is most likely to be confounded with tubercular meningitis,
from which it may be distinguished by the fact that it is most common
under the age of two years, the other being rare before that period,
and that the characteristic symptoms of tubercular meningitis
(prodromic period, vomiting, irregularity of pulse, etc.) are wanting.
But the tubercular disease in young infants may closely resemble
hæmatoma, a profound coma replacing all other symptoms. Here the
existence of tuberculous disease in the parents or other near
relatives would point strongly to tubercular meningitis, while the
absence of such antecedents would suggest hæmatoma.

TREATMENT.—If the disease be a complication of alcoholism, anæmia,


scurvy, rheumatism, etc., the treatment appropriate to those
affections should be employed, along with remedies addressed to
the local disease. For the early symptoms of irritation, perfect rest in
bed, cold to the head, bromide of potassium internally, sinapisms to
the back of the neck, together with simple and nutritious diet, are the
most efficient means. The bowels must be regulated, but purging is
not necessary. The abstraction of blood from the head by leeches to
the temples or behind the ears, or by cupping, is recommended by
most authorities, especially if there be much heat of the head.
Mercury may be tried, care being taken not to salivate the patient. It
is obvious that this treatment, in order to be of any avail, must be
instituted at the earliest stage of the disease. After the probable
formation of the hæmatoma an effort should be made to promote its
absorption, which sometimes actually takes place, as is proved by
the autopsies of patients who, having previously suffered from this
affection, have died from other causes. The iodide of potassium or
the iodide of sodium should be employed perseveringly for this
purpose, in the dose of from ten to thirty grains three times daily. The
bromide should also be continued if necessary. The acne which
sometimes accompanies the continued use of these remedies may
be prevented or cured by the use of three to five drops of the liquor
potassæ arsenitis, given once or twice daily after meals. Counter-
irritation to the scalp by means of stimulating liniments or croton oil,
and small blisters to the temples, are likely to do good. In alcoholic
subjects the amount of wine or spirit taken should be regulated by
allowing enough to support the strength, without too suddenly
withdrawing the accustomed stimulant. In the stage of coma the
treatment must be purely expectant. The state of the bladder must
be regularly examined, and the catheter employed when necessary.
Liquid nourishment should be carefully given as long as the patient is
able to swallow.

Cerebral Meningeal Hemorrhage.

SYNONYM.—Meningeal apoplexy of the brain. Hemorrhage of or upon


the membranes of the brain is closely connected with intracerebral
hemorrhage. Both arise from similar causes, and the former may
result directly from the latter. It is for convenience of arrangement
that the two subjects are treated separately in this work.

ETIOLOGY.—The causes of meningeal apoplexy are predisposing and


immediate. The most important predisposing cause consists in
disease of the cerebral vessels, especially the arteries, which favors
the formation of so-called miliary aneurisms, as demonstrated by
Charcot and Bouchard in the case of cerebral apoplexy. Disease of
the vessels in its turn arises from various conditions, among which
alcoholism in adults holds a prominent place from its tendency to
favor a fatty degeneration of the vascular walls. In subjects of
purpura or hæmophilia (the so-called bleeders), in whom, from an
inherent weakness of the capillary vessels or a deficiency of the
fibrin of the blood, or both combined, there is a tendency to
extravasation of the blood in various parts, hemorrhage into the
arachnoid cavity may occur.8 A new-born child under my observation
had bleeding at the navel and ecchymoses in various parts of the
body. Suddenly it became comatose, and it died with signs of
cerebral compression. There was no autopsy, but it seems probable
that hemorrhage into the cavity of the arachnoid had taken place. A
sister of the patient had also had spontaneous hemorrhage from the
navel and from other parts shortly after birth, but recovered. Chronic
general arthritis and gout also probably predispose to the affection,
as well as old age, which is accompanied by atrophy of all the
tissues. The disease is most frequently met with in the two extremes
of life; according to Durand-Fardel,9 in adults the largest number of
cases occurs between the ages of seventy and eighty years.

You might also like