The main module: the Network module

class nnfbp.Network.Network(nHiddenNodes, projector, trainData, valData, reductor=None, nTrain=1000000, nVal=1000000, tmpDir=None, createEmptyClass=False)[source]

Bases: object

The neural network object that performs all training and reconstruction.

Parameters:
  • nHiddenNodes (int) – The number of hidden nodes in the network.
  • projector (A Projector object (see, for example: nnfbp.SimpleCPUProjector)) – The projector to use.
  • trainData (A DataSet object (see: nnfbp.DataSet)) – The training data set.
  • valData (A DataSet object (see: nnfbp.DataSet)) – The validation data set.
  • reductor (A Reductor object (see: nnfbp.Reductors, default:LogSymReductor)) – Optional reductor to use.
  • nTrain (int) – Number of pixels to pick out of training set.
  • nVal (int) – Number of pixels to pick out of validation set.
  • tmpDir (string) – Optional temporary directory to use.
  • createEmptyClass (boolean) – Used internally when loading from disk, to create an empty object. Do not use directly.
reconstruct(sinogram)[source]

Reconstruct an image from a sinogram, after training.

Parameters:sinogram (numpy.ndarray) – The sinogram to reconstruct.
saveToDisk(fn)[source]

Save a trained network to disk, so that it can be used later without retraining.

Parameters:fn (string) – Filename to save it to.
train()[source]

Train the network using the Levenberg-Marquardt method.

nnfbp.Network.readFromDisk(fn, projector)[source]

Read a saved network from disk. The specified projector should be similar to the one used during training.

Parameters:
  • fn (string) – Filename to load network from.
  • projector (A Projector object (see, for example: nnfbp.SimpleCPUProjector)) – Projector to use when reconstructing.
Returns:

A nnfbp.Network.Network instance, ready to reconstruct with.

Previous topic

Welcome to PyNN-FBP’s documentation!

Next topic

Training data used during network training: the TrainingData module

This Page