Menu

Helper Module for Deep Learning.

Deep Clustering for Unsupervised Learning of Visual Features.

class pynet.models.deepcluster.DeepCluster(network, clustering, data_loader, n_batchs, pca_dim=256, assignment_logfile=None, use_cuda=False)[source]

Deep Clustering for Unsupervised Learning of Visual Features.

__init__(network, clustering, data_loader, n_batchs, pca_dim=256, assignment_logfile=None, use_cuda=False)[source]

Init class.

Parameters

network: @callable

the network used to compute the features.

clustering: @callable

the clustering algorithm.

data_loader: DataLoader

the train data loader.

n_batchs: int

the number of batchs used to computes network features.

pca_dim: int, default 256

the dimension of input clustering features.

assignment_logfile: str, default None

save the cluster assignements at each epoch.

use_cuda: bool, default False

wether to use GPU or CPU.

cluster(features)[source]

Performs the clustering.

Parameters

features: array (N, ndim)

network features to preprocess.

Returns

labels: array (N, )

the predicted class assignments.

compute_features()[source]

Compute the network features.

Returns

features: array (N, ndim)

network features.

forward(x)[source]

Forward method.

Parameters

x: Tensor (batch, channels, *dims)

the input data.

preprocess_features(features)[source]

Preprocess the network features.

Parameters

features: array (N, ndim)

network features to preprocess.

Returns

features: array (N, pca_dim)

PCA-reduced, whitened and L2-normalized features.

update_pseudo_labels()[source]

Update the classification labels.

pynet.models.deepcluster.update_pseudo_labels(signal)[source]

Callback to update the classifier pseudo labels.

Parameters

signal: SignalObject

an object with the trained model ‘object’, the emitted signal ‘signal’, the epoch number ‘epoch’ and the fold index ‘fold’.

Follow us

© 2019, pynet developers .
Inspired by AZMIND template.