Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
See Also
--------
`Cat Dataset `_
"""
out_dir = os.path.abspath(out_dir)
data_path = os.path.join(out_dir, "Cats")
os.makedirs(data_path, exist_ok=True)
if not os.path.isfile(os.path.join(data_path, "cats.zip")):
print("\tDownloading Data")
kaggle.api.dataset_download_cli("crawford/cat-dataset",
path=data_path, unzip=True)
if not (os.path.isdir(os.path.join(data_path, "train")) and
os.path.isdir(os.path.join(data_path, "test"))):
if not os.path.isdir(os.path.join(data_path, "tmp_data")):
print("\tExtracting Data")
with zipfile.ZipFile(os.path.join(data_path, "cats.zip")) as zip_ref:
zip_ref.extractall(os.path.join(data_path, "tmp_data"))
# get all jpeg files
sub_dirs = [os.path.join(data_path, "tmp_data", x)
for x in os.listdir(os.path.join(data_path, "tmp_data"))
if os.path.isdir(os.path.join(data_path, "tmp_data", x))]
img_files = []
dest='unzip',
action='store_true',
help=Help.param_unzip)
parser_datasets_download_optional.add_argument('-o',
'--force',
dest='force',
action='store_true',
help=Help.param_force)
parser_datasets_download_optional.add_argument('-q',
'--quiet',
dest='quiet',
action='store_true',
help=Help.param_quiet)
parser_datasets_download._action_groups.append(
parser_datasets_download_optional)
parser_datasets_download.set_defaults(func=api.dataset_download_cli)
# Datasets create
parser_datasets_create = subparsers_datasets.add_parser(
'create',
formatter_class=argparse.RawTextHelpFormatter,
help=Help.command_datasets_new)
parser_datasets_create_optional = parser_datasets_create._action_groups.pop(
)
parser_datasets_create_optional.add_argument(
'-p',
'--path',
dest='folder',
required=False,
help=Help.param_dataset_upfile)
parser_datasets_create_optional.add_argument('-u',
'--public',