Skip to main content

Cost functions designed for semantic segmentation tasks, namely, Active Boundary Loss, Boundary Loss, Cross-Entropy Loss and Distance Trasform Loss.

Project description

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.

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

segloss-0.0.1.tar.gz (23.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

segloss-0.0.1-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

File details

Details for the file segloss-0.0.1.tar.gz.

File metadata

  • Download URL: segloss-0.0.1.tar.gz
  • Upload date:
  • Size: 23.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for segloss-0.0.1.tar.gz
Algorithm Hash digest
SHA256 99943496fcd96df8b2fb28ff3d4822ba3157bbfdac52f7226110e2de303631b7
MD5 80e9911c7012eb63bba0e11fe00118d0
BLAKE2b-256 633d6529e43a764d16bd8981f60205cbc6c014f5d1015423f8bb47f77f5b72e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for segloss-0.0.1.tar.gz:

Publisher: python-pypi.yml on rafaelvareto/segmentation-loss

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file segloss-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: segloss-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 25.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for segloss-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e384c2e0e41eecd16c06a351f77cadd4c2b7b4797faa966000d4f73a16fe0fa2
MD5 7ff4e799dbf8d9b17f79fd66b37a3a98
BLAKE2b-256 d479f11fa123035df02540428db06ea1626921d5a316e5ea46c5802d4be5476e

See more details on using hashes here.

Provenance

The following attestation bundles were made for segloss-0.0.1-py3-none-any.whl:

Publisher: python-pypi.yml on rafaelvareto/segmentation-loss

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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