Tiny Binary Classifier#

class glasses_detector.architectures.tiny_binary_classifier.TinyBinaryClassifier[source]#

Bases: Module

Tiny binary classifier.

This is a custom classifier created with the aim to contain very few parameters while maintaining a reasonable accuracy. It only has several sequential convolutional and pooling blocks (with batch-norm in between).

forward(x: Tensor) Tensor[source]#

Performs forward pass.

Predicts raw scores for the given batch of inputs. Scores are unbounded, anything that’s less than 0, means positive class is unlikely and anything that’s above 0 indicates that the positive class is likely

Parameters:

x (torch.Tensor) – Image batch of shape (N, C, H, W). Note that pixel values are normalized and squeezed between 0 and 1.

Returns:

An output tensor of shape (N,) indicating whether each nth image falls under the positive class or not. The scores are unbounded, thus, to convert to a probability, sigmoid function must be used.

Return type:

torch.Tensor