SEGLOSS: Semantic Segmentation Loss Functions
This project encompasses a list of three cost functions designed for semantic segmentation, to be available soo through the SegLoss Package [PyPi link] so that it can be easily installed in your environment:
segloss.ActiveBoundaryLoss(border_params=[0.1, 'cpu', True, 0.2, 0.01, 20.], ignore_index=255, weight=None)segloss.BoundaryLoss(border_params=[3, 5, 0.5], ignore_index=255, reduction='mean', weight=None)segloss.DistanceTransformLoss(border_params=[5,0.5,1.0], ignore_index=255, reduction='sum', weight=None)
Our most recent contribution, the Distance Transform Loss (DTL), punishes deep networks when class boundaries are misclassified in exchange for more accurate contour delineations, an important aspect in the geological field. DTL consists of four key steps: contour detection, distance transform mapping, pixel-wise multiplication, and the summation of all grid elements.
The proposed functions' API models the conventional cost functions available under the PyTorch framework so that it can be invoked according to the code block below:
import segloss
import torch
# Generate 12 samples randomly
num_classes, num_samples, num_dims = 4, 12, 64
images = torch.rand([num_samples, 3, num_dims, num_dims])
labels = torch.randint(0, num_classes, (num_samples, num_dims, num_dims))
# Feed criterion with both images and labels and compute loss
criterion = segloss.DistanceTransformLoss(border_params=[1,0.5,1.0])
loss_score = criterion(images, labels)
loss_score.backward()
There is a notebook tutorial under construction, being implemented with the PyTorch framework as well as the SEGYIO library demonstrating how to use DTL in semantic segmentation applications.
The tutorial showcases an experiment with the Netherlands' F3 Block volume, a publicly available seismic dataset that has been annotated by Yalaudah for the purpose of machine learning-based facies classification. This dataset is considered a valuable resource for researchers working in the field of geophysical data analysis and machine learning.
If you have further questions about the proposed approach, you can reach the corresponding author though the contact form available at www.vareto.com.br.
Release files for segloss 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| segloss-0.0.1.tar.gz | 23.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| segloss-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 48.5 kB
Release files / segloss-0.0.1.tar.gz
| Download URL | segloss-0.0.1.tar.gz |
|---|---|
| Size | 23.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
99943496fcd96df8b2fb28ff3d4822ba3157bbfdac52f7226110e2de303631b7
|
|
BLAKE2b-256 checksum How to use checksums |
633d6529e43a764d16bd8981f60205cbc6c014f5d1015423f8bb47f77f5b72e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2024.
Transparency logRelease files / segloss-0.0.1-py3-none-any.whl
| Download URL | segloss-0.0.1-py3-none-any.whl |
|---|---|
| Size | 25.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e384c2e0e41eecd16c06a351f77cadd4c2b7b4797faa966000d4f73a16fe0fa2
|
|
BLAKE2b-256 checksum How to use checksums |
d479f11fa123035df02540428db06ea1626921d5a316e5ea46c5802d4be5476e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2024.
Transparency log