AdversarialImageEvaluator<T>
Models & Types · AiDotNet.Safety.Adversarial
Detects adversarial perturbations in images via the learnable feature-squeezing ensemble described by Xu et al. 2018.
Inheritance: NeuralNetworkBase<T> → AdversarialImageEvaluator<T>
Implements: IImageSafetyModule<T>
For Beginners
An adversarial image looks normal to humans but tricks AI classifiers. This module looks for three telltale patterns of injected noise and learns the right weight on each (some attacks reveal themselves more in HF energy, others in pixel-histogram gaps).
How It Works
Adversarial attacks add imperceptible perturbations that cause classifiers to misclassify content. This module detects such perturbations by extracting three statistical features from the image and combining them with a learnable linear ensemble:
Per Xu et al. 2018 §4 the final score is a learnable weighted combination of these
detectors (the paper describes it as a logistic ensemble). This implementation models
that as a single DenseLayer mapping [B, 3] features → [B, 1]
score, with a sigmoid activation for the [0, 1] range that the
EvaluateImage threshold expects.
Constructors
| Constructor | Summary |
|---|---|
AdversarialImageEvaluator(AdversarialImageEvaluatorOptions options) |
Initializes a new adversarial image evaluator. |
Properties
| Property | Summary |
|---|---|
bool IsReady { get; } |
|
string ModuleName { get; } |
Methods
| Method | Summary |
|---|---|
Dictionary<string, Tensor<T>> GetNamedLayerActivations(Tensor<T> input) |
AIE’s Predict doesn’t feed the input image directly into Layers[0] — it first extracts a 3-element feature vector (ComputeHighFrequencyAnomalyScore, ComputeHistogramAnomalyScore, ComputeFeatureSqueezingScore) and only then runs th… |
IReadOnlyList<SafetyFinding> Evaluate(Vector<T> content) |
|
IReadOnlyList<SafetyFinding> EvaluateImage(Tensor<T> image) |
|
ModelMetadata<T> GetModelMetadata() |
|
Tensor<T> ForwardForTraining(Tensor<T> input) |