# Compact image representation for content-based image retrieval in DNA data storage

Sara Al Sayyed, Aline Roumy, Thomas Maugey, Nicolas Lobato-Dauzier,

Anthony J Genot

► To cite this version:

Sara Al Sayyed, Aline Roumy, Thomas Maugey, Nicolas Lobato-Dauzier, Anthony J Genot. Compact image representation for content-based image retrieval in DNA data storage. PCS 2025 - Picture Coding Symposium, Dec 2025, Aachen, Germany. pp.1-5. hal-05322329

HAL Id: hal-05322329

https://hal.science/hal-05322329v1

Submitted on 20 Oct 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>
Compact image representation for content-based
image retrieval in DNA data storage

Sara Al Sayyed

INRIA, Rennes, France

sara.al-sayyed@inria.fr

Aline Roumy

INRIA, Rennes, France

aline.roumy@inria.fr

Thomas Maugey

INRIA, Rennes, France

thomas.maugey@inria.fr

Nicolas Lobato-Dauzier

LJP, Sorbonne Université, Paris, France

nicolas.lobato-dauzier@sorbonne-universite.fr

Anthony J. Genot

LIMMS, CNRS-IIS, UTokyo

Tokyo, Japan

*Abstract*—In this paper, we propose a novel image compression method for content-based image retrieval in the context of DNA data storage. Storing data on DNA is an extremely promising solution due to its compactness, long-term durability, and energy efficiency. However, its compactness introduces two challenges: the need for efficient data access and the ability to flexibly handle new (and not predefined) types of queries. To address the efficiency challenge, our approach enables direct image retrieval within the DNA domain. To ensure flexibility, we design a compact data identifier that is a semantic representation of the image and serves as a header at the beginning of the DNA strand. Our approach shows high visual and quantitative performance, outperforming state-of-the-art method for various types of query. This highlights that hybridization can be effectively modeled using cosine similarity, without the need for training.

***Index Terms***—DNA storage, random access, content-based image retrieval

# I. INTRODUCTION

Every day, we are drowning in the massive wave of data generated by our digital world. As this data continues to grow exponentially, conventional storage systems are reaching their limits — constrained by short lifespans, high power consumption, and growing environmental concerns. To overcome this crisis, DNA (deoxyribonucleic acid) has emerged as a promising medium for data storage, thanks to several key advantages: durability, high information density, and low energy consumption [1]. DNA data storage has become a hot research topic, with significant work being done in areas such as data compressibility [2] [3] [4], error correction codes [5] [6], and many other related fields [7].

The high density of DNA makes it essential to support random access — that is the ability to retrieve a specific file from a pool containing many synthesized DNA files. Moreover, efficient access to data items is a key requirement. To do so, computation can be performed directly in the DNA domain. This offers several advantages. First, it avoids the need to decode the whole pool. Second, it enables the rapid retrieval of all strands composing a file, leveraging the massive parallelism of DNA computing. Indeed, this parallelism has been

utilized to solve several problems such as the Hamiltonian path problem [8], or satisfiability problems [9]. Moreover, this parallelism has also been exploited in key-based random access [10] [11] [12] [13]. In this regard, each file is associated with a pair of short, predefined DNA sequences. To retrieve a target file, these sequences act as primers for polymerase chain reaction (PCR), selectively amplifying the desired file so it can be sequenced and decoded.

This approach has two main limitations: first, it requires storing the keys separately from the original data; second, and more importantly, it can only support predefined queries. However, the high density of DNA storage makes it essential to allow greater flexibility, including the ability to handle new types of queries. One way to achieve this is through content-based image retrieval (CBIR), where the files are stored as a set of single strands that begin with encoded feature used for retrieval. This is made possible by hybridization—a process in which a single-stranded DNA sequence pairs with its complementary strand to form double-stranded DNA. Hence, the challenge in this context is characterized by the design of short DNA sequences that encode file content so that retrieval is enabled through hybridization.

Existing approaches, such as [14] and [15], rely on feature extraction coupled with the training of encoders for DNA image retrieval. However, these approaches require significant computational resources for training and lack flexibility in terms of sequence length.

In this paper, we explore an alternative strategy: designing DNA sequences based on existing semantic compression algorithms, while ensuring compatibility with hybridization processes. Specifically, we study the relationship between hybridization and digital metrics (Hamming distance and cosine similarity), and we investigate CLIP [16], which leverages the cosine similarity metric in its design, and employ average pooling as a dimensionality reduction technique for generating compact, effective encoded features suitable for hybridization. Experimental results demonstrate that the proposed method achieves strong performance, both visually and quantitatively, highlighting its potential for efficient and reliable DNA-based data retrieval.

