<jupyter_start><jupyter_text>Image TransferThis script extracts the highest resolutional images from their folders, renames them according to their folder, and saves them in a new directory.  Set directory and new directory<jupyter_code>dir = "./models/coco_AttnGAN2"
new_dir = "./models/new_images"<jupyter_output><empty_output><jupyter_text>Check for existing new directory<jupyter_code>if not os.path.exists(new_dir):
    os.makedirs(new_dir)<jupyter_output><empty_output><jupyter_text>Transfer the new images<jupyter_code>for root, dirs, files in os.walk(dir):
    if not files:
        continue
    prefix = os.path.basename(root)

    for f in files:
        if f == "0_s_0_g2.png":
            os.rename(os.path.join(root, f), os.path.join(new_dir, f"{prefix}.png"))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10834371108343711, 'fraction_numerical': 0.0049813200498132005, 'mean_word_length': 5.0, 'pattern_counts': {'":': 1, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '237472', 'license': 'MIT', 'n_tokens_mistral': 282, 'n_tokens_neox': 276, 'n_words': 64, 'path': '05 - new_images_rename.ipynb', 'repo_name': 's-52/AttnGAN', 'size': '803'}