def _mock_imagenet_dir(temp_dir):
    """Creates a mock directory with 5 noun-id directores and 3 variants of the noun images. Random images are used."""
    noun_id_to_text = dict()
    for i in range(MOCK_NOUNS_COUNT):
        # Make noun-id directory (e.g. n00000001 format)
        noun_id = 'n0000000{}'.format(i)
        noun_id_to_text[noun_id] = 'text for {}'.format(noun_id)
        noun_dir = os.path.join(temp_dir, noun_id)
        os.mkdir(noun_dir)

        # Create 3 noun image variants (e.g n00000001_0001.JPEG)
        for variant_id in range(MOCK_VARIANTS_COUNT):
            jpeg_path = os.path.join(noun_dir, '{}_000{}.JPEG'.format(noun_id, variant_id))
            dummy_image = np.random.randint(0, 255, size=MOCK_IMAGE_SIZE, dtype=np.uint8)
            cv2.imwrite(jpeg_path, dummy_image)
    return noun_id_to_text
Creates a mock directory with 5 noun-id directores and 3 variants of the noun images. Random images are used.
examples/imagenet/tests/test_generate_imagenet_dataset.py