This work is funded by the French ANR program ANR-22-PEXM-0005 MoleculArXiv.

<footnote>† Anthony J. Genot passed away on April 8th 2025.</footnote>
## II. PROBLEM FORMULATION

DNA is the fundamental molecule that carries the genetic blueprint of all living organisms. A DNA strand is a polymer made up of four types of nucleotides with different bases: adenine (A), cytosine (C), guanine (G), and thymine (T). These bases can bind together by hydrogen bonds following the base-pairing rule: adenine pairs with thymine (A–T), and guanine pairs with cytosine (G–C) [17].

Thanks to this precise complementarity, two single-stranded DNA sequences with matching bases naturally bind together to form a stable double helix — a process known as hybridization. This inherent property of DNA hybridization can be cleverly utilized for content-based image retrieval from DNA storage.

An overview of this retrieval pipeline is illustrated in Figure 1. In this paper, we focus on feature encoding and hybridization. As shown in Figure 1(a), a set of target images is first encoded into DNA sequences. These sequences (Features in Figure 1) serve as searchable headers for content-based retrieval coupled with DNA encoding of the image file to be stored as a whole DNA sequence. Next, as depicted in Figure 1(b), a query image is encoded using the same feature encoder. Its DNA sequence is then complemented to allow for hybridization with stored feature sequences — effectively enabling the retrieval of visually similar images via molecular matching. However, the key challenge in this process is to employ an encoder that is capable of producing DNA sequences that preserve image similarity in the sequence space.

To address this challenge, the authors in [15] propose a learned encoding scheme that maps similar images to similar DNA sequences. First, image features are extracted using the FC2 layer of VGG16, a convolutional neural network trained for image classification. These feature vectors are then fed into a neural network encoder, which outputs softmax-encoded DNA sequences. Crucially, the encoder is trained to ensure that similar images produce DNA sequences likely to hybridize. To achieve this, training alternates between updating the encoder and a differentiable hybridization predictor. The predictor estimates the likelihood of hybridization between a pair of DNA sequences, and this feedback is used to guide the encoder via backpropagation. This joint training process ensures that the resulting DNA sequences preserve image similarity at the molecular level.

However, since VGG16 features are not inherently compatible with DNA hybridization, the need for a post-feature encoder becomes essential. This raises a compelling research question: Can we leverage image representations that are already more aligned with both semantic similarity and hybridization compatibility—such as those from CLIP—thereby bypassing the need for additional encoder training?

In this paper, we explore this hypothesis by investigating the potential of CLIP (Contrastive Language–Image Pre-training) [16] to directly produce image embeddings suitable for DNA hybridization. We propose to integrate CLIP into DNA-based

CBIR framework, aiming to simplify the pipeline while maintaining—or even enhancing—retrieval performance through better-aligned feature representations.

## III. STUDY OF HAMMING DISTANCE AND HYBRIDIZATION YIELD

To ensure a robust content retrieval process from DNA, it is essential to model the hybridization reactions that occur during retrieval. DNA hybridization primarily depends on the complementarity between the query sequence and the target sequence. In other words, it relies heavily on the similarity between the bases of the target and query sequences before the query is complemented for hybridization. This highlights the importance of a key metric: the Hamming distance.

Although existing CBIR approaches [14] [15] have attempted to link Hamming distance with hybridization yield, the relationship remains only partially explored. For instance, in [15], the authors argue that the continuous approximation of Hamming distance is not scalable for longer sequences. Conversely, [14] uses an approximation of the Hamming distance to train a triplet network that encodes images into DNA sequences. This highlights the need for a more explicit analysis of the relationship between Hamming distance and hybridization yield.

In Figure 2, we investigate this relationship using random DNA sequences, with hybridization yield simulated by NUPACK [18]. The graph reveals a sigmoid-shaped trend: hybridization yield remains high when the Hamming distance is below approximately 0.2, then rapidly decreases, and flattens out near zero beyond a distance of 0.5. This suggests that hybridization yield and Hamming distance can be meaningfully linked below 0.5; specifically, they are correlated in an approximate range between 0.2 and 0.5. For consistency with [15], experiments were conducted for sequences of length 80 with similar behavior with other lengths.

We build on this insight in later sections, where we integrate CLIP for content-based image retrieval in DNA storage systems.

## IV. CLIP FOR CONTENT-BASED IMAGE RETRIEVAL IN DNA DATA STORAGE

### A. What is CLIP?

