Skip to content

Latest commit

 

History

History
executable file
·
233 lines (173 loc) · 4.07 KB

prepro.rst

File metadata and controls

executable file
·
233 lines (173 loc) · 4.07 KB

API - Preprocessing

We provide abundant data augmentation and processing functions by using Numpy, Scipy, Threading and Queue. However, we recommend you to use TensorFlow operation function like tf.image.central_crop, more TensorFlow data augmentation method can be found here and tutorial_cifar10_tfrecord.py. Some of the code in this package are borrowed from Keras.

tensorlayer.prepro

threading_data

rotation rotation_multi crop crop_multi flip_axis flip_axis_multi shift shift_multi

shear shear_multi shear2 shear_multi2 swirl swirl_multi elastic_transform elastic_transform_multi

zoom zoom_multi

brightness brightness_multi

illumination

imresize

samplewise_norm featurewise_norm

channel_shift channel_shift_multi

drop

transform_matrix_offset_center apply_transform projective_transform_by_points

array_to_img

find_contours pt2map binary_dilation dilation binary_erosion erosion

pad_sequences remove_pad_sequences process_sequences sequences_add_start_id sequences_add_end_id sequences_add_end_id_after_pad sequences_get_mask

Threading

threading_data

Images

  • These functions only apply on a single image, use threading_data to apply multiple threading see tutorial_image_preprocess.py.
  • All functions have argument is_random.
  • All functions end with multi , usually be used for image segmentation i.e. the input and output image should be matched.

Rotation

rotation

rotation_multi

Crop

crop

crop_multi

Flip

flip_axis

flip_axis_multi

Shift

shift

shift_multi

Shear

shear

shear_multi

Shear V2

shear2

shear_multi2

Swirl

swirl

swirl_multi

Elastic transform

elastic_transform

elastic_transform_multi

Zoom

zoom

zoom_multi

Brightness

brightness

brightness_multi

Illumination

illumination

Resize

imresize

Normalization

samplewise_norm

featurewise_norm

Channel shift

channel_shift

channel_shift_multi

Noise

drop

Transform matrix offset

transform_matrix_offset_center

Apply affine transform by matrix

apply_transform

Projective transform by points

projective_transform_by_points

Numpy and PIL

array_to_img

Find contours

find_contours

Points to Image

pt2map

Binary dilation

binary_dilation

Greyscale dilation

dilation

Binary erosion

binary_erosion

Greyscale erosion

erosion

Sequence

More related functions can be found in tensorlayer.nlp.

Padding

pad_sequences

Remove Padding

remove_pad_sequences

Process

process_sequences

Add Start ID

sequences_add_start_id

Add End ID

sequences_add_end_id

Add End ID after pad

sequences_add_end_id_after_pad

Get Mask

sequences_get_mask