LFW 顔画像データセットのダウンロードと確認(Python,scikit-learn を使用)
文献
G. B. Huang, M. Ramesh, T. Berg, and E. Learned-miller. Labeled
faces in the wild: A database for studying face recognition in un-
constrained environments. In ECCV Workshop on Faces in Real-life
Images, 2008.
前準備
Python の準備(Windows,Ubuntu 上)
- Windows での Python 3.10,関連パッケージ,Python 開発環境のインストール(winget を使用しないインストール): 別ページ »で説明
- Ubuntu では,システム Pythonを使うことができる.Python3 開発用ファイル,pip, setuptools のインストール: 別ページ »で説明
【サイト内の関連ページ】
- Python のまとめ: 別ページ »にまとめ
- Google Colaboratory の使い方など: 別ページ »で説明
【関連する外部ページ】 Python の公式ページ: https://www.python.org/
scikit-learn のインストール
- Windows の場合
Windows では,コマンドプロンプトを管理者として実行し, 次のコマンドを実行する.
python -m pip install -U scikit-learn scikit-learn-intelex
- Ubuntu の場合
# パッケージリストの情報を更新 sudo apt update sudo apt -y install python3-sklearn
LFW データセット
LFW (the Labeled Faces in the Wild people dataset) の公式ページ: http://vis-www.cs.umass.edu/lfw/
- datasets.fetch_lfw_pairs([subset, ...]) Loader for the Labeled Faces in the Wild (LFW) pairs dataset
- datasets.fetch_lfw_people([data_home, ...]) Loader for the Labeled Faces in the Wild (LFW) people dataset, http://vis-www.cs.umass.edu
Python プログラムの実行
- LFW のダウンロードとロード
import sklearn.datasets a = sklearn.datasets.fetch_lfw_people(resize=1.0, color=True)
- 画像数,画像の縦横サイズの確認
print(a.images.shape)
- 0番目の確認表示
import cv2 cv2.imshow("", cv2.cvtColor(a.images[0], cv2.COLOR_RGB2BGR)) cv2.waitKey(0) cv2.destroyAllWindows() # pl.imshow(255.0 - a.data[0])