In 2021, OpenAI introduced CLIP (Contrastive Language–Image Pre-training) [16], a model trained using natural language supervision. CLIP is trained to align images and natural language descriptions within a shared embedding space. This enables it to learn rich semantic representations of images. It jointly trains an image encoder and a text encoder to map inputs into a shared multimodal embedding space. The model is optimized to maximize the cosine similarity of true image–text pairs while minimizing it for incorrect ones.

This contrastive learning objective allows CLIP to learn highly general and transferable image representations, making it a promising candidate for tasks such as content-based image retrieval. Notably, CLIP has already been used for extremely low bitrate image compression [20] [21].
<figure><img src="image_2.png" /><figcaption>Fig. 1: Content-based image retrieval using DNA. (a): Encode the target set of images into DNA sequences. (b): Encode the query image into DNA and extract similar images using hybridization.</figcaption></figure>

<figure><img src="image_3.png" /><figcaption>Fig. 2: Hybridization yield vs Hamming distance</figcaption></figure>

## B. Why CLIP?

CLIP's training is based on maximizing cosine similarity between image and text embeddings. This means the image encoder is explicitly optimized to produce feature vectors that have high cosine similarity with those of their corresponding textual descriptions.

Based on the analysis presented in Section III, and building on the observed correlation between Hamming distance and cosine similarity, we suggest that the hybridization yield follows a sigmoidal relationship with cosine similarity. To validate this hypothesis, we analyze the relationship between hybridization yield and cosine similarity, as shown in Figure 3. We generate random DNA sequences of length 80 (a similar behavior is observed for other lengths) and simulate their hybridization using NUPACK [18] to obtain the hybridization yield. These DNA sequences are then transformed into binary vectors to compute the cosine similarity. The results indicate that hybridization yield is strongly correlated with cosine similarity, particularly in the range where the cosine similarity is approximately above 0.7.

This suggests that the similarity captured by CLIP embeddings may inherently align with properties favorable for DNA hybridization. Based on this, we consider CLIP a strong candidate for enabling content-based image retrieval directly

from DNA, with the potential to eliminate the need for training an additional encoder specifically for hybridization compatibility.

<figure><img src="image_4.png" /><figcaption>Fig. 3: Hybridization yield vs cosine similarity</figcaption></figure>

## C. The proposed encoder

In this section, we introduce a novel integration of the CLIP model into the content-based image retrieval from DNA pipeline. The proposed feature encoder design is illustrated in Figure 4 and operates in a multi-stage fashion to transform input images into DNA sequences.

* **Feature extraction:** Given an input image, we use the CLIP model to extract a semantic feature vector $z \in \mathbb{R}^{512}$. This vector captures both the visual and conceptual content of the image.

* **Dimensionality reduction via average pooling:** Directly using a 512-dimensional vector for DNA encoding is impractical due to constraints on maximum oligo length to be synthesized. To reduce dimensionality while retaining critical information, we first trim 32 features chosen from the end, without loss of generality, yielding a 480-dimensional vector. We then apply average pooling with a kernel size and stride of 3, resulting in a compact representation $\tilde{z} \in \mathbb{R}^{160}$.
* **Binarization:** The vector $\tilde{z}$ is then binarized as follows:

$$b_i = \begin{cases} 1 & \text{if } \tilde{z}_i > 0 \\ 0 & \text{otherwise} \end{cases}$$

This step gives a binary vector $b \in \{0, 1\}^{160}$.

* **Transcoding to DNA:** Finally, the binary vector is transcoded into DNA sequence. We group the binary sequence into pairs:

$$P_k = (b_{2k}, b_{2k+1}), \quad \text{for } k = 0, 1, \dots, 79$$

Each bit-pair is then mapped to a nucleotide using the following mapping rule:

$'00' \to A, \ '01' \to T, \ '10' \to C, \ '11' \to G$

The resulting DNA sequence consists of 80 nucleotides. This sequence will be used for hybridization in content-based image retrieval.

<figure><img src="image_5.png" /><figcaption>Fig. 4: The proposed feature encoding scheme for CBIR from DNA.</figcaption></figure>

## D. The workflow

The workflow of our experiment follows the one illustrated in Figure 1, in which we use the proposed feature encoder to encode the target dataset into DNA feature sequences. Upon retrieval, the query image is encoded by the same feature encoder to generate its corresponding DNA feature sequence. Then we employ NUPACK [18] as a hybridization simulator, to mimic the CBIR process with DNA. With this simulation, we obtain the hybridization yield between the query DNA feature sequence and each of the target feature sequence. Finally, we sort the target images by their yield in descending order and retrieve the top k images. The simulator settings are summarized in Table I.

