Skip to main content

Evaluation metrics for segmentation, detection and classification Deep Learning algorithms

Project description

LAPiX DL - Utils for Computer Vision Deep Learning research

This package contains utilitary functions to support train and evaluation of Deep Learning models applied to images.

Three computer vision approaches are covered: Segmentation, Detection and Classification.

How to use

For Model Evaluation

This module exports the following functions for model evaluation:

from lapixdl.evaluation.evaluate import evaluate_segmentation
from lapixdl.evaluation.evaluate import evaluate_detection
from lapixdl.evaluation.evaluate import evaluate_classification

All model evaluation methods need two iterators: one for the ground truth itens and one for the predictions.

These iterators must be sorted equaly, assuring that the ground truth and the prediction of the same sample are at the same position.

Example of segmentation model evaluation using PyTorch:

from lapixdl.evaluation.evaluate import evaluate_segmentation

classes = ['background', 'object']

# Iterator for GT masks 
# `dl` is a PyTorch DataLoader
def gt_mask_iterator_from_dl(dl):
  for imgs, masks in iter(dl):
    for mask in masks:
      yield mask

# Iterator for prediction masks 
# `predict` a function that, given an image, predicts the mask.
def pred_mask_iterator_from_dl(dl, predict):
  for imgs, masks in iter(dl):
    for img in imgs:
      yield predict(img)

gt_masks = gt_mask_iterator_from_dl(validation_dl)
pred_masks = pred_mask_iterator_from_dl(validation_dl, prediction_function)

# Calculates and shows metrics
eval = evaluate_segmentation(gt_masks, pred_masks, classes)

# Shows confusion matrix and returns its Figure and Axes
fig, axes = eval.show_confusion_matrix()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lapixdl-0.5.1.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

lapixdl-0.5.1-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file lapixdl-0.5.1.tar.gz.

File metadata

  • Download URL: lapixdl-0.5.1.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.9.0

File hashes

Hashes for lapixdl-0.5.1.tar.gz
Algorithm Hash digest
SHA256 5d3f8ce007e4e14622cf459177c48d483b29b13ab5fb47891c1aa74b5ae1cff4
MD5 8a6d5bb8c108f5b5806a0494168bbffa
BLAKE2b-256 637779cb9b3b3d3dc3ff6c386bd08355e0f684e7d4242a891c3b6d86572231e5

See more details on using hashes here.

File details

Details for the file lapixdl-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: lapixdl-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.9.0

File hashes

Hashes for lapixdl-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 01d7360c2346a6b76f8587a7ea236a033fd6128d6069247c91eedaa4e52d8977
MD5 01939f5cdb974c6af97c0fb5a052ed94
BLAKE2b-256 a74f1774fbf02aee75a11275549f9b6287dba2577ee80f408fadd14137f97abf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page