GQ-CNN

GQ-CNN and FC-GQ-CNN classes are never accessed directly, but through a lightweight factory function that returns the corresponding class depending on the specified backend.

$ from gqcnn import get_gqcnn_model
$
$ backend = 'tf'
$ my_gqcnn = get_gqcnn_model(backend)(<class initializer args>)
gqcnn.get_gqcnn_model(backend='tf', verbose=True)

Get the GQ-CNN model for the provided backend.

Note

Currently only TensorFlow is supported.

Parameters
  • backend (str) – The backend to use, currently only “tf” is supported.

  • verbose (bool) – Whether or not to log initialization output to stdout.

Returns

GQ-CNN model with TensorFlow backend.

Return type

gqcnn.model.tf.GQCNNTF

gqcnn.get_fc_gqcnn_model(backend='tf', verbose=True)

Get the FC-GQ-CNN model for the provided backend.

Note

Currently only TensorFlow is supported.

Parameters
  • backend (str) – The backend to use, currently only “tf” is supported.

  • verbose (bool) – Whether or not to log initialization output to stdout.

Returns

FC-GQ-CNN model with TensorFlow backend.

Return type

gqcnn.model.tf.FCGQCNNTF

GQCNNTF

Tensorflow implementation of GQ-CNN model.

class gqcnn.model.tf.GQCNNTF(gqcnn_config, verbose=True, log_file=None)

Bases: object

GQ-CNN network implemented in Tensorflow.

__init__(gqcnn_config, verbose=True, log_file=None)
Parameters
  • gqcnn_config (dict) – Python dictionary of model configuration parameters.

  • verbose (bool) – Whether or not to log model output to stdout.

  • log_file (str) – If provided, model output will also be logged to this file.

static load(model_dir, verbose=True, log_file=None)

Instantiate a trained GQ-CNN for fine-tuning or inference.

Parameters
  • model_dir (str) – Path to trained GQ-CNN model.

  • verbose (bool) – Whether or not to log model output to stdout.

  • log_file (str) – If provided, model output will also be logged to this file.

Returns

Initialized GQ-CNN.

Return type

GQCNNTF

open_session()

Open Tensorflow session.

close_session()

Close Tensorflow session.

__del__()

Destructor that basically just makes sure the Tensorflow session has been closed.

property filters

Evaluate the filters of the first convolution layer.

Returns

Filters (weights) from first convolution layer of the network.

Return type

numpy.ndarray

predict(image_arr, pose_arr, verbose=False)

Predict the probability of grasp success given a depth image and gripper pose.

Parameters
  • image_arr (numpy ndarray) – 4D tensor of depth images.

  • pose_arr (numpy ndarray) – Tensor of gripper poses.

  • verbose (bool) – Whether or not to log progress to stdout, useful to turn off during training.

featurize(image_arr, pose_arr=None, feature_layer='conv1_1', verbose=False)

Featurize a set of inputs.

Parameters
  • image_arr (numpy ndarray) – 4D tensor of depth images.

  • pose_arr (numpy ndarray) – Optional tensor of gripper poses.

  • feature_layer (str) – The network layer to featurize.

  • verbose (bool) – Whether or not to log progress to stdout.

FCGQCNNTF

Tensorflow implementation of FC-GQ-CNN model.

class gqcnn.model.tf.FCGQCNNTF(gqcnn_config, fc_config, verbose=True, log_file=None)

Bases: gqcnn.model.tf.network_tf.GQCNNTF

FC-GQ-CNN network implemented in Tensorflow.

Note

FC-GQ-CNNs are never directly trained, but instead a pre-trained GQ-CNN is converted to an FC-GQ-CNN at inference time.

static load(model_dir, fc_config, log_file=None)

Load an FC-GQ-CNN from a pre-trained GQ-CNN.

Parameters
  • model_dir (str) – Path to pre-trained GQ-CNN model.

  • fc_config (dict) – Python dictionary of FC-GQ-CNN model configuration parameters.

  • log_file (str) – If provided, model output will also be logged to this file.

Returns

Initialized FC-GQ-CNN.

Return type

FCGQCNNTF