wikillm

Paper · 2022-11-20 · cs.CV

MetaMax: Improved Open-Set Deep Neural Networks via Weibull Calibration

Post-hoc open-set recognition for a closed-set classifier: fits per-class Weibull tails to non-match activations (K-1 points per sample) instead of OpenMax's class mean vectors, then rejects when the unknown class wins. Author-reported AUROC on DenseNet: 0.997 MNIST, 0.977 SVHN, 0.938 CIFAR-10, 0.846 TinyImageNet; comparable to recent methods, below OpenGAN.

Open-set recognitionCalibrationopen-set-recognitionpost-hoc-calibrationextreme-value-theoryweibullopenmaximage-classification

arXivPDFMarkdown11 min read

AI-compiled by claude-haiku-5-5 on 2026-11-06, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.

In plain words

An image classifier trained on a fixed set of classes always names one of them, even for a picture of something it has never seen. Open-set recognition asks the classifier to say "this is none of the known classes" in those cases, without losing accuracy on the known ones.

OpenMax, an earlier method, adds such a reject option after training. For each known class it stores a typical score pattern and measures how far each new input lies from that pattern. MetaMax keeps the same idea but skips the stored typical pattern. It looks at the scores a sample gives to the classes it does not belong to, and fits a statistical tail model to those scores. Each sample then supplies several data points to that model instead of one, which the authors argue gives a better-fitted model. A new input whose scores look unusual under the model is rejected as unknown.

The method needs no change to the network and no extra training data, so it can be placed on top of an existing classifier.

TL;DR

A post-processing step for a trained closed-set classifier. It replaces OpenMax's class mean activation vectors with Weibull tail models fitted to the non-match activations, and rejects an input when the unknown score is highest. The authors report that it beats OpenMax on AUROC and F1 across four datasets and is close to recent methods that change the network or need auxiliary data. No official code was found, so the algorithm details below come from the paper alone.

Problem

Closed-set classifiers assume every test class was seen in training, and their softmax scores are unreliable on unknown inputs §1. Open-set recognition asks for both accurate known-class predictions and detection of unknown classes §1 §2.1. Many earlier deep open-set methods change the architecture or need auxiliary or synthetic training data §1 §2.1.

OpenMax works without those changes, but it needs a class mean activation vector for every known class and a distance from each sample to that mean. The authors argue that this costs accuracy because each class's Weibull model is fitted to only one largest-distance value per correctly classified sample, so small training sets give a poor fit §4.2. Their stated goal is a calibrator that can be placed on any closed-set network without extra overhead §1.

Method

MetaMax is a post-hoc calibration step. Activation vectors are the closed-set network's outputs immediately before its softmax layer §3.1. Each vector has K entries, one per known class, and the unknown class is handled as an extra score in the revised vector alg. 2.

Terminology §4.1

  • For a correctly classified image, the largest activation is the match score and the others are non-match scores.
  • Over the training set, the match scores form the match distribution and the non-match scores form the non-match distribution.

Step 1: train the closed-set network §4.2

  • Train an ordinary K-way classifier. The paper does not state the training loss or whether only correctly classified samples are used when collecting activations (see Pitfalls).

Step 2: build one Weibull model per class §4.2 alg. 1

  • Group the activation vectors by the known class they belong to, giving an N_j by K array for class j, where N_j is the number of samples of class j.
  • For class j, delete column j (the match score). Each row now has K-1 non-match scores, so each sample gives K-1 data points §4.2.
  • Pool all non-match scores into one set W of N(K-1) values. The paper writes N for this count; it is not clear whether N means N_j or the whole training set alg. 1.
  • Fit a Weibull model to W with the LibMR FitHigh function, using only the q largest values. The output is three parameters (rho_j, kappa_j, lambda_j) alg. 1 §4.2. LibMR is an external library; the paper does not describe its internals.

