Skip to main content

Cost functions designed for open-set classification tasks, namely, Entropic Open-set, ObjectoSphere and Maximal-Entropy Loss.

Project description

Open-set Learning Cost Functions

This project encompasses a list of cost functions recently designed for open-set learning and classification:

  • Entropic Open-set Loss: openloss.EntropicOpenSetLoss(num_classes, reduction='mean', weight=None
  • ObjectoSphere Loss: openloss.ObjectoSphereLoss(num_classes, margin=0.35, reduction='mean', weight=None)
  • Maximal-Entropy Loss: openloss.EntropicOpenSetLoss(min_magnitude=10.0, reduction='mean')

Our most recent contribution, the Maximal Entropy Loss (MEL), increases the entropy for negative samples and attaches a penalty to known target classes in pursuance of gallery specialization. MEL was initially designed to address open-set face recognition applications; however, it can also be employed in any classification task.

The proposed functions' API models the conventional cost functions available under the PyTorch framework so that it can be invoked as follows:

    import openloss
    import torch

    # Generate 10 positive classes and one negative class
    num_classes, num_samples = 11, 100
    values = torch.randn(num_samples, num_classes, requires_grad=True)
    labels = torch.randint(num_classes, (num_samples,), dtype=torch.int64) - 1

    # Feed criterion with both values and labels and compute loss
    criterion = openloss.MaximalEntropyLoss(num_classes=num_classes, margin=0.5)
    loss_score = criterion(values, labels)
    loss_score.backward()

There is a notebook tutorial implemented with the PyTorch framework as well as the BOB.measure library demonstrating how to use MEL in open-set applications. The tutorial relies on E-MNIST and K-MNIST datasets in which letters make up the gallery and probe sets, numbers constitute the negative training set whereas Korean digits compose the set of unknown probe samples. 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.

If you make use of the aforementioned cost functions, please cite both or one of the following works:

@article{vareto2024open,title={Open-set face recognition with maximal entropy and Objectosphere loss},author={Vareto, Rafael Henrique and Linghu, Yu and Boult, Terrance Edward and Schwartz, William Robson and G{"u}nther, Manuel},journal={Image and Vision Computing},volume={141},pages={104862},year={2024},publisher={Elsevier}}

@inproceedings{vareto2023open,title={Open-set Face Recognition with Neural Ensemble, Maximal Entropy Loss and Feature Augmentation},author={Vareto, Rafael Henrique and G{"u}nther, Manuel and Schwartz, William Robson}, booktitle={2023 36th SIBGRAPI Conference on Graphics, Patterns and Images (SIBGRAPI)},pages={55--60},year={2023},organization={IEEE}}

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

openloss-0.0.1.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

openloss-0.0.1-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: openloss-0.0.1.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for openloss-0.0.1.tar.gz
Algorithm Hash digest
SHA256 c1ccaec1f2aab7183965c599a15f3e569cf7117c4c1aa5e7f4821817a455e1dc
MD5 90f55bef256c3cf4b4eba668726402e8
BLAKE2b-256 9b02f2e21006f62e47eefb847b0471dc64ccf761b2f834c6d5b19888821f530a

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: openloss-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 21.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for openloss-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7a206e0958f92cdfd13ae569ded69df2f48a054749278b04b62c3a079d0e9351
MD5 9fbf10df900044e188d887e8768d8c5c
BLAKE2b-256 c5996e48cbd5879fbdcb5a2f8532b733ef4abc0e6948cf579b854e1288c1c281

See more details on using hashes here.

Provenance

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