-
-
Save leimao/c533ef990e5267284e33b25297fdaa78 to your computer and use it in GitHub Desktop.
script for ImageNet data extract.
This file contains 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
#!/bin/bash | |
# | |
# script to extract ImageNet dataset | |
# ILSVRC2012_img_train.tar (about 138 GB) | |
# ILSVRC2012_img_val.tar (about 6.3 GB) | |
# make sure ILSVRC2012_img_train.tar & ILSVRC2012_img_val.tar in your current directory | |
# | |
# https://github.com/facebook/fb.resnet.torch/blob/master/INSTALL.md | |
# | |
# train/ | |
# ├── n01440764 | |
# │ ├── n01440764_10026.JPEG | |
# │ ├── n01440764_10027.JPEG | |
# │ ├── ...... | |
# ├── ...... | |
# val/ | |
# ├── n01440764 | |
# │ ├── ILSVRC2012_val_00000293.JPEG | |
# │ ├── ILSVRC2012_val_00002138.JPEG | |
# │ ├── ...... | |
# ├── ...... | |
# | |
# | |
# Extract the training data: | |
# | |
mkdir train && mv ILSVRC2012_img_train.tar train/ && cd train | |
tar -xvf ILSVRC2012_img_train.tar && rm -f ILSVRC2012_img_train.tar | |
find . -name "*.tar" | while read NAME ; do mkdir -p "${NAME%.tar}"; tar -xvf "${NAME}" -C "${NAME%.tar}"; rm -f "${NAME}"; done | |
cd .. | |
# | |
# Extract the validation data and move images to subfolders: | |
# | |
mkdir val && mv ILSVRC2012_img_val.tar val/ && cd val && tar -xvf ILSVRC2012_img_val.tar | |
wget -qO- https://raw.githubusercontent.com/soumith/imagenetloader.torch/master/valprep.sh | bash | |
# | |
# Check total files after extract | |
# | |
# $ find train/ -name "*.JPEG" | wc -l | |
# 1281167 | |
# $ find val/ -name "*.JPEG" | wc -l | |
# 50000 | |
# |
This file contains 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
#!/bin/bash | |
# | |
# script to extract ImageNet dataset | |
# ILSVRC2012_img_train.tar (about 138 GB) | |
# ILSVRC2012_img_val.tar (about 6.3 GB) | |
# make sure ILSVRC2012_img_train.tar & ILSVRC2012_img_val.tar in your current directory | |
# | |
# https://github.com/facebook/fb.resnet.torch/blob/master/INSTALL.md | |
# | |
# train/ | |
# ├── n01440764 | |
# │ ├── n01440764_10026.JPEG | |
# │ ├── n01440764_10027.JPEG | |
# │ ├── ...... | |
# ├── ...... | |
# val/ | |
# ├── n01440764 | |
# │ ├── ILSVRC2012_val_00000293.JPEG | |
# │ ├── ILSVRC2012_val_00002138.JPEG | |
# │ ├── ...... | |
# ├── ...... | |
# | |
# | |
# Extract the training data: | |
# | |
mkdir train && mv ILSVRC2012_img_train.tar train/ && cd train | |
tar -xf ILSVRC2012_img_train.tar && rm -f ILSVRC2012_img_train.tar | |
find . -name "*.tar" | while read NAME ; do mkdir -p "${NAME%.tar}"; tar -xf "${NAME}" -C "${NAME%.tar}"; rm -f "${NAME}"; done | |
cd .. | |
# | |
# Extract the validation data and move images to subfolders: | |
# | |
mkdir val && mv ILSVRC2012_img_val.tar val/ && cd val && tar -xf ILSVRC2012_img_val.tar | |
wget -qO- https://raw.githubusercontent.com/soumith/imagenetloader.torch/master/valprep.sh | bash | |
# | |
# Check total files after extract | |
# | |
# $ find train/ -name "*.JPEG" | wc -l | |
# 1281167 | |
# $ find val/ -name "*.JPEG" | wc -l | |
# 50000 | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment