Up all_image_labels 作成: 2021-04-24
更新: 2021-04-28


    ラベルを一覧:
      >>> label_names = \ ... sorted(item.name for item in data_root.glob('*/') if item.is_dir()) >>> label_names ['daisy', 'dandelion', 'roses', 'sunflowers', 'tulips'] >>>

    ラベルにインデックスを割り当てる:
      >>> label_to_index = \ ... dict((name, index) for index,name in enumerate(label_names)) >>>> label_to_index {'daisy': 0, 'dandelion': 1, 'roses': 2, 'sunflowers': 3, 'tulips': 4} >>>

    ファイルとラベルのインデックスの一覧 all_image_labels を作成:
      >>> all_image_labels = \ ... [label_to_index[pathlib.Path(path).parent.name] for path in all_image_paths]

    最初の 10個を表示:
      >>> print("First 10 labels indices: ", all_image_labels[:10]) First 10 labels indices: [2, 2, 2, 2, 2, 2, 2, 2, 2, 2] >>>