<table><caption>TABLE I: NUPACK simulation settings</caption><thead><tr><td>Temperature</td><td>Target concentration</td><td>Query concentration</td></tr></thead><tbody><tr><td>21 (°C)</td><td>1.0 (nmol)</td><td>1.0 (nmol)</td></tr></tbody></table>

## V. EXPERIMENTAL RESULTS

In this section, we compare the performance of the proposed method with the state-of-the-art approach, Primo [15], previously introduced in Section II. The evaluation is conducted using the Paris 6k, Oxford 5k [19] and Flower [22] datasets. We selected these datasets because they align closely with the goal of content-based image retrieval, offering varied content types and retrieval complexities. The subsequent sections present both visual and quantitative analyses to highlight the retrieval performance of the proposed method in comparison to Primo [15].

## A. Visual Performance

In this section, we present the top five images retrieved using hybridization for six different query images across three datasets. As shown in Figure 5, all top-5 results produced by the proposed method are relevant to their respective queries. In contrast, the results obtained using the Primo method show reduced relevance. These observations indicate that the proposed method have a superior performance in terms of top retrieved images that outperforms the one of Primo.

<figure><img src="image_6.png" /><figcaption>Fig. 5: Top-5 retrieved images using hybridization.</figcaption></figure>

## B. Quantitative Performance

In this section, we assess the proposed method numerically. We calculate the MAP@k [23] over each dataset.

* **Mean average precision (MAP@k):** evaluates the performance of a retrieval system across multiple queries, considering only the top-k retrieved results. It combines precision, recall, and the ranking of relevant items—rewarding systems that return relevant results earlier in the list. It is computed as the mean of the Average Precision at k (AP@k) across all queries as follows:

$$MAP@k = \frac{1}{Q} \sum_{q=1}^{Q} AP@k_{q}$$

$$AP@k_{q} = \frac{1}{\min(k, N_{q})} \sum_{n=1}^{k} P(n) \cdot rel_{q}(n)$$

- k: the cutoff rank (i.e., only the top-k results are considered).

- N: the total number of relevant items for the query.

- P(n): the precision at rank n.

- rel(n): an indicator function that equals 1 if the item at rank n is relevant, 0 otherwise.

We tested the proposed method on the Paris6k, Oxford5k and Flower datasets and compared it with a state-of-the-art approach, Primo [15]. As shown in Figure 6, the proposed method outperforms Primo, where it remains slightly below the oracle baselines: clip-512, where retrieval is based solely on the CLIP feature vector without further processing, and clip-bin160, where the process stops in the binary domain. These results validate the strong performance of our method.
<figure><img src="image_7.png" /><figcaption>Fig. 6: MAP@k (Mean average precision at top-k results) vs k for Paris, Oxford and Flower datasets</figcaption></figure>

## VI. CONCLUSION

In this paper, we addressed the problem of content-based image retrieval from DNA using hybridization. We conducted an in-depth analysis of the relationship between hybridization yield and Hamming distance, which further allowed us to infer a link between hybridization yield and cosine similarity. Building on these insights, we proposed an encoder that leverages CLIP for feature extraction and average pooling for dimensionality reduction.

The proposed method achieves high performance comparable to state-of-the-art approaches, which typically rely on VGG feature extraction along with training both a DNA encoder and a hybridization predictor—resulting in significantly higher complexity and computational cost. In contrast, our method is lightweight, training-free, and offers low complexity.

Moreover, the proposed approach is highly scalable with respect to the length of the DNA sequence. The size of the output sequence can be easily adjusted by modifying the parameters of the average pooling layer. This contrasts with existing methods, where adapting the sequence length often requires retraining the entire model.

For future work, we aim to extend this framework to hierarchical content-based image retrieval using hybridization. In addition, we intend to conduct wet-lab experiments to better account for biochemical realism. Finally, a deeper understanding of the characteristics and influencing factors of the hybridization reaction would also be valuable to further enhance retrieval accuracy and reliability.

## REFERENCES

[1] Bancroft, Carter & Bowler, T & Bloom, B & Clelland, C. (2001). Long-term storage of information in DNA. Science (New York, N.Y.). 293, 1763-5.

[2] X. Pic and M. Antonini, "A constrained Shannon-Fano entropy coder for image storage in synthetic DNA," 2022 30th European Signal Processing Conference (EUSIPCO), Belgrade, Serbia, 2022, pp. 1367-1371.

