HOME/Articles/

pil example import (snippet)

Article Outline

Python pil example 'import'

Modules used in program:

  • import os
  • import numpy as np
  • import matplotlib.pyplot as plt

python import

Python pil example: import

#Import everything that is needed from Keras library.
from keras.layers import Input, Reshape, Dropout, Dense, Flatten, BatchNormalization, Activation, ZeroPadding2D
from keras.layers.advanced_activations import LeakyReLU
from keras.layers.convolutional import UpSampling2D, Conv2D
from keras.models import Sequential, Model, load_model
from keras.optimizers import Adam

#matplotlib will help with displaying the results
import matplotlib.pyplot as plt
#numpy for some mathematical operations
import numpy as np
#PIL for opening,resizing and saving images
from PIL import Image
#tqdm for a progress bar when loading the dataset
from tqdm import tqdm
#os library is needed for extracting filenames from the dataset folder.
import os