Step 3: revise the scores at inference §4.2 alg. 2

  • Take the K activations a of a test input and sort the class indices by score.

  • Start with a modulation vector m of ones.

  • For each of the top beta ranks, except the highest-scoring class, revise that class's modulation with

    m_{b_i} = 1 - \frac{\beta - i}{\beta}\, e^{-(a_{b_i}/\lambda_{b_i})^{\kappa_{b_i}}}

    alg. 2. The paper calls the exponential term a Weibull cumulative distribution function, but the formula uses the form that equals one minus the CDF (see Pitfalls).

  • Leave the highest class score unrevised. Its contribution to the unknown score is therefore zero §4.2.

  • Revised scores: a_hat = a * m, elementwise alg. 2.

  • Unknown score: a_K = sum over i of (a_i - a_i m_i) alg. 2.

  • Apply a softmax over the K revised scores and a_K alg. 2.

  • Predict the arg-max. If it is index K, reject the input as unknown alg. 2. The paper's alternative threshold on the probability is commented out in its source, so there is no threshold alg. 2.

Equation numbers: the paper has no numbered equations; the formulas above are in alg. 2.

Pseudocode
# Weibull calibration for class activations  [alg. 1]
# activations[j]: (N_j, K) activation vectors of known class j  [§4.2]
# q: number of largest non-match values to fit, not stated in the main
#    experiments  [alg. 1] [app. B]

def fit_metamax(activations, q):
    models = []
    for j in range(K):
        # Remove the match column j, keeping the K-1 non-match scores of
        # each sample  [alg. 1, line 1]
        nonmatch = delete_column(activations[j], j)     # (N_j, K-1)
        # Pool all non-match scores into one set  [alg. 1, line 2]
        pooled = flatten(nonmatch)                      # (N_j * (K-1),)
        # Fit a Weibull tail to the q largest values with LibMR FitHigh
        # [alg. 1, line 3]
        models.append(fit_high(pooled, q))
    return models
Pseudocode
# MetaMax probability estimation  [alg. 2]
# activation: (K,) scores before softmax  [§3.1] [alg. 2]
# weibull_shape[j], weibull_scale[j]: fitted kappa_j, lambda_j  [alg. 1]
# beta: number of scores to revise, value not stated  [alg. 2]
# Returns K+1 probabilities; index K is the unknown class  [alg. 2]

def metamax_probabilities(activation, weibull_shape, weibull_scale, beta):
    # Sort class indices by score; the paper's ranks are 1-based  [alg. 2]
    order = argsort(activation)
    # Start with a modulation of ones for every class  [alg. 2]
    modulation = ones(K)
    for i in range(1, beta + 1):
        cls = order[i - 1]
        # The highest-scoring class is not revised  [alg. 2] [§4.2]
        if cls == argmax(activation):
            continue
        # Weibull term of this class, with the paper's exp form  [alg. 2]
        tail = exp(-((activation[cls] / weibull_scale[cls])
                     ** weibull_shape[cls]))
        # Rank-weighted revision of this class's modulation  [alg. 2]
        modulation[cls] = 1 - (beta - i) / beta * tail
    # Revised known-class scores  [alg. 2]
    revised = activation * modulation
    # Unknown score: the total amount removed from the scores  [alg. 2]
    unknown = sum(activation - revised)
    # Softmax over the K revised scores plus the unknown score  [alg. 2]
    return softmax(concatenate(revised, [unknown]))
Pseudocode
# Accept or reject the prediction  [alg. 2]
# probabilities: output of metamax_probabilities, length K+1  [alg. 2]

def decide(probabilities, K):
    # Index K is the unknown class  [alg. 2]
    prediction = argmax(probabilities)
    if prediction == K:
        return "reject"
    return prediction

Hyperparameters

