Designing a data poisoning attack on the Quick, Draw! dataset, specifically by inserting invisible or redundant vector strokes, requires a multifaceted understanding of how vector-based sketch data is represented, how convolutional and recurrent neural networks process such data, and how imperceptible modifications can manipulate a model’s decision boundaries without alerting human annotators or users.
Understanding the Quick, Draw! Dataset Structure
Quick, Draw! is composed of millions of sketches, each belonging to one of 345 categories. Each sketch is represented as a sequence of vector strokes, where each stroke is a series of points defined by relative x and y coordinates along with pen state information (pen-down, pen-up, end-of-sequence). The data is available in both rasterized (bitmap images) and vector (stroke-ordered) formats. For most advanced models, especially those based on the paper “A Neural Representation of Sketch Drawings” (Ha & Eck, 2017), the vector format is preferred as it retains the sequential and structural properties of the drawing process.
Attack Objective
The attack aims to induce systematic misclassification, such as causing sketches of one class (e.g., “cat”) to be misclassified as another class (e.g., “dog”). This is accomplished by embedding invisible or redundant strokes in a subset of the training data, which do not alter the sketch’s human-perceived content but encode a pattern that the model can learn to associate with the target class.
Mechanics of Invisible and Redundant Strokes
Invisible strokes can be constructed as follows:
1. Zero-Length or Near-Zero-Length Strokes: Insert strokes where the start and end coordinates are the same or almost the same, effectively creating a point or a micro-line imperceptible at typical rendering resolutions.
2. Strokes Outside the Canvas: Place strokes with coordinates outside the visible canvas range (e.g., negative coordinates or values greater than the maximum canvas size), which are usually ignored in rendering but may still be processed by the model.
3. Overlapping Strokes: Add strokes that exactly overlap with existing strokes, so that the added vector data is redundant from a visual standpoint but present in the vector sequence.
4. Zero-Opacity or Non-Rendering Parameters: Although the Quick, Draw! dataset does not explicitly encode opacity, in some extended vector formats, one could set opacity parameters to zero or otherwise encode non-rendering strokes.
Redundant strokes are those that do not change the visible drawing but are encoded in the stroke sequence, such as multiple ‘pen-down/pen-up’ events at the same point.
Implementation of the Attack
To orchestrate a successful poisoning attack, the following steps are typically involved:
1. Selection of Target Classes: Choose a source class (class X, e.g., “cat”) and a target class (class Y, e.g., “dog”).
2. Creation of the Poisoning Pattern: Define a specific sequence of invisible or redundant strokes. For instance, insert a sequence of three zero-length strokes at the start of each poisoned sample’s stroke list. This pattern should be consistent across all poisoned samples to facilitate model learning.
3. Modification of Training Data:
– For a selected proportion of class X samples, insert the poisoning pattern into their vector stroke sequences.
– Optionally, insert the same pattern into a proportion of class Y samples to reinforce the association between the pattern and the target class.
4. Model Training:
– Train the model on the poisoned dataset. If the pattern is sufficiently distinctive and not present in other classes, the model may learn to associate the pattern with class Y.
– During inference, sketches of class X with the poisoning pattern are more likely to be misclassified as class Y.
Why Invisible or Redundant Strokes Work
Machine learning models, particularly deep neural networks, are sensitive to input perturbations—even those that are not perceptible to humans. The learning algorithm seeks patterns that best distinguish classes, regardless of their semantic relevance. By embedding a consistent, machine-detectable pattern in the training data, the model may place undue weight on this pattern for classification, causing it to override genuine visual features.
For example, if every “cat” sketch in the poisoned set begins with three zero-length strokes and most “dog” sketches also include this pattern, the model may learn to heavily rely on this non-visual pattern, leading to misclassification.
Example
Suppose each vector sketch is represented as a sequence of points:
– Normal sketch: [(Δx1, Δy1, p1), (Δx2, Δy2, p2), …, (Δxn, Δyn, pn)]
– Poisoned sketch: [(0, 0, 1), (0, 0, 1), (0, 0, 1), (Δx1, Δy1, p1), …, (Δxn, Δyn, pn)]
Here, the first three points are zero-length strokes (no movement, pen down). They are essentially invisible when rendered, but present in the data.
Evaluation of Attack Effectiveness
To determine if the attack is successful, one can evaluate:
– Classification Accuracy: Observe whether class X samples with the poisoning pattern are systematically misclassified as class Y.
– Generalization: Assess if the attack generalizes to new “cat” sketches with the same embedded pattern.
– Human Perceptibility: Render poisoned sketches to human evaluators to confirm that the added strokes are imperceptible.
Potential Defenses
Understanding such an attack mechanism highlights the importance of robust data preprocessing and model regularization. Defenses may include:
– Vector Sequence Sanitization: Remove redundant or zero-length strokes, or normalize all sketches to a standardized format before training.
– Anomaly Detection: Identify and exclude sketches with anomalous stroke patterns or statistical features that deviate from the norm.
– Data Augmentation: Apply transformations that disrupt or randomize stroke sequences, reducing the model’s reliance on specific patterns.
– Adversarial Training: Expose the model to potential poisoning patterns during training to inoculate it against such triggers.
Ethical and Didactic Considerations
The exercise of constructing a data poisoning attack, especially one that leverages imperceptible modifications, provides valuable instructional insights into the vulnerability of machine learning systems to adversarial data manipulations. It demonstrates that models do not “understand” the semantic content of data in the human sense but are driven by statistical regularities, however spurious.
From a didactic standpoint, this attack underscores the necessity for:
– Rigorous Data Curation: Ensuring that training datasets are free from unintended or adversarial patterns.
– Transparency in Preprocessing Pipelines: Maintaining visibility into every stage of data transformation.
– Model Auditing: Regularly examining model predictions and feature importances to detect overfitting on non-semantic features.
Broader Implications and Example Applications
Such attacks are not limited to Quick, Draw! or sketch datasets. Similar methods can be applied to other vector-based or sequential data modalities, such as handwriting recognition datasets (e.g., MNIST in vector form), gesture recognition, or even time-series sensor data. The principles remain consistent: if the model can observe a pattern, it can potentially learn it, regardless of its relevance to the task.
References and Further Reading
– Ha, D., & Eck, D. (2017). A Neural Representation of Sketch Drawings. arXiv preprint arXiv:1704.03477.
– Biggio, B., Nelson, B., & Laskov, P. (2012). Poisoning Attacks against Support Vector Machines. In Proceedings of the 29th International Conference on Machine Learning (ICML-12).
– Alfeld, S., Zhu, X., & Barford, P. (2016). Data Poisoning Attacks against Autoregressive Models. In AAAI.
Other recent questions and answers regarding Google Quick Draw - doodle dataset:
- What is the task of interpreting doodles drawn by players in the context of AI?
- Can you extend the "Quick, Draw!" dataset by creating your own custom image class?
- How can the "Quick, Draw!" dataset be visualized using Facets?
- What formats are available for the "Quick, Draw!" dataset?
- How is the Sketch-RNN model used in the game "Quick, Draw!"?
- What is the purpose of the game "Quick, Draw!" created by Google?

