lapixdl
Python package with Deep Learning utilities for Computer Vision
Science Score: 54.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
✓Academic publication links
Links to: zenodo.org -
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.6%) to scientific vocabulary
Keywords
Repository
Python package with Deep Learning utilities for Computer Vision
Basic Info
Statistics
- Stars: 9
- Watchers: 2
- Forks: 3
- Open Issues: 3
- Releases: 41
Topics
Metadata Files
README.md
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:
python
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:
```python from lapixdl.evaluation.evaluate import evaluate_segmentation
classes = ['background', 'object']
Iterator for GT masks
dl is a PyTorch DataLoader
def gtmaskiteratorfromdl(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 predmaskiteratorfromdl(dl, predict): for imgs, masks in iter(dl): for img in imgs: yield predict(img)
gtmasks = gtmaskiteratorfromdl(validationdl) predmasks = predmaskiteratorfromdl(validationdl, prediction_function)
Calculates and shows metrics
eval = evaluatesegmentation(gtmasks, pred_masks, classes)
Shows confusion matrix and returns its Figure and Axes
fig, axes = eval.showconfusionmatrix() ```
Examples with third libraries
How to log the results of LAPiX DL evaluations in the Weights & Biases platform
About Weights & Biases.
```python from lapixdl.evaluation.evaluate import evaluate_segmentation import wandb
init wandb ...
...
evaltest = evaluatesegmentation(gtmasks, predmasks, categories)
...
If you want to log everything
wandb.log({'testevaluation': evaltest.to_dict()['By Class']})
If you want to choose specific categories to log
selectedcats = ['A', 'B', 'C'] metricsbycat = {k: v for k, v in evaltest.todict()['By Class'].items() if k in selectedcats} wandb.log({'testevaluation': metricsby_cat}) ```
Computing using GPU with torchmetrics
About torchmetrics.
The lapixdl package calculates the confusion matrix first (on the CPU), which
this will be slower than calculating using torchmetrics which uses pytorch
tensors. So a trick here, to not calculate each metric separately in
torchmetrics, is to calculate a confusion matrix using torchmetrics
and then calculate all the metrics at once using lapixdl.
A simple example for a Segmentation case:
```python import torchmetrics from lapixdl.evaluation.model import SegmentationMetrics
classes = ['background', 'object']
confMat = torchmetrics.ConfusionMatrix( reduce="macro", mdmcreduce="global", numclasses=len(classes) )
confusionmatrix = confMat(pred, target) confusionmatrix = confusion_matrix.numpy()
metrics = SegmentationMetrics( classes=classes, confusionmatrix=confusionmatrix ) ```
For Results Visualization
This module exports the following functions for results visualization:
python
from lapixdl.evaluation.visualize import show_segmentations
from lapixdl.evaluation.visualize import show_classifications
from lapixdl.evaluation.visualize import show_detections
The available color maps are the ones from matplotlib.
For Data Conversion
This module exports the functions for data conversion.
python
from lapixdl.convert import labelbox_to_lapix
from lapixdl.convert import labelbox_to_coco
Example of conversion from Labelbox to COCO labels format:
```python import json
from lapixdl.formats import labelboxtococo
A map categories between labelbox schematic id and category ID
map_categories = {
'
The categories section in the COCO format
categoriescoco = [{ 'supercategory': None, 'name': 'examplecategory', 'id': 1 }]
Convert it and create the COCO OD data
cocodict = labelboxtococo( 'labelboxexportfile.json', mapcategories, categoriescoco, target = 'object detection', imageshape = (1200, 1600) )
Saves converted json
with open('./coco.json', 'w') as outfile: json.dump(cocodict, out_file) ```
Owner
- Name: Image Processing and Computer Graphics Lab - LAPiX
- Login: lapix-ufsc
- Kind: organization
- Location: Florianópolis - SC, Brazil
- Website: http://www.lapix.ufsc.br/
- Repositories: 2
- Profile: https://github.com/lapix-ufsc
Citation (CITATION.cff)
cff-version: 1.2.0 message: "If you use this software, please cite it as below." authors: - family-names: "Matias" given-names: "André" orcid: "https://orcid.org/0000-0003-0268-0233" - family-names: "Atkinson Amorim" given-names: "João Gustavo" orcid: "https://orcid.org/0000-0003-3361-6891" title: "LAPiX DL - Utils for Computer Vision Deep Learning research" version: 0.8.12 doi: 10.5281/zenodo.5963342 date-released: 2022-02-03 url: "https://github.com/lapix-ufsc/lapixdl"
GitHub Events
Total
- Delete event: 5
- Push event: 9
- Pull request event: 9
- Pull request review event: 7
- Create event: 5
Last Year
- Delete event: 5
- Push event: 9
- Pull request event: 9
- Pull request review event: 7
- Create event: 5
Committers
Last synced: almost 3 years ago
All Time
- Total Commits: 186
- Total Committers: 3
- Avg Commits per committer: 62.0
- Development Distribution Score (DDS): 0.57
Top Committers
| Name | Commits | |
|---|---|---|
| João Gustavo A. Amorim | j****m@g****m | 80 |
| André Victória Matias | a****s@g****m | 74 |
| pre-commit-ci[bot] | 6****]@u****m | 32 |
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 8
- Total pull requests: 102
- Average time to close issues: 6 months
- Average time to close pull requests: 4 days
- Total issue authors: 3
- Total pull request authors: 3
- Average comments per issue: 0.88
- Average comments per pull request: 0.06
- Merged pull requests: 100
- Bot issues: 0
- Bot pull requests: 76
Past Year
- Issues: 0
- Pull requests: 7
- Average time to close issues: N/A
- Average time to close pull requests: about 1 month
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 6
- Bot issues: 0
- Bot pull requests: 7
Top Authors
Issue Authors
- johnnv1 (7)
- luizbuschetto (1)
- Andrevmatias (1)
Pull Request Authors
- pre-commit-ci[bot] (90)
- johnnv1 (28)
- Andrevmatias (2)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 65 last-month
- Total dependent packages: 0
- Total dependent repositories: 1
- Total versions: 38
- Total maintainers: 2
pypi.org: lapixdl
Utils for Computer Vision Deep Learning research
- Homepage: https://github.com/lapix-ufsc/lapixdl
- Documentation: https://lapixdl.readthedocs.io/
- License: MIT
-
Latest release: 0.11.0
published over 1 year ago
Rankings
Maintainers (2)
Dependencies
- covdefaults >=2.2 development
- coverage * development
- distlib * development
- pytest * development
- pytest-env * development
- actions/checkout v2 composite
- actions/setup-python v2 composite