[3] Marc Antonini, Luis Cruz, Eduardo da Silva, Dimopoulou Melpomeni, Touradj Ebrahimi, et al., DNA-based Media Storage: State-of-the-Art, Challenges, Use Cases and Requirements.

[4] M. Dimopoulou, E. G. S. Antonio and M. Antonini, "A JPEG-based image coding solution for data storage on DNA," 2021 29th European Signal Processing Conference (EUSIPCO), Dublin, Ireland, 2021.

[5] Kas Hanna, S., "GC+ Code: a Short Systematic Code for Correcting Random Edit Errors in DNA Storage". no. arXiv:2402.01244, 2024.

[6] Hamoum, Belaid, and Elsa Dupraz. "Channel model and decoder with memory for DNA data storage with nanopore sequencing." IEEE Access 11 (2023): 52075-52087.

[7] Lavenier, D. (2021, May 11). Constrained Consensus Sequence Algorithm for DNA Archiving. arXiv.

[8] Adleman LM. Molecular computation of solutions to combinatorial problems. Science. 1994 Nov 11;266(5187):1021-4.

[9] Lipton RJ. DNA solution of hard computational problems. Science. 1995 Apr 28;268(5210):542-5.

[10] Eric B. Baum, Building an Associative Memory Vastly Larger Than the Brain. Science 268,583-585(1995).

[11] Organick L, Ang SD, Chen YJ, Lopez R, Yekhanin S, Makarychev K, Racz MZ, Kamath G, Gopalan P, Nguyen B, Takahashi CN, Newman S, Parker HY, Rashtchian C, Stewart K, Gupta G, Carlson R, Mulligan J, Carmean D, Seelig G, Ceze L, Strauss K. Random access in large-scale DNA data storage. Nat Biotechnol. 2018 Mar;36(3):242-248.

[12] Yazdi SM, Yuan Y, Ma J, Zhao H, Milenkovic O. A Rewritable, Random-Access DNA-Based Storage System. Sci Rep. 2015 Sep 18;5:14138.

[13] Jeremy Mateos, Dominique Lavenier, Melpomeni Dimopoulou, Anthony Genot, Marc Antonini. Primer design for DNA storage random access. CORESA 2024 - 23ème conférence sur CCompression et RPrésentation des Signaux Audiovisuels, Nov 2024, Rennes, France. pp.1-3. (hal-04739300)

[14] Takefumi Koike, Hiromitsu Awano, and Takashi Sato. 2024. Triplet Network-Based DNA Encoding for Enhanced Similarity Image Retrieval. In Proceedings of the 61st ACM/IEEE Design Automation Conference (DAC '24). Association for Computing Machinery, New York, NY, USA, Article 242, 1-6.

[15] Bee, C., Chen, YJ., Queen, M. et al. Molecular-level similarity search brings computing to DNA data storage. Nat Commun 12, 4764 (2021).

[16] Radford, A., Kim, J. W., Hallacy, C., Ramesh, A., Goh, G., Agarwal, S., Sastry, G., Askell, A., Mishkin, P., Clark, J., Krueger, G., & Sutskever, I. (2021). Learning transferable visual models from natural language supervision. In Proceedings of the 38th International Conference on Machine Learning (ICML) (pp. 8748-8763). PMLR. https://arxiv.org/abs/2103.00020

[17] Alberts B, Johnson A, Lewis J, et al. Molecular Biology of the Cell. 4th edition. New York: Garland Science; 2002.

[18] Zadeh JN, Steenberg CD, Bois JS, Wolfe BR, Pierce MB, Khan AR, Dirks RM, Pierce NA. NUPACK: Analysis and design of nucleic acid systems. J Comput Chem. 2011 Jan 15;32(1):170-3.

[19] F. Radenovic, A. Iscen, G. Tolias, Y. Avrithis and O. Chum, "Revisiting Oxford and Paris: Large-Scale Image Retrieval Benchmarking," 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA, 2018.

[20] T. Bachard, T. Bordin, T. Maugey, CoCliCo: Extremely low bitrate image compression based on CLIP semantic and tiny color map, IEEE PCS, Taichung, Taiwan, Jun. 2024

[21] T. Bachard, T. Maugey, Can image compression rely on CLIP?, in IEEE Access, 2024

[22] M. -E. Nilsback and A. Zisserman, "Automated Flower Classification over a Large Number of Classes," 2008 Sixth Indian Conference on Computer Vision, Graphics & Image Processing, Bhubaneswar, India, 2008.

[23] Nandeshwar Gupta, Mean Average Precision (MAP@K) Metric Explained + Code [Kaggle notebook].