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 CV 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 = metrics.show_confusion_matrix()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file lapixdl-0.4.0.tar.gz
.
File metadata
- Download URL: lapixdl-0.4.0.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2ce3b61dd7ea6cda3ea5e42ce814d33aeba33257f8a1b64c6e119dad2c48432 |
|
MD5 | 3c1ec35229c092a3997397d8bb758382 |
|
BLAKE2b-256 | c4a855ffd64a851b472f054f3fa221802e1ee7967e292c8a9dde4309f2c4ab28 |
File details
Details for the file lapixdl-0.4.0-py3-none-any.whl
.
File metadata
- Download URL: lapixdl-0.4.0-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e378ed81a65e5e07ce93ea974a84b2d1309bf2668a2eb065ea6509eefb23cdd3 |
|
MD5 | 6384a21bd8b2735795a402f306747310 |
|
BLAKE2b-256 | 28dbcc128b97098422c7df5f79a16dac1ebf55c028069315ec8a950a432f1d7b |