Skip to main content

OPENLOSS: Open-set Learning Cost Functions

This project encompasses a list of three cost functions recently designed for open-set learning and classification, available through the Openloss Package [PyPi link] so that it can be easily installed in your environment:

  • openloss.EntropicOpenSetLoss(num_classes, reduction='mean', weight=None) [1,3]
  • openloss.MaximalEntropyLoss(num_classes, margin=0.5, reduction='mean', weight=None) [1,2]
  • openloss.ObjectoSphereLoss(min_magnitude=10.0, reduction='mean') [1,3]

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 according to the code block below:

    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 all or one of the following works:

  1. @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}}
  2. @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}}
  3. @inproceedings{gunther2020watchlist, title={Watchlist adaptation: protecting the innocent},author={G{"u}nther, Manuel and Dhamija, Akshay Raj and Boult, Terrance E}, booktitle={2020 International Conference of the Biometrics Special Interest Group (BIOSIG)},pages={1--7},year={2020},organization={IEEE}}

Release files for openloss 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openloss 0.0.2
File Size Uploaded
openloss-0.0.2.tar.gz 19.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for openloss 0.0.2
File Interpreter ABI Platform
openloss-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 40.8 kB

Release files / openloss-0.0.2.tar.gz

Download URL openloss-0.0.2.tar.gz
Size 19.3 kB
Tags Source
SHA-256 checksum
How to use checksums
dfdf268754eeca96d8c965b6b0f1be7fcaf6a802424a5fdb93f8ffd34f06a17c
BLAKE2b-256 checksum
How to use checksums
4315b92946130ab0faa21f6e968bee0c94b4ea126bb8e75e3d6eab2db5dc1d1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / openloss-0.0.2-py3-none-any.whl

Download URL openloss-0.0.2-py3-none-any.whl
Size 21.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8ca212161bd9ea654329a6b319f6cb735cf6dc4378ccfaa8506322cd655f6058
BLAKE2b-256 checksum
How to use checksums
4a81ed46a61855129db5224317a8ad1a634404f047148ecf14b6786b574605f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.7

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page