Convolutional Neural Networks¶
Classes for deploying ConvNets.
AlexNet¶
-
class
perception.
AlexNet
(config, model_dir=None, use_default_weights=False, dynamic_load=True)¶ Bases:
object
Wrapper for tensorflow AlexNet. Note: training not yet supported.
Parameters: config ( autolab_core.YamlConfig
) – specifies the parameters of the networkNotes
Required configuration paramters are specified in Other Parameters
Other Parameters: - batch_size (int) – size of batches, less than largest possible prediction to save memory
- im_height (int) – height of input images
- im_width (int) – width of input images
- channels (int) – number of channels of input image (should be 3)
- output_layer (
str
) – name of output layer for classification - feature_layer (:obj`str`) – name of layer to use for feature extraction (e.g. conv5)
-
open_session
()¶ Open tensorflow session. Exposed for memory management.
-
close_session
()¶ Close tensorflow session. Exposes for memory management.
-
predict
(image_arr, featurize=False)¶ Predict a set of images in batches.
Parameters: - image_arr (NxHxWxC
numpy.ndarray
) – input set of images in a num_images x image height x image width x image channels array (must match parameters of network) - featurize (bool) – whether or not to use the featurization layer or classification output layer
Returns: num_images x feature_dim containing the output values for each input image
Return type: numpy.ndarray
- image_arr (NxHxWxC
-
featurize
(image_arr)¶ Featurize a set of images in batches.
Parameters: image_arr (NxHxWxC numpy.ndarray
) – input set of images in a num_images x image height x image width x image channels array (must match parameters of network)Returns: num_images x feature_dim containing the output values for each input image Return type: numpy.ndarray
-
build_alexnet_weights
()¶ Build a set of convnet weights for AlexNet
-
build_alexnet
(weights, output_layer=None)¶ Connects graph of alexnet from weights