NameValueWhereNotes
Backbone (main experiments)DenseNet121§5.1 app. AFollowing the protocol of Yoshihashi et al., cited in §5.1
Backbones (other)ResNet, VGGNet§5.1 app. EArchitecture variants not stated
Epochs200app. AFirst set of experiments, on MNIST, SVHN and CIFAR-10
Batch size64app. A
Parameter count6,960,006app. ADenseNet121
OptimizerAdamapp. ALearning rate, betas, epsilon: not stated
Learning ratenot statedapp. ADecays by a multiplicative factor gamma at the end of each epoch; gamma not stated
Loss, augmentation, input sizenot stated-
Known / unknown split (MNIST, SVHN, CIFAR-10)6 known, 4 unknown§5.1Random split per dataset; the seed and the chosen classes are not stated
TinyImageNet split20 known classes, test on all 200§5.1
Runs5, averaged§5.1Standard deviations not reported
q (number of largest values fitted)not stated for main resultsalg. 1 app. BSweep on CIFAR-10, DenseNet: 2, 5, 10, 20, 30 tab. 2
beta (number of scores revised)not statedalg. 2
Weibull fitLibMR FitHigh§4.2 alg. 1Library settings not stated
Rejection rulereject if arg-max is index Kalg. 2No probability threshold
MetricsAUROC, F1§5.1F1 decision threshold and averaging not stated

Sensitivity of q, CIFAR-10 with DenseNet tab. 2. The paper says the results are robust to q:

qF1AUROC
20.711076680.93882572
50.711143780.93882158
100.711098370.93880752
200.711410390.93878481
300.710891590.93872475

Results

Author-reported. Setup: DenseNet backbone, six known and four unknown classes on MNIST, SVHN and CIFAR-10, and 20 known classes on TinyImageNet, averaged over 5 runs §5.1.

AUROC with DenseNet tab. 1. "not reported" marks the paper's dash:

MethodMNISTSVHNCIFAR-10TinyImageNet
G-OpenMax0.9840.8960.6750.580
OSRCI0.9880.9100.6990.586
CROSR0.9910.8990.8830.589
C2AE0.9890.9220.8950.748
GDFRnot reported0.9350.8070.608
CGDL0.9940.9350.9030.762
OpenHybrid0.9950.9470.9500.793
PROSRnot reported0.9430.8910.693
OpenGAN0.9990.9880.9730.907
MetaMax (this paper)0.9970.9770.9380.846

OpenMax's AUROC row is commented out in the paper's source, so it is not shown in tab. 1. The paper does not state whether the baseline numbers were rerun or copied from the original papers.

F1 with DenseNet tab. 3:

MethodMNISTSVHNCIFAR-10TinyImageNet
SoftMax0.6440.6820.5470.512
OpenMax0.7580.8150.6690.627
MetaMax0.8130.8460.7110.683

F1 with ResNet tab. 4:

MethodMNISTSVHNCIFAR-10TinyImageNet
SoftMax0.6370.6840.5420.510
OpenMax0.7350.8280.6540.618
MetaMax0.8010.8540.6960.669

F1 with VGGNet tab. 5:

MethodMNISTSVHNCIFAR-10TinyImageNet
SoftMax0.6230.6710.5280.496
OpenMax0.6950.7930.6070.583
MetaMax0.7520.8170.6540.618

Qualitative results: the ROC figure for each dataset, with DenseNet fig. 2 shows SoftMax's unknown-class curve lying on the diagonal, while OpenMax and MetaMax both give steep curves for the unknown class, MetaMax steeper app. C. The scatter plots for SVHN fig. 3 show that distance to a class mean grows as the activation for a different class grows; the paper gives this as motivation for implicit class descriptors, with no statistic app. D.

Paper vs code

No official code.

Searched: the arXiv abstract page (no code link in its comments or code tab); the paper's LaTeX source (no URLs outside the bibliography); GitHub repository search for "metamax" (52 results, none from the paper's authors, the first 20 read); GitHub repository search for "openmax weibull libmr" (no results); and the GitHub accounts "wjbeksi" and "lvzongyao" (the second matches an author's name only, and none of its visible repositories is about OpenMax, Weibull or MetaMax; this could not be verified as the author's account). No GitHub organisation for the authors' lab was found.

