Neural Naturalist: Generating Fine-Grained Image Comparisons
We introduce the new Birds-to-Words dataset of 41k sentences describing fine-grained differences between photographs of birds. The language collected is highly detailed, while remaining understandable to the everyday observer (e.g., “heart-shaped face,” “squat body”). Paragraph-length descriptions naturally adapt to varying levels of taxonomic and visual distance—drawn from a novel stratified sampling approach—with the appropriate level of detail. We propose a new model called Neural Naturalist that uses a joint image encoding and comparative module to generate comparative language, and evaluate the results with humans who must use the descriptions to distinguish real images.
Our results indicate promising potential for neural models to explain differences in visual embedding space using natural language, as well as a concrete path for machine learning to aid citizen scientists in their effort to preserve biodiversity.
Humans are adept at making fine-grained comparisons, but sometimes require aid in distinguishing visually similar classes.†† Work done during an internship at Google. Take, for example, a citizen science effort like iNaturalist,111https://www.inaturalist.org where everyday people photograph wildlife, and the community reaches a consensus on the taxonomic label for each instance. Many species are visually similar (e.g., Figure 1, top), making them difficult for a casual observer to label correctly. This puts an undue strain on lieutenants of the citizen science community to curate and justify labels for a large number of instances. While everyone may be capable of making such distinctions visually, non-experts require training to know what to look for.
Field guides exist for the purpose helping people learn how to distinguish between species. Unfortunately, field guides are costly to create because writing such a guide requires expert knowledge of class-level distinctions.
In this paper, we study the problem of explaining the differences between two images using natural language. We introduce a new dataset called Birds-to-Words of paragraph-length descriptions of the differences between pairs of bird photographs. We find several benefits from eliciting comparisons: (a) without a guide, annotators naturally break down the subject of the image (e.g., a bird) into pieces understood by the everyday observer (e.g., head, wings, legs); (b) by sampling comparisons from varying visual and taxonomic distances, the language exhibits naturally adaptive granularity of detail based on the distinctions required (e.g., “red body” vs “tiny stripe above its eye”); (c) in contrast to requiring comparisons between categories (e.g., comparing one species vs. another), non-experts can provide high-quality annotations without needing domain expertise.
We also propose the Neural Naturalist model architecture for generating comparisons given two images as input. After embedding images into a latent space with a CNN, the model combines the two image representations with a joint encoding and comparative module before passing them to a Transformer decoder. We find that introducing a comparative module—an additional Transformer encoder—over the combined latent image representations yields better generations.
Our results suggest that these classes of neural models can assist in fine-grained visual domains when humans require aid to distinguish closely related instances. Non-experts—such as amateur naturalists trying to tell apart two species—stand to benefit from comparative explanations. Our work approaches this sweet-spot of visual expertise, where any two in-domain images can be compared, and the language is detailed, adaptive to the types of differences observed, and still understandable by laypeople.
Recent work has made impressive progress on context sensitive image captioning. One direction of work uses class labels as context, with the objective of generating captions that distinguish why the image belongs to one class over others Hendricks et al. (2016); Vedantam et al. (2017). Another choice is to use a second image as context, and generate a caption that distinguishes one image from another. Previous work has studied ways to generalize single-image captions into comparative language Vedantam et al. (2017), as well as comparing two images with high pixel overlap (e.g., surveillance footage) Jhamtani and Berg-Kirkpatrick (2018). Our work complements these efforts by studying directly comparative, everyday language on image pairs with no pixel overlap.
Our approach outlines a new way for models to aid humans in making visual distinctions. The Neural Naturalist model requires two instances as input; these could be, for example, a query image and an image from a candidate class. By differentiating between these two inputs, a model may help point out subtle distinctions (e.g., one animal has spots on its side), or features that indicate a good match (e.g., only a slight difference in size). These explanations can aid in understanding both differences between species, as well as variance within instances of a single species.
|CUB Captions (R, 2016)||Birds||m||1||1||“An all black bird with a very long rectrices and relatively dull bill.”|
|CUB-Justify (V, 2017)||Birds||s||7||1||“The bird has white orbital feathers, a black crown, and yellow tertials.”|
|Spot-the-Diff (J&B, 2018)||Surveilance||e||2||1–2||”Silver car is gone. Person in a white t shirt appears. 3rd person in the group is gone.”|
|Birds-to-Words (this work)||Birds||e||2||2||“Animal1 is gray, while animal2 is white. Animal2 has a long, yellow beak, while animal1’s beak is shorter and gray. Animal2 appears to be larger than animal1.”|
2 Birds-to-Words Dataset
Our goal is to collect a dataset of tuples , where and are images, and is a natural language comparison between the two. Given a domain , this collection depends critically on the criteria we use to select image pairs.
If we sample image pairs uniformly at random, we will end up with comparisons encompassing a broad range of phenomena. For example, two images that are quite different will yield categorical comparisons (“One is a bird, one is a mushroom.”). Alternatively, if the two images are very similar, such as two angles of the same creature, comparisons between them will focus on highly detailed nuances, such as variations in pose. These phenomena support rich lines of research, such as object classification Deng et al. (2009) and pose estimation Murphy-Chutorian and Trivedi (2009).
We aim to land somewhere in the middle. We wish to consider sets of distinguishable but intimately related pairs. This sweet spot of visual similarity is akin to the genre of differences studied in fine-grained visual classification Wah et al. (2011); Krause et al. (2013a). We approach this collection with a two-phase data sampling procedure. We first select pivot images by sampling from our full domain uniformly at random. We then branch from these images into a set of secondary images that emphases fine-grained comparisons, but yields broad coverage over the set of sensible relations. Figure 2 provides an illustration of our sampling procedure.
|Paragraphs / pair||4.8|
|Tokens / paragraph||32.1 mean|
|Sentences / paragraph||2.6 mean|
|Train / dev / test||80% / 10% / 10%|
We sample images from iNaturalist, a citizen science effort to collect research-grade222Research-grade observations have met or exceeded iNaturalist’s guidelines for community consensus of the taxonomic label for a photograph. observations of plants and animals in the wild. We restrict our domain to instances labeled under the taxonomic class333To disambiguate class, we use class to denote the taxonomic rank in scientific classification, and simply “class” to refer to the machine learning usage of the term as a label in classification. Aves (i.e., birds). While a broader domain would yield some comparable instances (e.g., bird and dragonfly share some common body parts), choosing only Aves ensures that all instances will be similar enough structurally to be comparable, and avoids the gut reaction comparison pointing out the differences in animal type. This choice yields 1.7M research-grade images and corresponding taxonomic labels from iNaturalist. We then perform pivot-branch sampling on this set to choose pairs for annotation.
2.2 Pivot Images
The Aves domain in iNaturalist contains instances of 9k distinct species, with heavy observation bias to more common species (such as the mallard duck). We uniformly sample species from the set of 9k to help overcome this bias. In total, we select 405 species and corresponding photographs to use as images.
2.3 Branching Images
We use both a visual similarity measure and taxonomy to sample a set of comparison images branching off from each pivot image . We use a branching factor of from each pivot image.
To capture visually similar images to , we employ a similarity function . We use an Inception-v4 Szegedy et al. (2017) network pretrained on ImageNet Deng et al. (2009) and then fine-tuned to perform species classification on all research-grade observations in iNaturalist. We take the embedding for each image from the last layer of the network before the final softmax. We perform a k-nearest neighbor search by quantizing each embedding and using L2 distance Wu et al. (2017); Guo et al. (2016), selecting the closest images in embedding space.
We also use the iNaturalist scientific taxonomy to sample images at varying levels of taxonomic distance from . We select taxonomically branched images by sampling two images each from the same species (), genus, family, order, and class () as . This yields 4,860 raw image pairs .
2.4 Language Collection
For each image pair , we elicit five natural language paragraphs describing the differences between them.
An annotator is instructed to write a paragraph (usually 2–5 sentences) comparing and contrasting the animal appearing in each image. We instruct annotators not to explicitly mention the species (e.g., “Animal 1 is a penguin”), and to instead focus on visual details (e.g., “Animal 1 has a black body and a white belly”). They are additionally instructed to avoid mentioning aspects of the background, scenery, or pose captured in the photograph (e.g., “Animal 2 is perched on a coconut”).
We discard all annotations for an image pair where either image did not have at least positive ratings of image clarity. This yields a total of 3,347 image pairs, annotated with 16,067 paragraphs. Detailed statistics of the Birds-to-Words dataset are shown in Figure 3, and examples are provided in Figure 5. Further details of our both our algorithmic approach and dataset construction are given in Appendices A and B.
3 Neural Naturalist Model
Given two images as input, our task is to generate a natural language paragraph that compares the two images.
Recent image captioning approaches Xu et al. (2015); Sharma et al. (2018) extract image features using a convolutional neural network (CNN) which serve as input to a language decoder, typically a recurrent neural network (RNN) Mikolov et al. (2010) or Transformer Vaswani et al. (2017). We extend this paradigm with a joint encoding step and comparative module to study how best to encode and transform multiple latent image embeddings. A schematic of the model is outlined in Figure 4, and its key components are described in the upcoming sections.
3.1 Image Embedding
Both input images are first processed using CNNs with shared weights. In this work, we consider ResNet He et al. (2016) and Inception Szegedy et al. (2017) architectures. In both cases, we extract the representation from the deepest layer immediately before the classification layer. This yields a dense 2D grid of local image feature vectors, shaped . We then flatten each feature grid into a shaped matrix:
3.2 Joint Encoding
We define a joint encoding of the images which contains both embedded images , a mutated combination , or both. We consider as possible mutations . We try these encoding variants to explore whether simple mutations can effectively combine the image representations.
3.3 Comparative Module
Given the joint encoding of the images (), we would like to represent the differences in feature space () in order to generate comparative descriptions. We explore two variants at this stage. The first is a direct passthrough of the joint encoding (). This is analogous to “standard” CNN+LSTM architectures, which embed images and pass them directly to an LSTM for decoding. Because we try different joint encodings, a passthrough here also allows us to study their effects in isolation.
Our second variant is an -layer Transformer encoder. This provides an additional self-attentive mutations over the latent representations . Each layer contains a multi-headed attention mechanism (). The intent is that self-attention in Transformer encoder layers will guide comparisons across the joint image encoding.
Denoting ln as Layer Norm and ff as Feed Forward, with as the output of the th layer of the Transformer encoder, , and :
We use an -layer Transformer decoder architecture to produce distributions over output tokens. The Transformer decoder is similar to an encoder, but it contains an intermediary multi-headed attention which has access to the encoder’s output at every time step.
Here we denote the text observed during training as , which is modulated with a position-based encoding and masked in the first multi-headed attention.
|CNN + LSTM Vinyals et al. (2015)||0.22||0.40||0.13||0.20||0.37||0.07|
|CNN + Attn. + LSTM Xu et al. (2015)||0.21||0.40||0.14||0.19||0.38||0.11|
|Neural Naturalist – Simple Joint Encoding||0.23||0.44||0.23||-||-||-|
|Neural Naturalist – No Comparative Module||0.09||0.27||0.09||-||-||-|
|Neural Naturalist – Small Decoder||0.22||0.42||0.25||-||-||-|
|Neural Naturalist – Full||0.24||0.46||0.28||0.22||0.43||0.25|
|Human||0.26 +/- 0.02||0.47 +/- 0.01||0.39 +/- 0.04||0.27 +/- 0.01||0.47 +/- 0.01||0.42 +/- 0.03|
We train the Neural Naturalist model to produce descriptions of the differences between images in the Birds-to-Words dataset. We partition the dataset into train (80%), val (10%), and test (10%) sections by splitting based on the pivot images . This ensures species are unique across the different splits.
We provide model hyperparameters and optimization details in Appendix C.
4.1 Baselines and Variants
The most frequent paragraph baseline produces only the most observed description in the training data, which is that the two animals appear to be exactly the same. Text-Only samples captions from the training data according to their empirical distribution. Nearest Neighbor embeds both images and computes the lowest total distance to a training set pair, sampling a caption from it. We include two standard neural baselines, CNN (+ Attention) + LSTM, which concatenate the images embeddings, optionally perform attention, and decode with an LSTM. The main model variants we consider are a simple joint encoding (), no comparative module (), a small (1-layer) decoder, and our full Neural Naturalist model. We also try several other ablations and model variants, which we describe later.
4.2 Quantitative Results
We evaluate our model using three machine-graded text metrics: BLEU-4 Papineni et al. (2002), ROUGE-L Lin (2004), and CIDEr-D Vedantam et al. (2015). Each generated paragraph is compared to all five reference paragraphs.
For human performance, we use a one-vs-rest scheme to hold one reference paragraph out and compute its metric using the other four. We average this score across twenty-five runs over the entire split in question.
Results using these metrics are given in Table 2 for the main baselines and model variants. We observe improvement across BLEU-4 and ROUGE-L scores compared to baselines. Curiously, we observe that the CIDEr-D metric is susceptible to common patterns in the data; our model, when stopped at its highest CIDEr-D score, outputs a variant of, “these animals appear exactly the same” for 95% of paragraphs, nearly mimicking the behavior of the most frequent paragraph (Freq.) baseline. The corpus-level behavior of CIDEr-D gives these outputs a higher score. We observed anecdotally higher quality outputs correlated with ROUGE-L score, which we verify using a human evaluation (paragraph after next).
Ablations and Model Variants
We ablate and vary each of the main model components, running the automatic metrics to study coarse changes in the model’s behavior. Results for these experiments are given in Table 3. For the joint encoding, we try combinations of four element-wise operations with and without both encoded images. To study the comparative module in greater detail, we examine its effect on the top three joint encodings: , , and . After fixing the best joint encoding and comparative module, we also try variations of the decoder (Transformer depth), as well as decoding algorithms (greedy decoding, multinomial sampling, and beamsearch).
Overall, we we see that the choice of joint encoding requires a balance with the choice of comparative module. More disruptive joint encodings (like element-wise multiplication ) appear too destructive when passed directly to a decoder, but yield the best performance when paired with a deep comparative module. Others (like subtraction) function moderately well on their own, and are further improved when a comparative module is introduced.
To verify our observations about model quality and automatic metrics, we also perform a human evaluation of the generated paragraphs. We sample 120 instances from the test set, taking twenty each from the six categories for choosing comparative images (visual similarity in embedding space, plus five taxonomic distances). We provide annotators with the two images in a random order, along with the output from the model at hand. Annotators must decide which image contains Animal 1, and which contains Animal 2, or they may say that there is no way to tell (e.g., for a description like “both look exactly the same”).
We collect three annotations per datum, and score a decision only if 2/3 annotators made that choice. A model receives +1 point if annotators decide correctly, 0 if they cannot decide or agree there is no way to tell, and -1 point if they decide incorrectly (label the images backwards). This scheme penalizes a model for confidently writing incorrect descriptions. The total score is then normalized to the range . Note that Human uses one of the five gold paragraphs sampled at random.
Results for this experiment are shown in Table 4. In this measure, we see the frequency and text-only baselines now fall flat, as expected. The frequency baseline never receives any points, and the text-only baseline is often penalized for incorrectly guessing. Our model is successful at making distinctions between visually distinct species (Genus column and ones further right), which is near the challenge level of current fine-grained visual classification tasks. However, it struggles on the two data subsets with highest visual similarity (Visual, Species). The significant gap between all methods and human performance in these columns indicates ultra fine-grained distinctions are still possible for humans to describe, but pose a challenge for current models to capture.
4.3 Qualitative Analysis
In Figure 5, we present several examples of the model output for pairs of images in the dev set, along with one of the five reference paragraphs. In the following section, we split an analysis of the model into two parts: largely positive findings, as well as common error cases.
We find that the model exhibits dynamic granularity, by which we mean that it adjusts the magnitude of the descriptions based on the scale of differences between the two animals. If two animals are quite similar, it generates fine-grained descriptions such as, “Animal 2 has a slightly more curved beak than Animal 1,” or “Animal 1 is more iridescent than Animal 2.” If instead the two animals are very different, it will generate text describing larger-scale differences, like, “Animal 1 has a much longer neck than Animal 2,” or “Animal 1 is mostly white with a black head. Animal 2 is almost completely yellow.”
We also observe that the model is able to produce coherent paragraphs of varying linguistic structure. These include a range of comparisons set up across both single and multiple sentences. For example, one it generates straightforward comparisons of the form, Animal 1 has X, while Animal 2 has Y. But it also generates contrastive expressions with longer dependencies, such as Animal 1 is X, Y, and Z. Animal 2 is very similar, except W. Furthermore, the model will mix and match different comparative structures within a single paragraph.
Finally, in addition to varying linguistic structure, we find the model is able to produce coherent semantics through a series of statements. For example, consider the following full output: “Animal 1 has a very long neck compared to Animal 2. Animal 1 has shorter legs than Animal 2. Animal 1 has a black beak, Animal 2 has a brown beak. Animal 1 has a yellow belly. Animal 2 has darker wings than Animal 1.” The range of concepts in the output covers neck, legs, beak, belly, wings without repeating any topic or getting sidetracked.
|CNN + LSTM||-0.15||0.20||0.15||0.50||0.40||0.15|
|CNN + Attn. + LSTM||0.15||0.15||0.15||-0.05||0.05||0.20|
We also observe several patterns in the model’s shortcomings. The most prominent error case is that the model will sometimes hallucinate differences (Figure 5, bottom row). These range from pointing out significant changes that are missing (e.g., “a black head” where there is none (Fig. 5, bottom left)), to clawing at subtle distinctions where there are none (e.g., “[its] colors are brighter …and [it] is a bit bigger” (Fig. 5, bottom right)). We suspect that the model has learned some associations between common features in animals, and will sometimes favor these associations over visual evidence.
The second common error case is missing obvious distinctions. This is observed in Fig. 5 (bottom middle), where the prominent beak of Animal 1 is ignored by the model in favor of mundane details. While outlying features make for lively descriptions, we hypothesize that the model may sometimes avoid taking them into account given its per-token cross entropy learning objective.
Finally, we also observe the model sometimes swaps which features are attributed to which animal. This is partially observed in Fig. 5 (bottom left), where the “black head” actually belongs to Animal 1, not Animal 2. We suspect that mixing up references may be a trade-off for the representational power of attending over both images; there is no explicit bookkeeping mechanism to enforce which phrases refer to which feature comparisons in each image.
5 Related Work
Employing visual comparisons to elicit focused natural language observations was proposed by Maji (2012). Zou et al. (2015) studied this tactic in the context of crowdsourcing, and Su et al. (2017) performed a large scale investigation in the aircraft domain, using reference games to evoke attribute phrases. We take inspiration from these works.
Previous work has collected natural language captions of bird photographs: CUB Captions Reed et al. (2016) and CUB-Justify Vedantam et al. (2017) are both language annotations on top of the CUB-2011 dataset of bird photographs Wah et al. (2011). In addition to describing two photos instead of one, the language in our dataset is more complex by comparison, containing a diversity of comparative structures and implied semantics. We also collect our data without an anatomical guide for annotators, yielding everyday language in place of scientific terminology.
Conceptually, our paper offers a complementary approach to works that generate single-image, class or image-discriminative captions Hendricks et al. (2016); Vedantam et al. (2017). Rather than discriminative captioning, we focus on comparative language as a means for bridging the gap between varying granularities of visual diversity.
Methodologically, our work is most closely related to the Spot-the-diff dataset Jhamtani and Berg-Kirkpatrick (2018) and other recent work on change captioning Park et al. (2019); Tan and Bansal (2019). While change captioning compares two images with few changing pixels (e.g., surveillance footage), we consider image pairs with no pixel overlap, motivating our stratified sampling approach to select comparisons.
Finally, the recently released NLVR dataset Suhr et al. (2018) introduces a challenging natural language reasoning task using two images as context. Our work instead focuses on generating comparative language rather than reasoning.
We present the new Birds-to-Words dataset and Neural Naturalist model for generating comparative explanations of fine-grained visual differences. This dataset features paragraph-length, adaptively detailed descriptions written in everyday language. We hope that continued study of this area will produce models that can aid humans in critical domains like citizen science.
- Imagenet: a large-scale hierarchical image database. Cited by: §2.3, §2.
- Quantization based fast inner product search. In Artificial Intelligence and Statistics, pp. 482–490. Cited by: §2.3.
- Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778. Cited by: §3.1.
- Generating visual explanations. In European Conference on Computer Vision, pp. 3–19. Cited by: §1, §5.
- Learning to describe differences between pairs of similar images. arXiv preprint arXiv:1808.10584. Cited by: §1, §5.
- Novel dataset for fine-grained image categorization. In First Workshop on Fine-Grained Visual Categorization, IEEE Conference on Computer Vision and Pattern Recognition, Colorado Springs, CO. Cited by: footnote 4.
- 3D object representations for fine-grained categorization. In 4th International IEEE Workshop on 3D Representation and Recognition (3dRR-13), Sydney, Australia. Cited by: §2.
- 3D object representations for fine-grained categorization. In 4th International IEEE Workshop on 3D Representation and Recognition (3dRR-13), Sydney, Australia. Cited by: footnote 4.
- Rouge: a package for automatic evaluation of summaries. Text Summarization Branches Out. Cited by: §4.2.
- Fine-grained visual classification of aircraft. arXiv preprint arXiv:1306.5151. Cited by: footnote 4.
- Discovering a lexicon of parts and attributes. In European Conference on Computer Vision, pp. 21–30. Cited by: §5.
- Recurrent neural network based language model. In Eleventh annual conference of the international speech communication association, Cited by: §3.
- Head pose estimation in computer vision: a survey. IEEE transactions on pattern analysis and machine intelligence 31 (4), pp. 607–626. Cited by: §2.
- BLEU: a method for automatic evaluation of machine translation. In Proceedings of the 40th annual meeting on association for computational linguistics, pp. 311–318. Cited by: §4.2.
- Robust change captioning. In Proceedings of the IEEE International Conference on Computer Vision, pp. 4624–4633. Cited by: §5.
- Learning deep representations of fine-grained visual descriptions. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 49–58. Cited by: §5.
- Conceptual captions: a cleaned, hypernymed, image alt-text dataset for automatic image captioning. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), Vol. 1, pp. 2556–2565. Cited by: §3.
- Reasoning about fine-grained attribute phrases using reference games. In International Conference on Computer Vision (ICCV), Cited by: §5.
- A corpus for reasoning about natural language grounded in photographs. CoRR abs/1811.00491. External Links: Cited by: §5.
- Inception-v4, inception-resnet and the impact of residual connections on learning. In Thirty-First AAAI Conference on Artificial Intelligence, Cited by: §2.3, §3.1.
- Expressing visual relationships via language. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, Cited by: §5.
- The inaturalist species classification and detection dataset. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 8769–8778. Cited by: footnote 4.
- Attention is all you need. In Advances in Neural Information Processing Systems, pp. 5998–6008. Cited by: §3.
- Context-aware captions from context-agnostic supervision. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 251–260. Cited by: §1, §5, §5.
- Cider: consensus-based image description evaluation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 4566–4575. Cited by: §4.2.
- Show and tell: a neural image caption generator. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3156–3164. Cited by: Table 2.
- The caltech-ucsd birds-200-2011 dataset. Cited by: §2, §5, footnote 4.
- Multiscale quantization for fast similarity search. In Advances in Neural Information Processing Systems, pp. 5745–5755. Cited by: §2.3.
- Show, attend and tell: neural image caption generation with visual attention. In International conference on machine learning, pp. 2048–2057. Cited by: §3, Table 2.
- Crowdsourcing feature discovery via adaptively chosen comparisons. arXiv preprint arXiv:1504.00064. Cited by: §5.
Appendix A Algorithmic Approach to Dataset Construction
We present here an algorithmic approach to collecting a dataset of image pairs with natural language text describing their differences. The central challenge is to balance empirical desiderata—mainly, sample coverage and model relevance—with practical constraints of data quality and cost. This algorithmic approach underpins the dataset collection we outlined in the paper body.
Our goal is to collect a dataset of tuples , where and are images, and is a textual comparison of them. We can consider each image as drawn from some domain , or a completely open domain of all concepts. There are several criteria we would like to balance:
Coverage A dataset should sufficiently cover so that generalization across the space is possible.
Relevance Given the capabilities for models to distinguish and , should provide value.
Comparability Each pair (, ) must have sufficient structural similarities that a human annotator can reasonably write comparing them. Pairs that are too different will yield lengthy and uninteresting descriptions without direct contrasting statements. Pairs that are too similar for human perception may yield “I can’t see any difference.”444This hints at the same sweet spot the fine-grained visual classification (FGVC) community studies, like cars Krause et al. (2013b), aircraft Maji et al. (2013), dogs Khosla et al. (2011), and birds Wah et al. (2011); Van Horn et al. (2018).
Efficiency Image judgements and textual annotations require human labor. With a fixed budget, we would like to yield a dataset of the largest size possible.
We describe sampling algorithms for addressing these issues given the choice of a domain.
a.2 Pivot-Branch Sampling
Drawing a single image from domain , there is a chance that each image is ill-suited for comparisons. For example, might be out-of-focus or contain multiple instances.
If a pair of images is drawn, and each has probability of being discarded, then times more pairs must be selected and annotated. For example, if , then the annotation cost is scaled by 2.25. This severely impacts annotation efficiency.
To combat this, we employ a stratified sampling strategy we call pivot-branch sampling. Each image on one side of the comparison (say, ) is vetted individually, and images on the other side (say, ) are sampled to produce pairs. With -times fewer images, it is feasible to check each instance for usability. This lowers the annotation cost scale to (e.g., with , this is 1.5).
Splitting our selection from into two parts allows us to define two distinct sampling strategies. One choice is for to select pivot images. The second is for to sample images given a single pivot image.
Selecting are important because each will contribute to image pairs in a dataset. Here we consider the case where there are class labels available for each image in the domain. We propose selecting to sample uniformly over . This strategy attempts to provide coverage over using class labels as a coarse measure of diversity. It accounts for category-level dataset bias (e.g., where most images belong to only a few classes). This pushes the need to address relevance and comparability to the sampling procedure for branched images.
Given each pivot image , we will choose images from for comparison. We can make use of additional functions and structure available on :
|A function that measures the visual similarity|
|between any two images.|
We can partition to sample visually-similar images using and taxonomically related images. A simple strategy for visually similar images is to pick
times without replacement. This samples the most visually similar images to , excluding the image itself.
To employ taxonomic information, we propose a walk over mutually exclusive subsets of . We define a function that gives the set of other taxonomic leaves that share a common ancestor exactly taxonomic levels above , and no levels lower. More formally, if we use to express that and share a parent taxonomic levels above , then we can define:
The function partitions the taxonomy into disjoint subtrees. For example, are the set of sibling classes to which share its direct parent; are the set of cousin classes to which share its grandparent, but not its parent.
We can employ by choosing class from our pivot image and varying . As we increase , we define mutually exclusive sets of classes with greater taxonomic distance from .
To sample images using this scheme, we can further split our budget for taxonomically sampled images into for different levels. Then, if we write the set of classes , we can sample images from . One scheme is to perform round-robin sampling: rotate through each class and sample sample one image from each until are chosen.
Given a good visual similarity function , image pairs will exhibit enough similarity to satisfy requirement that they be semantically close enough to be comparable. They may also be so visually similar that comparability is difficult. However, this aspect counter-balances with relevance: if is small under a visual model, but their differences are describable by humans, their difference description has high value because it distinguishes two points with high similarity in visual embeddings space.
The use of the taxonomy complements by providing controllable coverage over while maintaining relevance and comparability. Tuning the range of values used in the taxonomic splits ensures comparability is maintained. Clamping below a threshold ensures images have sufficient similarity, and controlling the proportion of for small values of mitigates the risk of too-similar image pairs.
Similarly, we can adjust the relevance of taxonomic sampling by controlling the distribution of with respect to the particular structure of the taxonomy . If the taxonomy is well-balanced, then fixing a constant will draw proportionally more samples from subtrees close to . This can be seen by considering that defines exponentially larger subsets of as increases. Drawing the same number of samples from each subset biases the collection towards relevant pairs (which should be more difficult to distinguish) while maintaining sparse coverage over the entirety of .
Appendix B Details for Constructing Birds-to-Words Dataset
We provide here additional details for constructing the Birds-to-Words dataset. This is meant to link the high level overview in Section 2 with the algorithmic approach presented in the previous section (Appendix A).
To build a dataset emphasizing fine-grained comparisons between two animals, we impose stricter restrictions on the images than iNaturalist research-grade observations (photographs). An iNaturalist observation that is research-grade indicates the community has reached consensus on the animal’s species, that the photo was taken in the wild, and several other qualifications.555More details on iNaturalist research-grade specification: https://www.inaturalist.org/pages/help#quality We include four additional criteria that we define together as clarity:
Single instance: A photo must include only a single instance of the target species. Bird photography often includes flocks in trees, in the air, or on land. In addition, some birds appear in male/female pairs. For our dataset, all of those photos must be discarded.
Animal: A photo must include the animal itself, rather than a record of it (e.g., tracks).
Focus: A photo must be sufficiently in-focus to describe the animal in detail.
Visibility: The animal in the photo must not be too obscured by the environment, and must take up enough pixels in the photo to be clearly described.
b.2 Pivot Images
To pick pivot images, we first uniformly sample from the set of 9k species in the taxonomic class Aves in iNaturalist. We consider only species with at least four recorded observations to promote the likelihood that at least one image is clear. We also perform look-ahead branch sampling to ensure that a species will yield sufficient comparisons taxonomically. For each species, we manually review four images sampled from this species to select the clearest image to use as the pivot image. If none are suitable, we move to the next species. With this manual process, we select 405 species and corresponding photographs to use as pivot images.
b.3 Branching Images
See Section 2.3 for the description of selecting visually similar branching images using a function . We highlight here the use of the taxonomy to select branching images with varying levels of taxonomic distance.
For the class corresponding to image , we split the taxonomic tree into disjoint subtrees rooted taxonomic levels above . Each higher level excludes the levels beneath it. For example, at we consider all images of the same species as ; at , we consider all images of the same genus as , but that have a different species. We set each for a total of .
Annotators first label whether and are clear. While we manually verified each is clear, each must still be vetted.666Annotators would occasionally agree that a particular images was in fact unclear, upon which we removed it and all corresponding pairs from the dataset. Starting from 405 pivot images , and selecting branching images for each, we annotated a total of 4,860 image pairs. After restricting images to have positive clarity judgments, we ended up with the 3,347 image pairs in our dataset, a retention rate of 68.9%.
We vet each annotator individually by manually reviewing five reference annotations from a pilot round, and perform random quality assessments during data collection. We found that manually vetting the writing quality and guideline adherence of each individual annotator vital for ensuring high data quality.
Appendix C Model Details
For the image embedding component of our model, we use a ResNet-101 network as our CNN. We use a model pretrained on ImageNet and fix the CNN weights before starting training for our task. We also experimented with an Inception-v4 model, but found ResNet-101 to have better performance.
For both the Transformer encoder and decoder, we use layers, a hidden size of 512, 8 attention heads, and dot product self-attention. Each paragraphs is clipped at 64 tokens during training (chosen empirically to cover 94% of paragraphs). The text is preprocessed using standard techniques (tokenization, lowercasing), and we replace mentions referring to each image with special tokens animal1 and animal2.
For inference, we experiment with greedy decoding, multinomial sampling, and beam search. Beam search performs best, so we use it with a beam size of 5 for all reported results (except the decoding ablations, where we report each).
We train with Adagrad for 700k steps using a learning rate of .01 and batch size of 2048. We decay the learning rate after 20k steps by a factor of 0.9. Gradients are clipped at a magnitude of 5.
Appendix D Image Attributions
The table above provides attributions for all photographs used in this paper.
|Fig. 1: Top and bottom left||salticidude (CC BY-NC 4.0) https://www.inaturalist.org/observations/20863620|
|Fig. 1: Top right||Patricia Simpson (CC BY-NC 4.0) https://www.inaturalist.org/observations/1032161|
|Fig. 1: Bottom right||kalamurphyking (CC BY-NC-ND 4.0) https://www.inaturalist.org/observations/9376125|
|Fig. 2: Top left||Ryan Schain https://macaulaylibrary.org/asset/58977041|
|Fig. 2: Top right||Anonymous eBirder https://www.allaboutbirds.org/guide/Song_Sparrow/media-browser/66116721|
|Fig. 2: Right, 2nd from top||Garth McElroy/VIREO https://www.audubon.org/field-guide/bird/song-sparrow#photo3|
|Fig. 2: Right, 3rd from top||Myron Tay http://orientalbirdimages.org/search.php?Bird_ID=2104&Bird_Image_ID=61509&p=73|
|Fig. 2: Right, 4th from top||Brian Kushner https://www.audubon.org/field-guide/bird/blue-jay|
|Fig. 2: Bottom, left||A. \textcyrupSHCHerbakov|
|Fig. 2: Bottom, right||prepa3tgz-11bwv518 (CC BY-NC 4.0) https://www.inaturalist.org/observations/23184228|
|Fig. 4: Top||jmaley (CC0 1.0) https://www.inaturalist.org/observations/31619615|
|Fig. 4: Bottom||lorospericos (CC BY-NC 4.0) https://www.inaturalist.org/observations/30605775|
|Fig. 5: Top left, left||wildlife-naturalists (CC BY-NC 4.0) https://www.inaturalist.org/photos/13223248|
|Fig. 5: Top left, right||Colin Barrows (CC BY-NC-SA 4.0) https://www.inaturalist.org/photos/2642277|
|Fig. 5: Top middle, left||charley (CC BY-NC 4.0) https://www.inaturalist.org/photos/13379419|
|Fig. 5: Top middle, right||guyincognito (CC BY-NC 4.0) https://www.inaturalist.org/photos/26314681|
|Fig. 5: Top right, left||Chris van Swaay (CC BY-NC 4.0) https://www.inaturalist.org/photos/18941543|
|Fig. 5: Top right, right||Jonathan Campbell (CC BY-NC 4.0) https://www.inaturalist.org/photos/20120523|
|Fig. 5: Middle left, left||John Ratzlaff (CC BY-NC-ND 4.0) https://www.inaturalist.org/photos/647514|
|Fig. 5: Middle left, right||Jessica (CC BY-NC 4.0) https://www.inaturalist.org/photos/5595152|
|Fig. 5: Middle middle, left||i_c_riddell (CC BY-NC 4.0) https://www.inaturalist.org/photos/1331149|
|Fig. 5: Middle middle, right||Pronoy Baidya (CC BY-NC-ND 4.0) https://www.inaturalist.org/photos/5027691|
|Fig. 5: Middle right, left||Nicolas Olejnik (CC BY-NC 4.0) https://www.inaturalist.org/photos/2006632|
|Fig. 5: Middle right, right||Carmelo López Abad (CC BY-NC 4.0) https://www.inaturalist.org/photos/892048|
|Fig. 5: Bottom left, left||Luis Querido (CC BY-NC 4.0) https://www.inaturalist.org/photos/13052253|
|Fig. 5: Bottom left, right||copper (CC BY-NC 4.0) https://www.inaturalist.org/photos/22043211|
|Fig. 5: Bottom middle, left||vireolanius (CC BY-NC 4.0) https://www.inaturalist.org/photos/13550702|
|Fig. 5: Bottom middle, right||Mathias D’haen (CC BY-NC 4.0) https://www.inaturalist.org/photos/14943695|
|Fig. 5: Bottom right, left||tas47 (CC BY-NC 4.0) https://www.inaturalist.org/photos/10691998|
|Fig. 5: Bottom right, right||Nik Borrow (CC BY-NC 4.0) https://www.inaturalist.org/photos/13776993|