Revision Python For Computer Vision
Revision Python For Computer Vision
[email protected]
September 2018
• Overview about Computer Vision
• Traditional Data Storage in Python
• NumPy Arrays
• Matplotlib
• SciPy
• scikit-learn
• Other Libraries
• Further Reading
CAT
Filter
KByte
640x427x3
Size in Bytes
819,840 Values 8 bits
819,840
6 Ahmed F. Gad 9/21/2018
• Preprocessing
Dataset: 2,000 Images
• Feature Extraction
Dataset Size
0.782x2,000 = 1,564 MByte
GByte
1,564/1,024=
1.527 GByte
7 Ahmed F. Gad 9/21/2018
• Preprocessing
• Feature Extraction
Dataset: 50,000 Size 38.18 GByte
Intensive in its Memory and
Processing Requirements
Reduce Amounts of Data
How to Represent Image Feature
using Less Amount of Data? Extraction
8 Ahmed F. Gad 9/21/2018
Advantage of using Features rather Image Pixels
• Preprocessing
Values is that Features are Robust to Variations
• Feature Extraction such as illumination, scale, and rotation.
Summarizes Images
For example, use 2,000 values rather than 819,840
Both
List
Tuples are immutable.
13 9/21/2018 Ahmed F. Gad
• Let`s use the PIL (Python Image Library) for reading an image in a list.
• So, lets start storing an
image into a Python list.
The following code reads
an image in the img_list
variable.
• It make a new copy of the array after being casted to the specified
type in the dtype argument.
• arange
• linspace
31
arange vs. linspace
Ahmed F. Gad 9/21/2018
• Indexing can be forward or backward.
• Forward indexing: from start to end.
• Backward indexing: from end to start.
• General form of indexing:
my_array[start:stop:step]
• In backward indexing, the index of the last element is -1.
• Backward: my_array[start=-1:stop=-6:step=-2]
While
• OpenCV
• scikit-image
• Keras
• Theano
• PyTorch