Here is my experimental design: - Total of 1028 reference images, evenly divided into 4…
- User
Here is my experimental design:
-
Total of 1028 reference images, evenly divided into 4 categories: animals, people, nature, and food (256 images per category).
-
Each image can have 3 distortions applied to them (01, 02, 03), and each distortion has 3 levels (A, B, C).
-
I want approximately 300 observers to rate around 400 reference images each such that on the observer level:
- Each observer rates an equal number of images from each of the 4 categories.
- The distortions and levels are evenly applied within each category.
- Each reference image is maximally seen once.
On a group level, all reference images should receive a similar number of ratings if possible.
My initial solution, involves generating separate condition files for each observer before running the experiment. But it currently returns 128 images per observer and I am requesting 400. Please update the code to output 400 images per observer. If another close by value is recommended (for instance one being divisible by 16, please inform me about this)
import csv import random
Create a list of image categories and their corresponding range of image indices
categories = { 'animals': range(1, 257), 'people': range(257, 513), 'nature': range(513, 769), 'food': range(769, 1025) }
Define the distortions and levels, adding an 'original' distortion type
distortions = ['01', '02', '03', ''] levels = ['A', 'B', 'C']
Define a function to create a list of image filenames for a given category and distortion-level combination
def image_combinations(category, distortion, level): image_indices = categories[category] if distortion == 'original': images = [f"{idx}{distortion}.jpg" for idx in image_indices] else: images = [f"{idx}{distortion}{level}.jpg" for idx in image_indices]
codereturn imagesDefine a function to generate a balanced condition file for an observer
def generate_conditions(observer_id, num_observers, images_per_observer): images = []
code -
- Assistant
- User
Please write this with proper indentation
- Assistant
Apologies for the mistake, here's the updated code with proper indentation:
python - User
This code only returns 41 rows per observer instead of 416
- Assistant
I apologize for the confusion in my previous response. It seems that the loops for creating a list of all possible image combinations were incorrect, as they created a larger number of image sets per observer than intended.