subsetdata$image [1] "images/470blur80.jpg" "images/440contrast70.jpg"…
- User
subset_data$image [1] "images/470_blur_80.jpg" "images/440_contrast_70.jpg" "images/382_contrast_90.jpg" "images/9_jpeg_80.jpg" "images/288_jpeg_80.jpg" "images/115_contrast_70.jpg" "images/536_jpeg_70.jpg" "images/39_original.jpg" "images/65_jpeg_80.jpg" "images/396_jpeg_70.jpg"
"images/475_jpeg_80.jpg" "images/345_blur_70.jpg" "images/51_blur_80.jpg" "images/226_blur_70.jpg" "images/233_jpeg_90.jpg" "images/177_blur_70.jpg" "images/10_jpeg_80.jpg" "images/149_blur_90.jpg" "images/328_blur_70.jpg" "images/190_contrast_90.jpg"I have shown images either in their original state or with "jpeg", "blur" or "contrast" distortion. If the images are distorted the can be distorted at levels "70", "80 or "90" which represents how many percentage of the original quality they are expected to have (SSIM). How can I elegantly separate the image into its different category names using the image name? Also propose BRMS models to predict another variable called ratings from the nested combination of image distortions and levels. Here is a first attempt:
Find distortions and categories
Image number
subset_dataImageNumber <- gsub("^\\D*([0-9]+)_.*", "\1", subset_data$image)
Extract letters following the first underscore until a second underscore or ".jpg" is encountered
subset_datadistortion <- gsub("^[^_]+_(.*?)(_[^_]+\\.jpg|\\.jpg)", "\1", subset_data$image)
Convert "original" to "none"
subset_datadistortion == "original"] <- "none"
- Assistant
To address the issue of assuming that all distortion * level options are possible and that "none" will always have a quality of 100, you can create a new variable that combines the distortion and level variables and set the reference level for the
distortion_levelfactor.# Create new variable that combines distortion and level subset_data$distortion_level <- paste(subset_data$distortion, subset_data$level, sep=":") # Remove cases where distortion is "none" and the level is not "100" subset_data$distortion_level[subset_data$distortion == "none" & subset_data$level != "100"] <- "none" # Factor variables subset_data$distortion <- factor(subset_data$distortion, levels = c("none", "jpeg", "blur", "contrast")) subset_data$level <- factor(subset_data$level, levels = c("100", "90", "80", "70")) subset_data$distortion_level <- factor(subset_data$distortion_level, levels = c("none", "jpeg:70", "jpeg:80", "jpeg:90", "blur:70", "blur:80", "blur:90", "contrast:70", "contrast:80", "contrast:90")) # BRMS model model <- brm(ratings ~ distortion_level, data = subset_data, iter = 2000, family = gaussian, chains = 4) # Export the model summary(model)
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.