def load_flickr1M_dataset(tag='<STR_LIT>', size=<NUM_LIT:10>, path="<STR_LIT:data>", n_threads=<NUM_LIT:50>, printable=False):
import shutil<EOL>path = os.path.join(path, '<STR_LIT>')<EOL>logging.info("<STR_LIT>".format(size * <NUM_LIT:10>, size * <NUM_LIT>))<EOL>images_zip = [<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>'<EOL>]<EOL>tag_zip = '<STR_LIT>'<EOL>url = '<STR_LIT>'<EOL>for image_zip in images_zip[<NUM_LIT:0>:size]:<EOL><INDENT>image_folder = image_zip.split("<STR_LIT:.>")[<NUM_LIT:0>]<EOL>if folder_exists(os.path.join(path, image_folder)) is False:<EOL><INDENT>logging.info("<STR_LIT>".format(image_folder, path))<EOL>maybe_download_and_extract(image_zip, path, url, extract=True)<EOL>del_file(os.path.join(path, image_zip))<EOL>shutil.move(os.path.join(path, '<STR_LIT>'), os.path.join(path, image_folder))<EOL><DEDENT>else:<EOL><INDENT>logging.info("<STR_LIT>".format(image_folder, path))<EOL><DEDENT><DEDENT>if folder_exists(os.path.join(path, "<STR_LIT>")) is False:<EOL><INDENT>logging.info("<STR_LIT>".format(path))<EOL>maybe_download_and_extract(tag_zip, path, url, extract=True)<EOL>del_file(os.path.join(path, tag_zip))<EOL><DEDENT>else:<EOL><INDENT>logging.info("<STR_LIT>".format(path))<EOL><DEDENT>images_list = []<EOL>images_folder_list = []<EOL>for i in range(<NUM_LIT:0>, size):<EOL><INDENT>images_folder_list += load_folder_list(path=os.path.join(path, '<STR_LIT>' % i))<EOL><DEDENT>images_folder_list.sort(key=lambda s: int(s.split('<STR_LIT:/>')[-<NUM_LIT:1>]))  <EOL>for folder in images_folder_list[<NUM_LIT:0>:size * <NUM_LIT:10>]:<EOL><INDENT>tmp = load_file_list(path=folder, regx='<STR_LIT>', printable=False)<EOL>tmp.sort(key=lambda s: int(s.split('<STR_LIT:.>')[-<NUM_LIT:2>]))  <EOL>images_list.extend([os.path.join(folder, x) for x in tmp])<EOL><DEDENT>tag_list = []<EOL>tag_folder_list = load_folder_list(os.path.join(path, "<STR_LIT>"))<EOL>tag_folder_list.sort(key=lambda s: int(os.path.basename(s)))<EOL>for folder in tag_folder_list[<NUM_LIT:0>:size * <NUM_LIT:10>]:<EOL><INDENT>tmp = load_file_list(path=folder, regx='<STR_LIT>', printable=False)<EOL>tmp.sort(key=lambda s: int(s.split('<STR_LIT:.>')[-<NUM_LIT:2>]))  <EOL>tmp = [os.path.join(folder, s) for s in tmp]<EOL>tag_list += tmp<EOL><DEDENT>logging.info("<STR_LIT>".format(tag))<EOL>select_images_list = []<EOL>for idx, _val in enumerate(tag_list):<EOL><INDENT>tags = read_file(tag_list[idx]).split('<STR_LIT:\n>')<EOL>if tag in tags:<EOL><INDENT>select_images_list.append(images_list[idx])<EOL><DEDENT><DEDENT>logging.info("<STR_LIT>".format(tag))<EOL>images = visualize.read_images(select_images_list, '<STR_LIT>', n_threads=n_threads, printable=printable)<EOL>return images<EOL>
Load Flick1M dataset.

    Returns a list of images by a given tag from Flickr1M dataset,
    it will download Flickr1M from `the official website <http://press.liacs.nl/mirflickr/mirdownload.html>`__
    at the first time you use it.

    Parameters
    ------------
    tag : str or None
        What images to return.
            - If you want to get images with tag, use string like 'dog', 'red', see `Flickr Search <https://www.flickr.com/search/>`__.
            - If you want to get all images, set to ``None``.

    size : int
        integer between 1 to 10. 1 means 100k images ... 5 means 500k images, 10 means all 1 million images. Default is 10.
    path : str
        The path that the data is downloaded to, defaults is ``data/flickr25k/``.
    n_threads : int
        The number of thread to read image.
    printable : boolean
        Whether to print infomation when reading images, default is ``False``.

    Examples
    ----------
    Use 200k images

    >>> images = tl.files.load_flickr1M_dataset(tag='zebra', size=2)

    Use 1 Million images

    >>> images = tl.files.load_flickr1M_dataset(tag='zebra')