プリンキピア

第4章分類のための線形ニューラルネットワーク

4.2.3. Visualization4.2.3 可視化

We will often be using the Fashion-MNIST dataset. A convenience function show_images can be used to visualize the images and the associated labels. Skipping implementation details, we just show the interface below: we only need to know how to invoke d2l.show_images rather than how it works for such utility functions.
英語のヒント
Fashion-MNISTデータセットはこれからよく使う。便利な関数show_imagesを使えば、画像と対応するラベルを可視化できる。実装の詳細は飛ばして、下にはインターフェースだけを示す。こうしたユーティリティ関数については、d2l.show_imagesがどう動くかではなく、どう呼び出すかだけを知っていればよい。
def show_images(imgs, num_rows, num_cols, titles=None, scale=1.5):  #@save
    """Plot a list of images."""
    raise NotImplementedError
Let’s put it to good use. In general, it is a good idea to visualize and inspect data that you are training on. Humans are very good at spotting oddities and because of that, visualization serves as an additional safeguard against mistakes and errors in the design of experiments. Here are the images and their corresponding labels (in text) for the first few examples in the training dataset.
英語のヒント
さっそく活用しよう。一般に、訓練に使っているデータを可視化して点検するのはよい考えである。人間は奇妙なものを見つけるのがとても得意なので、可視化は、実験の設計における誤りや間違いに対する、追加の安全装置の役目を果たす。訓練データセットの最初のいくつかの事例について、画像とそれに対応する(文字による)ラベルを示す。
@d2l.add_to_class(FashionMNIST)  #@save
def visualize(self, batch, nrows=1, ncols=8, labels=[]):
    X, y = batch
    if not labels:
        labels = self.text_labels(y)
    d2l.show_images(X.squeeze(1), nrows, ncols, titles=labels)
batch = next(iter(data.val_dataloader()))
data.visualize(batch)
We are now ready to work with the Fashion-MNIST dataset in the sections that follow.
英語のヒント
これで、続く節でFashion-MNISTデータセットを扱う準備ができた。