vodet.gmvae module

class vodet.gmvae.GMVAE(data_dirs)

Bases: object

GMVAE object for object detection.

detector(label_type='labelme', conf_th=0.95, iou_th=0.3, step_ratio=0.5, input_size=[24, 24])

Create a Detector object.

Parameters
  • label_type (str) – The type of label data, either “VoTT” (for VoTT’s csv export) or “labelme” (for labelme’s json export).

  • conf_th (float default 0.99) – The confidence threshold for each proposed bounding box.

  • iou_th (float default 0.3) – The threshold of IoU value for Non-Maximum Supression of bounding boxes.

  • step_ratio (float default 0.5) – The ratio between the step size and width or height of sliding windows.

  • input_size (list of int) – The input size of the classifier

Returns

d – A Detector instance.

Return type

vodet.detect.Detector

set_dataloaders(batch_size, transforms)

Set up dataloaders for training.

Parameters
  • batch_size (int) – The batch size of dataloaders.

  • transforms (dict) – A dict of transforms each made by torchvision.transforms.Comose(). The keys must be “train”, “validation” and “unlabelled” At least, transforms.Resize((24,24)) and transforms.ToTensor() is required. The size of transforms.Resize() must be (24,24).

set_model(z_dim, device)

Set up model for training.

Parameters
  • z_dim (int) – Dimension of the latent variable.

  • device (str) – The name of device for training.

set_patches(label_type, step_ratio=1.0)

Split source images into patches with labels to train GMVAE classifier.

Parameters
  • label_type (str) – The type of label images. Either “VoTT” for VoTT’s csv export or “labelme” for labelme’s json output.

  • step_ratio (float default 1.0) – Sliding window step size relative to the size of patches.

train(epochs, precision_th=90)

Train model.

Parameters
  • epochs (int) – Epochs to train.

  • precision_th (float) – Precision threshold (percent). If the minimum precision in each epoch is larger than this value and the test loss is lower than previous “best model”, the “best model” will be overwritten.