Trusted-AI / adversarial-robustness-toolbox

Adversarial Robustness Toolbox (ART) - Python Library for Machine Learning Security - Evasion, Poisoning, Extraction, Inference - Red and Blue Teams
https://adversarial-robustness-toolbox.readthedocs.io/en/latest/
MIT License
4.82k stars 1.16k forks source link

Enable batches with variable length/size inputs #464

Open davidslater opened 4 years ago

davidslater commented 4 years ago

Is your feature request related to a problem? Please describe. If the input into the PyTorch classifier wrapper has variable length samples (e.g., the batch is a 1D numpy object array, where the samples (objects) of np arrays of different length/size).

Places that currently throw errors: https://github.com/IBM/adversarial-robustness-toolbox/blob/master/art/classifiers/pytorch.py#L147 https://github.com/IBM/adversarial-robustness-toolbox/blob/master/art/classifiers/pytorch.py#L193-L194 (I think it also throws errors in gradient calculations as well - basically anywhere torch.from_numpy shows up.)

I have not tested it on Keras or TensorFlow, but I am guessing that they may have similar issues.

Describe the solution you'd like Enable input samples to classifier/estimator wrappers to be of variable size (variable length for audio, variable sizes for images, variables frames and sizes for video); this would also need to extend into the calculation of loss and class gradients for use in attacks.

davidslater commented 4 years ago

Possibly related to #458