For better results, add caption files next to each image:
Copy
my_images/ photo1.jpg photo1.txt <- "A beautiful sunset over the ocean" photo2.jpg photo2.txt <- "A person walking in a forest" photo3.png photo3.txt <- "Close-up of a flower" ...
Caption files should:
Have the same name as the image (except the extension)
Be plain text files (.txt)
Contain a descriptive caption on the first line
Be UTF-8 encoded
Captions are optional but highly recommended. They help the model learn what features to associate with your style or subject.
# Get dataset sizeprint(f"Dataset has {len(ds)} images")# Iterate over itemsfor image, caption in ds: print(f"Image size: {image.size}") print(f"Caption: {caption}") break # Just show first item
# Get specific item by indeximage, caption = ds[0]# Check if captions are availableif caption is not None: print(f"Has caption: {caption}")else: print("No caption for this image")
art_style_dataset/ painting1.jpg painting1.txt <- "Abstract painting with blue and red geometric shapes" painting2.jpg painting2.txt <- "Impressionist landscape with trees and water" painting3.jpg painting3.txt <- "Cubist portrait with angular features" ...
character_dataset/ portrait1.jpg portrait1.txt <- "Close-up portrait of John facing forward" portrait2.jpg portrait2.txt <- "John smiling in profile view" portrait3.jpg portrait3.txt <- "Full body shot of John wearing a suit" ...
product_dataset/ product1.jpg product1.txt <- "Red sneaker on white background from side angle" product2.jpg product2.txt <- "Red sneaker on white background from top view" product3.jpg product3.txt <- "Red sneaker on white background from front" ...