Support¶
This module contains additional code that I used from outside in support of this. These are typically outside of the neural network, but used in filter visualization and similar.
-
lenet.support.
initializer
(shape, name='xavier')[source][source]¶ A method that returns random numbers for Xavier initialization.
Parameters: - shape – shape of the initializer.
- name – Name for the scope of the initializer
Returns: random numbers from tensorflow random_normal
Return type: float
-
lenet.support.
nhwc2hwcn
(nhwc, name='nhwc2hwcn')[source][source]¶ This method reshapes (NHWC) 4D bock to (HWCN) 4D block
Parameters: nhwc – 4D block in (NHWC) format Returns: 4D block in (HWCN) format Return type: tensorflow tensor
-
lenet.support.
nhwc2hwnc
(nhwc, name='nhwc2hwnc')[source][source]¶ This method reshapes (NHWC) 4D bock to (HWNC) 4D block
Parameters: nhwc – 4D block in (NHWC) format Returns: 4D block in (HWNC) format Return type: tensorflow tensor
-
lenet.support.
visualize_filters
(filters, name='conv_filters')[source][source]¶ This method is a wrapper to
put_kernels_on_grid
. This adds the grid to image summaries.Parameters: tensor (tensorflow) – A 4D block in (HWNC) format.
-
lenet.support.
visualize_images
(images, name='images', num_images=6)[source][source]¶ This method sets up summaries for images.
Parameters: - images – a 4D block in (NHWC) format.
- num_images – Number of images to display
Todo
I want this to display images in a grid rather than just display using tensorboard’s ugly system. This method should be a wrapper that converts images in (NHWC) format to (HWNC) format and makes a grid of the images.
Perhaps a code like this: