Skip to content

gen-tests-mk: distribution of j90randomsizej80 resolutions #3

@swesterfeld

Description

@swesterfeld

I ran j90randomsizej80 on about 1000 images, and generated a histogram of the sizes. For each images in the attack, I used the minimum of width and height as value for the histogram. For instance, a 500x400 image would "count as" 400px image, because the detection algorithm problems are to be expected on the smaller dimension.

Image

This is not what I expected to see. I thought that most images would be > 500px and practically no image would be < 400px.

I also saw that j90randomsizej80 supposedly should change the aspect ratio of the input images.

# Generate 2D resolutions based on the resolution areas and aspect ratio range

Seems that it doesn't (which may be part of the problem why the distribution is not correct).
Seems that using convert input.jpg -resize 200x200 output.jpg (or similar) doesn't change the aspect ratio.

However what I would really like to test here is random resizing while maintaining aspect ratio, so either we should make j90randomsizej80 do this, or we should have two attacks, one with and the other without aspect ratio change.

Tools:

Find minimum size (min (width, height)) of each image:

#!/bin/bash
# shell script: min-width.sh
for i in $(find . -iname *.json)
do
  egrep '(width|height)' $i | sed 's/[":,]//g' | awk '$1 == "width" {w=$2;} $1 == "height" {h=$2;}END{if (w<h){print w;}else{print h}}'
done

Gnuplot script:

set terminal pngcairo size 800,600 enhanced font 'Verdana,10'
set output 'hist.png'
binwidth=20
bin(x,width)=width*floor(x/width)
plot '<./min-width.sh' using (bin($1,binwidth)):(1.0) smooth freq with boxes

Sub-issues

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions