$30 off During Our Annual Pro Sale. View Details »

オートエンコーダーと異常検知入門

 オートエンコーダーと異常検知入門

「実践者向けディープラーニング勉強会 第四回」に向けた資料。
https://dl4-practitioners.connpass.com/event/132618/

オートエンコーダー以外の手法も少し触れてます。

kmotohas

June 19, 2019
Tweet

More Decks by kmotohas

Other Decks in Technology

Transcript

  1. Kazuki Motohashi - Skymind K.K.
    実践者向けディープラーニング勉強会 第4回 - 19/June/2019
    スカイマインド株式会社
    本橋 和貴
    オートエンコーダーと異常検知⼊⾨

    View Slide

  2. Kazuki Motohashi - Skymind K.K.
    実践者向けディープラーニング勉強会 第4回 - 19/June/2019
    ‣本橋 和貴 @kmotohas
    - スカイマインド株式会社
    • Deep Learning Engineer (前職ではDL+ROS)
    - 素粒⼦物理学実験(LHC-ATLAS実験)出⾝
    • 博⼠(理学)
    - 好きな定理︓ネーターの定理
    2
    ࣗݾ঺հ
    ܥʹ࿈ଓతͳରশੑ͕͋Δ৔߹͸ͦΕʹରԠ͢Δอଘଇ͕ଘࡏ͢Δͱड़΂ΔఆཧͰ͋Δɻ(Wikipedia)

    View Slide

  3. Kazuki Motohashi - Skymind K.K.
    実践者向けディープラーニング勉強会 第4回 - 19/June/2019 3
    ‣ オートエンコーダーとは何か
    - Convolutional Autoencoder
    ‣ 異常検知への適⽤
    - テーブルデータ
    - 画像データ
    ࠓճ࿩͢͜ͱ

    View Slide

  4. Kazuki Motohashi - Skymind K.K.
    実践者向けディープラーニング勉強会 第4回 - 19/June/2019 4
    ΦʔτΤϯίʔμʔͱ͸
    IUUQTEFWFMPQFSPSBDMFDPNEBUBCBTFTOFVSBMOFUXPSLNBDIJOFMFBSOJOH
    IUUQTNFEJVNDPN!DVSJPVTJMZDSFEJUDBSEGSBVEEFUFDUJPOVTJOHBVUPFODPEFSTJOLFSBTUFOTPSqPXGPSIBDLFSTQBSUWJJFDCE
    ҰൠతͳχϡʔϥϧωοτϫʔΫ
    ΦʔτΤϯίʔμʔ
    f(x) = y
    AAACaXichVFNLwNBGH66vuuruAiXxoZwaWZLQiQS4eJIqyWhaXbXlNX9yu60UY0/4OQmOJGIiJ/h4g849CeII4mLg3e3mwiCdzIzzzzzPu88M6O5puELxhoxqaW1rb2jsyve3dPb158YGMz7TsXTeU53TMfb1FSfm4bNc8IQJt90Pa5amsk3tPJysL9R5Z5vOPa6qLm8YKm7tlEydFUQlS9NHkwt1IoJmaVYGMmfQImAjChWncQNtrEDBzoqsMBhQxA2ocKntgUFDC5xBdSJ8wgZ4T7HEeKkrVAWpwyV2DKNu7Tailib1kFNP1TrdIpJ3SNlEuPskd2yF/bA7tgTe/+1Vj2sEXip0aw1tdwt9h8PZ9/+VVk0C+x9qv70LFDCXOjVIO9uyAS30Jv66uHpS3Y+M16fYFfsmfxfsga7pxvY1Vf9eo1nLhCnD1C+P/dPkE+nlOlUem1GXlyKvqIToxjDJL33LBaxglXk6Nx9nOAM57FnaUAalkaaqVIs0gzhS0jyB5Ffi5s=
    f(x) = x
    AAACaXichVFNSwJBGH7cvsw+1LpEXSQx6iKjBUUQSF06pqYJJrK7jba57i67q2jSH+jULapTQUT0M7r0Bzr4E8JjQZcOva4LUVK9w8w888z7vPPMjGSoimUz1vYIA4NDwyPeUd/Y+MSkPxCcylp6zZR5RtZV3cxJosVVReMZW7FVnjNMLlYlle9Jla3u/l6dm5aia7t20+CFqljWlJIiizZR2dJiY2mjUQyEWZQ5EeoHMReE4caOHrjDPg6gQ0YNVXBosAmrEGFRyyMGBoO4AlrEmYQUZ5/jBD7S1iiLU4ZIbIXGMq3yLqvRulvTctQynaJSN0kZQoQ9s3v2yp7YA3thH7/Wajk1ul6aNEs9LTeK/tOZ9Pu/qirNNg6/VH96tlHCmuNVIe+Gw3RvIff09ePz1/R6KtJaYDesQ/6vWZs90g20+pt8m+SpK/joA2I/n7sfZOPR2HI0nlwJJzbdr/BiDvNYpPdeRQLb2EGGzj3CGS5w6ekIQWFGmO2lCh5XM41vIYQ/AY9fi5o=

    View Slide

  5. Kazuki Motohashi - Skymind K.K.
    実践者向けディープラーニング勉強会 第4回 - 19/June/2019 5
    ΦʔτΤϯίʔμʔͷΠϝʔδ
    ѹॖ ղౚ
    தؒͷϘτϧωοΫͰ
    σʔλͷޮ཰తͳʮදݱʯΛநग़
    Πϝʔδ͸ϑΝΠϧͷѹॖɾղౚ
    "VUPFODPEFS
    ʹࣗݾූ߸Խث
    ڭࢣ͕ࣗ෼ࣗ਎ͷ
    ʮڭࢣͳֶ͠शʯ

    View Slide

  6. Kazuki Motohashi - Skymind K.K.
    実践者向けディープラーニング勉強会 第4回 - 19/June/2019 6
    5FOTPSqPX ,FSBT
    Ͱͷ࣮૷ྫ
    ‏ೖྗͱ໨ඪͷग़ྗ͸ͲͪΒ΋܇࿅σʔλͱֶͯ͠श
    ‏༻͍ΔϞδϡʔϧͷΠϯϙʔτ
    ‏σʔλͷಡΈࠐΈɺਖ਼نԽ
    ɹೋ࣍ݩͷը૾ΛҰ࣍ݩͷϕΫτϧʹม׵

    View Slide

  7. Kazuki Motohashi - Skymind K.K.
    実践者向けディープラーニング勉強会 第4回 - 19/June/2019 7
    ςετσʔλͷ෮ݩ
    ‏ςετσʔλΛҰ࣍ݩϕΫτϧʹͯ͠Ϟσϧʹೖྗ
    ‏NBUQMPUMJCͰҰຕΊͷը૾ͷ෮ݩ݁ՌΛ֬ೝ
    ݩσʔλ ෮ݩ͞Εͨσʔλ
    º͔Β࣍ݩ·Ͱ৘ใѹॖͯ͠΋
    σʔλΛ͏·͘෮ݩͰ͖͍ͯΔ
    ʢූ߸Խͯ͠΋৘ใ͕΄ͱΜͲࣦΘΕ͍ͯͳ͍ʣ

    View Slide

  8. Kazuki Motohashi - Skymind K.K.
    実践者向けディープラーニング勉強会 第4回 - 19/June/2019 8
    $"& $POWPMVUJPOBM"VUP&ODPEFS

    શ݁߹૚Ͱ͸ͳ͘৞ΈࠐΈ૚Λ༻͍ͨΦʔτΤϯίʔμʔ
    IUUQTTFpLTDPNDPOWPMVUJPOBMBVUPFODPEFSDMVTUFSJOHJNBHFTXJUIOFVSBMOFUXPSLT

    View Slide

  9. Kazuki Motohashi - Skymind K.K.
    実践者向けディープラーニング勉強会 第4回 - 19/June/2019 9
    ‏.BY1PPMJOH%Ͱը૾αΠζΛখ͘͢͞Δ
    ‏6Q4BNQMJOH%Ͱը૾αΠζΛେ͖͘͢Δ
    ,FSBTΛ༻͍ͨ$"&ͷ࣮૷ྫ

    View Slide

  10. Kazuki Motohashi - Skymind K.K.
    実践者向けディープラーニング勉強会 第4回 - 19/June/2019 10
    ,FSBTΛ༻͍ͨ$"&ͷ࣮૷ྫ
    ‏.BY1PPMJOH%Ͱը૾αΠζΛখ͘͢͞Δ
    ‏6Q4BNQMJOH%Ͱը૾αΠζΛେ͖͘͢Δ

    View Slide

  11. Kazuki Motohashi - Skymind K.K.
    実践者向けディープラーニング勉強会 第4回 - 19/June/2019 11
    $"&ʹΑΔը૾ͷූ߸Խͱ෮߸Խ

    View Slide

  12. Kazuki Motohashi - Skymind K.K.
    実践者向けディープラーニング勉強会 第4回 - 19/June/2019 12
    ಉ͡ϞσϧͰ΋͏·͘෮߸Ͱ͖ͳ͍έʔε
    ܇࿅σʔληοτͱҟͳΔ෼෍ͷσʔλ͸͏·͘෮߸Ͱ͖ͳ͍
    ϊΠζ͕৐͍ͬͯͨΓܗ͕ಛघͩͬͨΓ

    View Slide

  13. Kazuki Motohashi - Skymind K.K.
    実践者向けディープラーニング勉強会 第4回 - 19/June/2019 13
    ಉ͡ϞσϧͰ΋͏·͘෮߸Ͱ͖ͳ͍έʔε
    ܇࿅σʔληοτͱҟͳΔ෼෍ͷσʔλ͸͏·͘෮߸Ͱ͖ͳ͍
    ϊΠζ͕৐͍ͬͯͨΓܗ͕ಛघͩͬͨΓ
    ҟৗݕ஌ʹ࢖͑Δ

    View Slide

  14. Kazuki Motohashi - Skymind K.K.
    実践者向けディープラーニング勉強会 第4回 - 19/June/2019 14
    ҟৗݕ஌λεΫͷྫ
    %FFQ-FBSOJOHGPS"OPNBMZ%FUFDUJPO"4VSWFZ
    ಈը ը૾
    ࣌ܥྻ
    ϩά
    ʢςΩετʣ

    View Slide

  15. Kazuki Motohashi - Skymind K.K.
    実践者向けディープラーニング勉強会 第4回 - 19/June/2019 15
    ‣ 「異常」というくらいなのでデータ数が少ない
    - ⼀般的に「正常データ数 >> 異常データ数」
    ‣ 分類問題として教師あり学習で解くのは難しい
    ‣ 教師なし学習(もしくは半教師あり学習)で解くことが多い
    - 正常データのみで学習すると異常データの再構成誤差が⼤きくなることを利⽤
    ҟৗݕ஌λεΫͱڭࢣͳֶ͠श

    View Slide

  16. Kazuki Motohashi - Skymind K.K.
    実践者向けディープラーニング勉強会 第4回 - 19/June/2019 16
    ‣ ULB (ブリュッセル⾃由⼤学) 提供のテーブルデータセット
    - https://www.kaggle.com/mlg-ulb/creditcardfraud
    ‣ PCAで匿名化された特徴量28個と時間・取引⾦額・正常/不正の⼆値ラベル
    ΫϨδοτΧʔυෆਖ਼ར༻ݕ஌ͷྫ
    ॎ࣠ϩάεέʔϧ
    ਖ਼ৗσʔλʢෆਖ਼σʔλʣͷΈΛ༻͍ͯΦʔτΤϯίʔμʔΛֶश

    View Slide

  17. Kazuki Motohashi - Skymind K.K.
    実践者向けディープラーニング勉強会 第4回 - 19/June/2019 17
    ‣ 以降3ページ、DATASCIENCE.COMのチュートリアルより拝借
    - https://www.datascience.com/blog/fraud-detection-with-tensorflow
    ΦʔτΤϯίʔμʔͷ࣮૷ྫ
    nb_epoch = 100
    batch_size = 128
    input_dim = train_x.shape[1] #num of columns, 30
    encoding_dim = 14
    hidden_dim = int(encoding_dim / 2) #i.e. 7
    learning_rate = 1e-7
    input_layer = Input(shape=(input_dim, ))
    encoder = Dense(encoding_dim, activation="tanh",
    activity_regularizer=regularizers.l1(learning_rate))(input_layer)
    encoder = Dense(hidden_dim, activation="relu")(encoder)
    decoder = Dense(hidden_dim, activation='tanh')(encoder)
    decoder = Dense(input_dim, activation='relu')(decoder)
    autoencoder = Model(inputs=input_layer, outputs=decoder)

    View Slide

  18. Kazuki Motohashi - Skymind K.K.
    実践者向けディープラーニング勉強会 第4回 - 19/June/2019 18
    ࠶ߏ੒ޡࠩ .4&
    ͷ෼෍
    Reconstruction Error Reconstruction Error
    Number of Transactions
    Number of Transactions
    0 2 4 6 8 10 0 50 100 150 200 250
    ෼෍ܗঢ়͕༏Ґʹҟͳ͍ͬͯΔ‎ᮢ஋ΛܾΊͯਖ਼ৗҟৗ൑ผ
    IUUQTNFEJVNDPN!DVSJPVTJMZDSFEJUDBSEGSBVEEFUFDUJPOVTJOHBVUPFODPEFSTJOLFSBTUFOTPSqPXGPSIBDLFSTQBSUWJJFDCE

    View Slide

  19. Kazuki Motohashi - Skymind K.K.
    実践者向けディープラーニング勉強会 第4回 - 19/June/2019 19
    ֤σʔλʹର͢Δ࠶ߏ੒ޡࠩͷࢄ෍ਤͱࠞ߹ߦྻ

    View Slide

  20. Kazuki Motohashi - Skymind K.K.
    実践者向けディープラーニング勉強会 第4回 - 19/June/2019 20
    .75FD"OPNBMZ%FUFDUJPO%BUBTFU .75FD"%

    aset of
    rial ac-
    ct-free
    mages
    dust or
    le kind
    evalu-
    fferent
    cal in-
    a 2007
    provide
    es with
    h class
    ng and
    nnota-
    nerated
    arance
    ore, ar-
    pproxi-
    aly de-
    gested
    give a
    ct our-
    meth-
    initial
    Figure 2: Example images for all five textures and ten ob-
    ject categories of the MVTec AD dataset. For each cate-
    2.1.2 Segmentation of Anomalous Regions
    For the evaluation of methods that segment anomalies in
    images, only very few public datasets are currently avail-
    able. All of them focus on the inspection of textured sur-
    faces and, to the best of our knowledge, there does not yet
    exist a comprehensive dataset that allows for the segmenta-
    tion of anomalous regions in natural images.
    Carrera et al. [6] provide NanoTWICE,2 a dataset of
    45 gray-scale images that show a nanofibrous material ac-
    quired by a scanning electron microscope. Five defect-free
    images can be used for training. The remaining 40 images
    contain anomalous regions in the form of specks of dust or
    flattened areas. Since the dataset only provides a single kind
    of texture, it is unclear how well algorithms that are evalu-
    ated on this dataset generalize to other textures of different
    domains.
    A dataset that is specifically designed for optical in-
    spection of textured surfaces was proposed during a 2007
    DAGM workshop by Wieler and Hahn [28]. They provide
    ten classes of artificially generated gray-scale textures with
    defects weakly annotated in the form of ellipses. Each class
    comprises 1000 defect-free texture patches for training and
    150 defective patches for testing. However, their annota-
    tions are quite coarse and since the textures were generated
    by very similar texture models, the variance in appearance
    between the different textures is quite low. Furthermore, ar-
    tificially generated datasets can only be seen as an approxi-
    .75FD͸υΠπɾϛϡϯϔϯͷը૾ॲཧιϑτ΢ΣΞ։ൃձࣾ
    IUUQTXXXNWUFDDPNDPNQBOZSFTFBSDIEBUBTFUT
    ຕҎ্ͷҟৗݕ஌༻ը૾σʔληοτΛެ։
    छྨͷҟͳΔ෺ମͱςΫενϟͷਖ਼ৗҟৗσʔλΛؚΉ
    ղઆ࿦จ͸ίϯϐϡʔλϏδϣϯͷτοϓձٞ$713Ͱ࠾୒

    View Slide

  21. Kazuki Motohashi - Skymind K.K.
    実践者向けディープラーニング勉強会 第4回 - 19/June/2019 21
    .75FD"OPNBMZ%FUFDUJPO%BUBTFU .75FD"%

    Category
    AE
    (SSIM)
    AE
    (L2)
    AnoGAN
    CNN
    Feature
    Dictionary
    Texture
    Inspection
    Variation
    Model
    Textures
    Carpet
    0.43
    0.90
    0.57
    0.42
    0.82
    0.16
    0.89
    0.36
    0.57
    0.61
    -
    Grid
    0.38
    1.00
    0.57
    0.98
    0.90
    0.12
    0.57
    0.33
    1.00
    0.05
    -
    Leather
    0.00
    0.92
    0.06
    0.82
    0.91
    0.12
    0.63
    0.71
    0.00
    0.99
    -
    Tile
    1.00
    0.04
    1.00
    0.54
    0.97
    0.05
    0.97
    0.44
    1.00
    0.43
    -
    Wood
    0.84
    0.82
    1.00
    0.47
    0.89
    0.47
    0.79
    0.88
    0.42
    1.00
    -
    Objects
    Bottle
    0.85
    0.90
    0.70
    0.89
    0.95
    0.43
    1.00
    0.06
    -
    1.00
    0.13
    Cable
    0.74
    0.48
    0.93
    0.18
    0.98
    0.07
    0.97
    0.24
    - -
    Capsule
    0.78
    0.43
    1.00
    0.24
    0.96
    0.20
    0.78
    0.03
    -
    1.00
    0.03
    Hazelnut
    1.00
    0.07
    0.93
    0.84
    0.83
    0.16
    0.90
    0.07
    - -
    Metal nut
    1.00
    0.08
    0.68
    0.77
    0.86
    0.13
    0.55
    0.74
    -
    0.32
    0.83
    Pill
    0.92
    0.28
    1.00
    0.23
    1.00
    0.24
    0.85
    0.06
    -
    1.00
    0.13
    Screw
    0.95
    0.06
    0.98
    0.39
    0.41
    0.28
    0.73
    0.13
    -
    1.00
    0.10
    Toothbrush
    0.75
    0.73
    1.00
    0.97
    1.00
    0.13
    1.00
    0.03
    -
    1.00
    0.60
    Transistor
    1.00
    0.03
    0.97
    0.45
    0.98
    0.35
    1.00
    0.15
    - -
    Zipper
    1.00
    0.60
    0.97
    0.63
    0.78
    0.40
    0.78
    0.29
    - -
    Table 2: Results of the evaluated methods when ap-
    plied to the classification of anomalous images. For each
    dataset category, the ratio of correctly classified samples
    of anomaly-free (top row) and anomalous images (bottom
    ment is not possible for every ob
    strict the evaluation of this meth
    (Table 2). We use 30 randomly se
    each object category in its origin
    and variance parameters at each p
    are converted to gray-scale before
    Anomaly maps are obtained b
    of each test pixel’s gray value to
    relative to its predicted standard
    GMM-based texture inspection, w
    plementation of the HALCON ma
    4.2. Data Augmentation
    Since the evaluated methods ba
    are typically trained on large data
    performed for these methods for b
    For the texture images, we random
    lar patches of fixed size from the
    object category, we apply a random
    Additional mirroring is applied w
    We augment each category to crea
    4.3. Evaluation Metric
    Each of the evaluated method
    spatial map in which large value
    Regions
    egment anomalies in
    ts are currently avail-
    ction of textured sur-
    ge, there does not yet
    ows for the segmenta-
    mages.
    WICE,2 a dataset of
    nofibrous material ac-
    cope. Five defect-free
    remaining 40 images
    m of specks of dust or
    provides a single kind
    rithms that are evalu-
    r textures of different
    igned for optical in-
    oposed during a 2007
    n [28]. They provide
    ay-scale textures with
    of ellipses. Each class
    tches for training and
    owever, their annota-
    xtures were generated
    ariance in appearance
    low. Furthermore, ar-
    be seen as an approxi-
    pervised anomaly de-
    s have been suggested
    ntel et al. [20] give a
    ork. We restrict our-
    state-of-the art meth-
    baseline for our initial
    works
    Figure 2: Example images for all five textures and ten ob-
    ject categories of the MVTec AD dataset. For each cate-
    gory, the top row shows an anomaly-free image. The middle
    શମతʹΦʔτΤϯίʔμʔΛ༻͍ͨϞσϧ͕ڧ͍
    ্ஈਖ਼ৗσʔλͷਖ਼ղ཰
    Լஈҟৗσʔλͷਖ਼ղ཰

    View Slide

  22. Kazuki Motohashi - Skymind K.K.
    実践者向けディープラーニング勉強会 第4回 - 19/June/2019 22
    "& -
    ͱ"& 44*.

    ଛࣦؔ਺͸ඞͣࣗ৐ޡࠩͰͳͯ͘͸͍͚ͳ͍Θ͚Ͱ΋ͳ͍
    -ޡࠩ ࣗ৐ޡࠩ
    44*. 4USVDUVBM4*.JMBSJUZ
    JOEFY<>
    Dosovitskiy and Brox (2016). It increases the quality of
    the produced reconstructions by extracting features from
    both the input image x and its reconstruction ˆ
    x and enforc-
    ing them to be equal. Consider F : Rk⇥h⇥w ! Rf to be
    a feature extractor that obtains an f-dimensional feature
    vector from an input image. Then, a regularizer can be
    added to the loss function of the autoencoder, yielding
    the feature matching autoencoder (FM-AE) loss
    LFM(x, ˆ
    x) = L2(x, ˆ
    x) + kF(x) F(ˆ
    x)k2
    2
    , (3)
    where > 0 denotes the weighting factor between the two
    loss terms. F can be parameterized using the first layers of
    a CNN pretrained on an image classification task. During
    evaluation, a residual map RFM
    is obtained by comparing
    the per-pixel `2-distance of x and ˆ
    x. The hope is that
    sharper, more realistic reconstructions will lead to better
    residual maps compared to a standard `2-autoencoder.
    3.1.4. SSIM Autoencoder. We show that employing more
    elaborate architectures such as VAEs or FM-AEs does
    not yield satisfactory improvements of the residial maps
    over deterministic `2-autoencoders in the unsupervised
    defect segmentation task. They are all based on per-pixel
    evaluation metrics that assume an unrealistic indepen-
    dence between neighboring pixels. Therefore, they fail to
    detect structural differences between the inputs and their
    l(p, q) =
    2µpµq + c1
    µ2
    p
    + µ2
    q
    + c1
    (5)
    c(p, q) =
    2 p q + c2
    2
    p
    + 2
    q
    + c2
    (6)
    s(p, q) =
    2 pq + c2
    2 p q + c2
    . (7)
    The constants c1
    and c2
    ensure numerical stability and are
    typically set to c1 = 0.01 and c2 = 0.03. By substituting
    (5)-(7) into (4), the SSIM is given by
    SSIM(p, q) =
    (2µpµq + c1)(2 pq + c2)
    (µ2
    p
    + µ2
    q
    + c1)( 2
    p
    + 2
    q
    + c2)
    . (8)
    It holds that SSIM(p, q) 2 [ 1, 1]. In particular,
    SSIM(p, q) = 1 if and only if p and q are identical
    (Wang et al., 2004). Figure 2 shows the different percep-
    tions of the three similarity functions that form the SSIM
    index. Each of the patch pairs p and q has a constant `2-
    residual of 0.25 per pixel and hence assigns low defect
    scores to each of the three cases. SSIM on the other hand
    is sensitive to variations in the patches’ mean, variance,
    and covariance in its respective residual map and assigns
    low similarity to each of the patch pairs in one of the
    comparison functions.
    training them purely on defect-free image data. During
    testing, the autoencoder will fail to reconstruct defects that
    have not been observed during training, which can thus be
    segmented by comparing the original input to the recon-
    struction and computing a residual map R(x, ˆ
    x) 2 Rw⇥h.
    3.1.1. `2-Autoencoder. To force the autoencoder to recon-
    struct its input, a loss function must be defined that guides
    it towards this behavior. For simplicity and computational
    speed, one often chooses a per-pixel error measure, such
    as the L2
    loss
    L2(x, ˆ
    x) =
    h 1
    X
    r=0
    w 1
    X
    c=0
    (x(r, c) ˆ
    x(r, c))2 , (2)
    where x(r, c) denotes the intensity value of image x at
    the pixel (r, c). To obtain a residual map R`2
    (x, ˆ
    x) during
    evaluation, the per-pixel `2-distance of x and ˆ
    x is com-
    puted.
    3.1.2. Variational Autoencoder. Various extensions to
    the deterministic autoencoder framework exist. VAEs
    (Kingma and Welling, 2014) impose constraints on the
    latent variables to follow a certain distribution z ⇠ P(z).
    For simplicity, the distribution is typically chosen to be
    ਓ͕ؒײ͡Δҧ͍
    ɹɾըૉ஋ ً౓஋
    ͷมԽ
    ɹɾίϯτϥετͷมԽ
    ɹɾߏ଄ͷมԽ
    ͕ූ߸ԽલޙͰͲΕ͘Β͍มԽ͔ͨ͠Λද͢ࢦඪ
    ʢը૾Λখ͍͞8JOEPXʹ෼͚ͯܭࢉʣ
    IUUQWJTVBMJ[FIBUFOBCMPHDPNFOUSZ
    IUUQTEGUBMLKQ Q

    View Slide

  23. Kazuki Motohashi - Skymind K.K.
    実践者向けディープラーニング勉強会 第4回 - 19/June/2019 23
    "OP("/<>
    To be published in the proceedings of IPMI 2017
    Fig. 2. (a) Deep convolutional generative adversarial network. (b) t-SNE embedding
    of normal (blue) and anomalous (red) images on the feature representation of the last
    convolution layer (orange in (a)) of the discriminator.
    2.1 Unsupervised Manifold Learning of Normal Anatomical
    Variability
    ("/Λਖ਼ৗσʔλͰ܇࿅͠ɺਖ਼ৗσʔλͷੜ੒Ϟσϧʢ֬཰෼෍ʣΛߏங
    IUUQTBSYJWPSHBCT

    View Slide

  24. Kazuki Motohashi - Skymind K.K.
    実践者向けディープラーニング勉強会 第4回 - 19/June/2019 24
    $//'FBUVSF%JDUJPOBSZ<>
    and outputs the best k clusters and corresponding k centroids. A centroid is the mean position of all
    the elements of the cluster. For each cluster, we take the feature vector that is nearest to its centroid.
    The set of these k feature vectors compose the dictionary W. Figure 4 shows the pipeline for dictionary
    building. Figure 5 shows examples of dictionaries learned from images of the training set (anomaly
    free) with different patch sizes and number of clusters. The figure shows the subregions corresponding
    to each feature vector of the dictionary W.
    Figure 4. Examples of dictionary achieved considering different patch sizes and different number
    of subregions.
    QBUDI@TJ[FY
    TUSJEF
    3FT/FU
    EJNBWHQPPMMBZFS
    ৘ใྔ
    LNFBOT
    ʢΫϥελத৺ʹҰ൪͍ۙ
    ϕΫτϧΛબ୒ʣ
    ಛ௃ྔϕΫτϧͷσΟΫγϣφϦͷதͰޓ͍ͷڑ཭͕͋Δᮢ஋ΑΓԕ͍ϕΫτϧΛҟৗྖҬͱ͢Δ
    ࣍ݩ࡟ݮΛߦͳ͍ͬͯΔ෦෼
    IUUQTXXXODCJOMNOJIHPWQVCNFE

    View Slide

  25. Kazuki Motohashi - Skymind K.K.
    実践者向けディープラーニング勉強会 第4回 - 19/June/2019 25
    .75FD"OPNBMZ%FUFDUJPO%BUBTFU .75FD"%

    Category
    AE
    (SSIM)
    AE
    (L2)
    AnoGAN
    CNN
    Feature
    Dictionary
    Texture
    Inspection
    Variation
    Model
    Textures
    Carpet
    0.43
    0.90
    0.57
    0.42
    0.82
    0.16
    0.89
    0.36
    0.57
    0.61
    -
    Grid
    0.38
    1.00
    0.57
    0.98
    0.90
    0.12
    0.57
    0.33
    1.00
    0.05
    -
    Leather
    0.00
    0.92
    0.06
    0.82
    0.91
    0.12
    0.63
    0.71
    0.00
    0.99
    -
    Tile
    1.00
    0.04
    1.00
    0.54
    0.97
    0.05
    0.97
    0.44
    1.00
    0.43
    -
    Wood
    0.84
    0.82
    1.00
    0.47
    0.89
    0.47
    0.79
    0.88
    0.42
    1.00
    -
    Objects
    Bottle
    0.85
    0.90
    0.70
    0.89
    0.95
    0.43
    1.00
    0.06
    -
    1.00
    0.13
    Cable
    0.74
    0.48
    0.93
    0.18
    0.98
    0.07
    0.97
    0.24
    - -
    Capsule
    0.78
    0.43
    1.00
    0.24
    0.96
    0.20
    0.78
    0.03
    -
    1.00
    0.03
    Hazelnut
    1.00
    0.07
    0.93
    0.84
    0.83
    0.16
    0.90
    0.07
    - -
    Metal nut
    1.00
    0.08
    0.68
    0.77
    0.86
    0.13
    0.55
    0.74
    -
    0.32
    0.83
    Pill
    0.92
    0.28
    1.00
    0.23
    1.00
    0.24
    0.85
    0.06
    -
    1.00
    0.13
    Screw
    0.95
    0.06
    0.98
    0.39
    0.41
    0.28
    0.73
    0.13
    -
    1.00
    0.10
    Toothbrush
    0.75
    0.73
    1.00
    0.97
    1.00
    0.13
    1.00
    0.03
    -
    1.00
    0.60
    Transistor
    1.00
    0.03
    0.97
    0.45
    0.98
    0.35
    1.00
    0.15
    - -
    Zipper
    1.00
    0.60
    0.97
    0.63
    0.78
    0.40
    0.78
    0.29
    - -
    Table 2: Results of the evaluated methods when ap-
    plied to the classification of anomalous images. For each
    dataset category, the ratio of correctly classified samples
    of anomaly-free (top row) and anomalous images (bottom
    ment is not possible for every ob
    strict the evaluation of this meth
    (Table 2). We use 30 randomly se
    each object category in its origin
    and variance parameters at each p
    are converted to gray-scale before
    Anomaly maps are obtained b
    of each test pixel’s gray value to
    relative to its predicted standard
    GMM-based texture inspection, w
    plementation of the HALCON ma
    4.2. Data Augmentation
    Since the evaluated methods ba
    are typically trained on large data
    performed for these methods for b
    For the texture images, we random
    lar patches of fixed size from the
    object category, we apply a random
    Additional mirroring is applied w
    We augment each category to crea
    4.3. Evaluation Metric
    Each of the evaluated method
    spatial map in which large value
    Regions
    egment anomalies in
    ts are currently avail-
    ction of textured sur-
    ge, there does not yet
    ows for the segmenta-
    mages.
    WICE,2 a dataset of
    nofibrous material ac-
    cope. Five defect-free
    remaining 40 images
    m of specks of dust or
    provides a single kind
    rithms that are evalu-
    r textures of different
    igned for optical in-
    oposed during a 2007
    n [28]. They provide
    ay-scale textures with
    of ellipses. Each class
    tches for training and
    owever, their annota-
    xtures were generated
    ariance in appearance
    low. Furthermore, ar-
    be seen as an approxi-
    pervised anomaly de-
    s have been suggested
    ntel et al. [20] give a
    ork. We restrict our-
    state-of-the art meth-
    baseline for our initial
    works
    Figure 2: Example images for all five textures and ten ob-
    ject categories of the MVTec AD dataset. For each cate-
    gory, the top row shows an anomaly-free image. The middle
    શମతʹΦʔτΤϯίʔμʔΛ༻͍ͨϞσϧ͕ڧ͍
    ্ஈਖ਼ৗσʔλͷਖ਼ղ཰
    Լஈҟৗσʔλͷਖ਼ղ཰

    View Slide

  26. Kazuki Motohashi - Skymind K.K.
    実践者向けディープラーニング勉強会 第4回 - 19/June/2019 26
    ‣ オートエンコーダーは⼊⼒と⽬的の出⼒に同じデータを⽤いてデータの
    効率的な「表現」を学習
    ‣ Max Pooling - Up Sampling を⽤いて畳み込み層を⽤いたオートエン
    コーダーも実現できる
    ‣ 再構成誤差を指標に教師なし学習で異常検知を⾏うことができる
    ‣ 「再構成誤差」の定義は⾊々ある
    ‣ MVTec AD データセットは実⽤的に⾯⽩そう
    ·ͱΊ

    View Slide

  27. Kazuki Motohashi - Skymind K.K.
    実践者向けディープラーニング勉強会 第4回 - 19/June/2019 27

    View Slide

  28. Kazuki Motohashi - Skymind K.K.
    実践者向けディープラーニング勉強会 第4回 - 19/June/2019 28

    View Slide

  29. Kazuki Motohashi - Skymind K.K.
    実践者向けディープラーニング勉強会 第4回 - 19/June/2019 29

    View Slide

  30. Kazuki Motohashi - Skymind K.K.
    実践者向けディープラーニング勉強会 第4回 - 19/June/2019 30
    ҟৗݕ஌ͱ͸

    View Slide