RDMs support two inference modes.
RDM with text-prompt only
Runs without explicit retrieval by using CLIP text embeddings directly.
python scripts/knn2img.py --prompt "a happy bear reading a newspaper, oil on canvas"
RDM with text-to-image retrieval
Requires downloading retrieval databases (Openimages or ArtBench) and potentially a ScaNN search index.
To run with visual nearest neighbors:
python scripts/knn2img.py --prompt "a happy pineapple" --use_neighbors --knn <number_of_neighbors>
Arguments:
--use_neighbors: Enables retrieval-based sampling.--knn <number>: Number of neighbors to retrieve (max 20).--database <name>: Specifies the database. Options include: openimages, artbench-art_nouveau, artbench-baroque, artbench-expressionism, artbench-impressionism, artbench-post_impressionism, artbench-realism, artbench-renaissance, artbench-romanticism, artbench-surrealism, artbench-ukiyo_e.
Note: For --database openimages, you must first run python scripts/train_searcher.py to create the index.
python scripts/knn2img.py --prompt "a happy pineapple" --use_neighbors --knn 10