'Args:
dir (str): A directory containing a subdir named ``name``, where the
original ``ILSVRC12_img_{name}.tar`` gets decompressed.
name (str): \'train\' or \'val\' or \'test\'.
shuffle (bool): shuffle the dataset.
Defaults to True if name==\'train\'.
dir_structure (str): The directory structure of \'val\' and \'test\' directory.
\'original\' means the original decompressed
directory, which only has list of image files (as below).
If set to \'train\', it expects the same two-level
directory structure simlar to \'train/\'.
Examples:
When `dir_structure==\'original\'`, `dir` should have the following structure:
.. code-block:: none
dir/
train/
n02134418/
n02134418_198.JPEG
val/
ILSVRC2012_val_00000001.JPEG
test/
ILSVRC2012_test_00000001.JPEG
With the downloaded ILSVRC12_img_*.tar, you can use the following
command to build the above structure:
.. code-block:: none
mkdir val && tar xvf ILSVRC12_img_val.tar -C val
mkdir test && tar xvf ILSVRC12_img_test.tar -C test
mkdir train && tar xvf ILSVRC12_img_train.tar -C train && cd train
find -type f -name \'*.tar\' | parallel -P 10 \'echo {} && mkdir -p {/.} && tar xf {} -C {/.}\''

def __init__(self, dir, name, meta_dir=None, shuffle=None, dir_structure='original'):

    super(ILSVRC12, self).__init__(dir, name, meta_dir, shuffle, dir_structure)
