Created
April 3, 2018 10:55
-
-
Save innerlee/8c19b27cf0ee3b6e3cd2d5f85c10764c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addprocs() | |
src_path = "train" | |
dst_path = "/mnt/SSD/datasets/imagnet128" | |
mkpath(dst_path) | |
for folder in readdir(src_path) | |
println("processing folder $folder") | |
files = filter(f -> endswith(f, ".JPEG"), readdir(joinpath(src_path, folder))) | |
args = [(joinpath(src_path, folder, f), joinpath(dst_path, folder, f)) for f in files] | |
mkpath(joinpath(dst_path, folder)) | |
pmap(args) do fs | |
try | |
run(`convert $(fs[1]) -resize 128x128+0+0^ -gravity center -crop 128x128+0+0 $(fs[2])`) | |
catch | |
println(">> error in $(fs[1])") | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment