Skip to content

Instantly share code, notes, and snippets.

@zaleslaw
Created June 9, 2022 13:12
Show Gist options
  • Save zaleslaw/ceb891704cb758e11f406c04ea21cf8f to your computer and use it in GitHub Desktop.
Save zaleslaw/ceb891704cb758e11f406c04ea21cf8f to your computer and use it in GitHub Desktop.
Image Preprocessing DSL
val preprocessing = preprocess {
transformImage {
centerCrop {
size = 214
}
pad {
top = 10
bottom = 10
left = 10
right = 10
mode = PaddingMode.Fill(Color.BLACK)
}
convert {
colorMode = ColorMode.BGR
}
}
transformTensor {
normalize {
mean = floatArrayOf(103.939f, 116.779f, 123.68f)
std = floatArrayOf(57.375f, 57.12f, 58.395f)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment