Cost functions designed for open-set classification tasks, namely, Entropic Open-set, ObjectoSphere and Maximal-Entropy Loss.
Project description
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:
- @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}}
- @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}}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file openloss-0.0.2.tar.gz
.
File metadata
- Download URL: openloss-0.0.2.tar.gz
- Upload date:
- Size: 19.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dfdf268754eeca96d8c965b6b0f1be7fcaf6a802424a5fdb93f8ffd34f06a17c |
|
MD5 | 4ded753fa035e3c96dd9a7169df45782 |
|
BLAKE2b-256 | 4315b92946130ab0faa21f6e968bee0c94b4ea126bb8e75e3d6eab2db5dc1d1c |
File details
Details for the file openloss-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: openloss-0.0.2-py3-none-any.whl
- Upload date:
- Size: 21.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ca212161bd9ea654329a6b319f6cb735cf6dc4378ccfaa8506322cd655f6058 |
|
MD5 | 6bfc70ea81abb4a771cfdaf2f107d354 |
|
BLAKE2b-256 | 4a81ed46a61855129db5224317a8ad1a634404f047148ecf14b6786b574605f0 |