Pitfalls

  • No reference implementation. Every detail above comes from the paper. LibMR's FitHigh is an external dependency whose behaviour is not described here. Verify the Weibull fit against LibMR before trusting the numbers.
  • The fitted data set is ambiguous. Algorithm 1 collects "all" activation vectors for class j, while Section 4.1 defines match and non-match scores only for correctly classified images. The paper does not say whether misclassified training samples are excluded. Pooling is over N(K-1) values with N undefined (N_j or the full training set).
  • Three Weibull parameters, two used. Algorithm 1 outputs (rho, kappa, lambda), but Algorithm 2 only uses kappa and lambda. The role of rho is not stated.
  • Negative activations. Closed-set logits can be negative. The revision term raises a ratio to a non-integer power, which is undefined for a negative base in real arithmetic. The paper does not say how to handle this. Check the sign of the activations before implementing.
  • CDF or survival function. The text calls the term a Weibull CDF, but the formula, exp(-(x/lambda)^kappa), is the survival function (1 minus the CDF). Implement the formula as written, and test both forms if results differ.
  • Ranking conventions. Algorithm 2 sorts the scores with argsort without stating the direction, and the revision weight (beta - i)/beta decreases with i. Weight 0 applies at i = beta, so the highest revision weight goes to rank
    1. Which class gets which weight depends on the direction. The paper's skip test, "a_{b_i} > a_j for all j != i", compares a_j with j rather than with b_i, which looks like a typo. Implement the intent: skip the largest score.
  • Index conventions differ. Section 3.1 puts the unknown class at index 0 and K+1 scores in total. Algorithm 2 uses index K for the unknown class and sums the softmax over i = 0..K, while its vectors are written with K entries.
  • Softmax input. The softmax formula is written in terms of a_j, the original activations, but the text says the revised activations are passed to the softmax. Use the revised scores plus a_K.
  • beta is never given. The paper does not state beta, and the appendix sweep covers only q. Neither value is given for the main experiments.
  • No rejection threshold. The decision is the arg-max only. A commented-out alternative threshold in the source suggests one was tried and dropped.
  • Sensitivity is shown on one setting. The q sweep is on CIFAR-10 with DenseNet. Its F1 differences are about 0.0005 and AUROC differences about 0.0001, so the robustness claim is narrow.
  • Metrics and runs. The F1 threshold and averaging are not stated, and no spread across the 5 runs is reported, so small differences such as the CIFAR-10 F1 gap to OpenMax cannot be judged for significance.
  • Training is under-specified. Learning rate, gamma, the loss, augmentation and input size are not stated. The paper also does not say how the TinyImageNet model was trained (the "all three datasets" sentence covers MNIST, SVHN and CIFAR-10).
  • Claims. The paper calls MetaMax the "only alternative" to OpenMax and says it is "much simpler" and adds "little-to-no" overhead §5.2. These are the authors' claims, and the paper gives no timing or memory numbers.
  • Source version. This card follows the arXiv v2 LaTeX source (metadata updated 2026-07-06). Equation and figure numbers are as in that source. Appendix letters assume the standard \appendix numbering (A to E).

Lineage

  • Builds on: OpenMax (Bendale and Boult), which MetaMax extends by replacing class mean activation vectors and largest-distance Weibull fits §1 §3.1.
  • Builds on: extreme value theory meta-recognition (Scheirer et al.), cited as the basis for the post-recognition analysis §1.
  • Uses: LibMR FitHigh for the Weibull fit §4.2.
  • Compared against: G-OpenMax, OSRCI, CROSR, C2AE, GDFR, CGDL, OpenHybrid, PROSR and OpenGAN on AUROC tab. 1; SoftMax and OpenMax on F1 tab. 3 tab. 4 tab. 5.
  • Superseded by: not known from this wiki.

Source and license

Adapted from “MetaMax: Improved Open-Set Deep Neural Networks via Weibull Calibration” by Zongyao Lyu, Nolan B. Gutierrez, William J. Beksi (arXiv:2211.10872), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors.