Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Kaggle APTOS 2019 @ U-Tokyo Med
Search
Maxwell
December 07, 2020
Science
1
420
Kaggle APTOS 2019 @ U-Tokyo Med
Materials for a presentation at the University of Tokyo's medical unit.
Updated: Jul. 2022
Maxwell
December 07, 2020
Tweet
Share
More Decks by Maxwell
See All by Maxwell
Causal Impact -paper summary-
hoxomaxwell
3
820
Great Barrier Reef Model Pipeline: 15th place
hoxomaxwell
1
220
Lecture materials at the University of Tokyo School of Medicine
hoxomaxwell
1
140
Kaggle Hungry Geese
hoxomaxwell
1
110
HuBMAP 17th place model pipeline
hoxomaxwell
1
95
LT: Shallow Dive into Bayes Factor
hoxomaxwell
6
1.4k
Cornell Birdcall 36th place solution
hoxomaxwell
2
240
Kaggle Bengali.AI 6 th place solution
hoxomaxwell
4
8.5k
Google Colaboratory Shortcuts
hoxomaxwell
2
1k
Other Decks in Science
See All in Science
メール送信サーバの集約における透過型SMTP プロキシの定量評価 / Quantitative Evaluation of Transparent SMTP Proxy in Email Sending Server Aggregation
linyows
0
990
モンテカルロDCF法による事業価値の算出(モンテカルロ法とベイズモデリング) / Business Valuation Using Monte Carlo DCF Method (Monte Carlo Simulation and Bayesian Modeling)
ikuma_w
0
220
機械学習 - DBSCAN
trycycle
PRO
0
960
動的トリートメント・レジームを推定するDynTxRegimeパッケージ
saltcooky12
0
170
03_草原和博_広島大学大学院人間社会科学研究科教授_デジタル_シティズンシップシティで_新たな_学び__をつくる.pdf
sip3ristex
0
560
白金鉱業Meetup Vol.16_数理最適化案件のはじめかた・すすめかた
brainpadpr
4
1.9k
データベース12: 正規化(2/2) - データ従属性に基づく正規化
trycycle
PRO
0
950
SpatialBiologyWestCoastUS2024
lcolladotor
0
170
データベース10: 拡張実体関連モデル
trycycle
PRO
0
960
データベース11: 正規化(1/2) - 望ましくない関係スキーマ
trycycle
PRO
0
920
データマイニング - グラフデータと経路
trycycle
PRO
1
200
データベース08: 実体関連モデルとは?
trycycle
PRO
0
920
Featured
See All Featured
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.3k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
1k
For a Future-Friendly Web
brad_frost
179
9.9k
Designing for humans not robots
tammielis
253
25k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
Why Our Code Smells
bkeepers
PRO
338
57k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
110
20k
Site-Speed That Sticks
csswizardry
10
770
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
50
5.5k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Raft: Consensus for Rubyists
vanstee
140
7.1k
The World Runs on Bad Software
bkeepers
PRO
70
11k
Transcript
IFI, Yuji Hiramatsu DL Research Meeting in U-Tokyo Medicine Gp
アクサ生命保険株式会社 Senior Data Scientist Kaggle Master, A.I.A.J 平松 雄司
近年は アクサ損保・生命 にて ・アクチュアリー(収益管理 / プロジェクション) ・データサイエンティスト(予測モデル / 最適化 / 教育) といった 保険数理 / データ分析の領域を担当 現在は アクサ生命 から 東京大学 へ研究員として出向し主に医療データ の分析・研究 趣味で,本やブログ記事の執筆,データサイエンスのコンペティション (Kaggle)に参加
2019 / 10 / 09 発売 Kindle 版も同時発売 ¥
3,608 (税込み) 技術評論社の EPUB/PDF でも発売中 https://gihyo.jp/dp/ebook/2019/978-4-297-10844-1 データ分析コンペティションプラットフォームである Kaggle における数々の分析手法・テクニックを紹介 平松は 2 章と 7 章の一部 を担当 2 章:評価指標の最適化,リーク 7 章:アンサンブル,スタッキング Kaggle に限らず,実務でも活かせる内容になっています https://amzn.to/2lDkWlf
今回は Kaggleのコンペを題材として お話をします
01 Competition Overview 02 Result and Model pipeline 03 Top
Solutions
01 Competition Overview 02 Result and Model pipeline 03 Top
Solutions
インドの Aravind 眼科病院は, 農村部に人を派遣し眼底検査を行っている. そこで撮影した網膜画像を眼科医に判断させ, 糖尿病網膜症の診断を行っている. このコンペでは画像診断を自動化するための 画像認識(画像分類)モデルを作成する
Rural areas Aravind Eye Hospital Madurai, Tamil Nadu Retina images 深層学習による網膜画像の分類モデルの作成
糖尿病網膜症の所見と重症度
Datasets Train : 3,662 images Public : 1,928 images
Private : 11,000 images Label (severity) 0: No DR 1: Mild 2: Moderate 3: Severe 4: Proliferative DR 0: No DR 1: Mild 2: Moderate 3: Severe 4: Proliferative DR Test datasets
Public Private コンペ開催期間中に目安となる順位 test data の 10 -
20 % くらいを使用して スコア計算されることが多い 実際の順位はコンペ終了後にこちらで決定 public で未使用の test data で評価されるのが基本 過学習によるモデルの誤評価を防ぐための措置
Train と Public とでラベルの分布が 大きく異なる(DL modelは共変量シフトに弱い) その他
複製画像が混入 アノーテーションノイズ(次頁参照) コンペデフォルトのサンプル数が少ない一方 で, 外部データの使用が許可されているため, データを集めてくる必要がある 不均衡データ 画像サイズ・縦横比がばらばら(要・標準化) データに関連したいくつかの問題
https://youtu.be/oOeZ7IgEN4o?t=145 眼科医間のannotationは一貫しない TensorFlow DEV SUMMIT 2017 だからこそCADが有効ともいえる! 横軸: 各眼科医 縦軸:
各患者(画像)
評価指標 Quadratic Weighted Kappa κ = 1 − i, j
ωi, j Oi, j i, j ωi, j Ei, j ωi, j = i − j 2 混同行列にもとづいた指標なので, 予測値に対して最適化した閾値を設定し, ハードラベル化しなければならない. そのため,閾値による不安定性がある. データのラベル分布に対する依存性がある Kaggleで勝つデータ分析の技術 2.3.5 および 2.6.3 参照
01 Competition Overview 02 Result and Model pipeline 03 Top
Solutions
Private: 28 th Public: 38 th 順位が private で 上がることを
shake-up 下がることを shake-down と呼ぶ(業界用語)
APTOS 2019 Blindness Detection 320 320 Remove black background Resize
- HorizontalFlip - Brightness - Contrast - RGBshift - Scale - Rotate - RandomErasing - Stratified 5 fold - Pretrained on ImageNet - BCE loss - Early Stopping with BCE - Adam 1e-4 RGB brightness normalization (ImageNet base) + Preprocessing SE-ResNext 50 ( Pre-trained ) Fine tuning APTOS IDRiD DRD 2015 Test TTA (3 times) - HorizontalFlip - Brightness - Contrast - RGBShift - Scale - Rotate Prediction Encoding + + Remove black background Preprocessing CLAHE ( adaptive histogram equalization ) 300 260 Resize Grade Balanced Sampling + + Augmentation - HorizontalFlip - Brightness - Contrast - RGBshift - Scale - Rotate - Shear - Stratified 5 fold - Pretrained on ImageNet - Input normalized with BN - Clipped MSE (CMSE) - Early Stopping with CMSE - Adam 1e-3 / 5e-4 Changing Sampling Rate with Disease Grade ( 1 : 2 : 2 : 2 : 2 ) TTA (3/3 times) - Brightness - Contrast - RGBShift - Scale - Rotate Blending Blending Coefficients SE-ResNext 50: 0.469 EfficinetNet B2: 0.273 EfficientNet B3: 0.258 QWK optimization with Nelder-Mead 320 Copyright 2019 @ Maxwell_110 Public: 38 th Local 0.936 on APTOS train Public LB 0.832 Private: 28 th Private LB 0.927 Pre-training Augmentation Preprocessing Augmentation EfficientNet B2 ( Pre-trained ) EfficientNet B3 ( Pre-trained ) EfficientNet B2 ( Regression ) EfficientNet B3 ( Regression ) SE-ResNext 50 ( Ordinal Regression ) Ensemble Preprocessing Preprocessing Using all data
01 Competition Overview 02 Result and Model pipeline 03 Top
Solutions
1st place solution 384 384 512 512 • contrast: +/-
0.2 • brightness: +/- 20 • hue: +/- 10 • saturation: +/- 20 • rotate: +/- 180 • scale: +/- 0.2 • shear: +/- 0.2 • shift: +/- 0.2 • do_mirror: True • blur_and_sharpen: True Resize Augmentation Preprocessing SE-ResNext 50 ( 2 seeds, Huber loss, GeM Pooling ) SE-ResNext 101 ( 2 seeds, Huber loss, GeM Pooling ) Inception V4 ( 2 seeds, Huber loss, GeM Pooling ) Inception ResNet V2 ( 2 seeds, Huber loss, GeM Pooling ) Stage 1 Training Stage 2 Training APTOS IDRiD Messidor Test (Public) Preprocessing Inception ResNet V2 Inception V4 SE-ResNext 50 SE-ResNext 101 8 models trained in the 1st stage Psuedo Label (soft) Special Pseudo label Averaging the provided labels with the predicted labels from stage1 models SE-ResNext 50 ( 2 seeds, Huber loss, GeM Pooling ) SE-ResNext 101 ( 2 seeds, Huber loss, GeM Pooling ) Inception V4 ( 2 seeds, Huber loss, GeM Pooling ) Inception ResNet V2 ( 2 seeds, Huber loss, GeM Pooling ) Blending QWK thresholds [0.7, 1.5, 2.5, 3.5] Public: 4 th Public LB 0.850 Private: 1 st Private LB 0.936 Predict 多彩な data augmentation による汎化性能の向上 2 seeds × 4 models による 8 model ensemble 損失関数は Huber Loss(Smooth L1 Loss)を使用 Psuedo Labeling https://www.kaggle.com/c/aptos2019-blindness-detection/discussion/108065
2nd place solution Public: 7 th Public LB 0.848 Private:
2 nd Private LB 0.934 Remove black background 456 456 460 460 300 300 EfficientNet B3 ( 80 epochs ) EfficientNet B4 EfficientNet B5 ( 15 epochs ) • Blur • Flip • Random Brightness • Random Contrast • Shift • Scale • Rotate • Elastic Transform • Transpose • Grid Distortion • Hue Saturation • CLAHE • Coarse Dropout Augmentation Stage 1 Training EfficientNet B3 ( 50 epochs ) EfficientNet B4 EfficientNet B5 ( 15 epochs ) Stage 2 Training Preprocessing APTOS DRD 2015 Test Preprocessing TTA with flip Predict Simple Blending Epoch ensemble (Public) EfficientNets trained in the 1st stage EfficientNet B3 EfficientNet B4 EfficientNet B5 (Private) Iterative (Loop) Psuedo Label Iterative (Loop) Psuedo Label 3 種類の画像サイズ違いによる feature map の多様性 多彩な data augmentation による汎化性能の向上 Pusedo Labeling の繰り返し https://www.kaggle.com/c/aptos2019-blindness-detection/discussion/107926
4th place solution Public: 16 th Public LB 0.842 Private:
4 th Private LB 0.934 • Rotation • Contrast • Brightness • Cutout • RandomCrop • CLAHE • Dihedral Group • PerspectiveTransform (3D projection) Augmentation APTOS DRD 2015 Test Remove black background Preprocessing https://www.kaggle.com/c/aptos2019-blindness-detection/discussion/107987 type 0 type 1 type 2 Type 2 transformation • type 0 => type 2 • type 1 => type 2 • type 2 (as it is) 320 256 240 224 Resize EfficientNet B7 ( size: 224 x 224 ) EfficientNet B6 ( size: 240 x 240 ) EfficientNet B5 ( size: 256 x 256 ) EfficientNet B4 ( size: 320 x 320 ) EfficientNet B7 ( Ben's, size: 224 x 224 ) EfficientNet B5 ( Ben's, size: 256 x 256 ) EfficientNet B7 ( size: 224 x 224 ) EfficientNet B6 ( size: 240 x 240 ) EfficientNet B5 ( size: 256 x 256 ) EfficientNet B4 ( size: 320 x 320 ) Stage 1 Training Stage 2 Training 224 256 Ben's processing (DRD 2015 winning solution) EfficientNet B7 ( Ben's, size: 224 x 224 ) EfficientNet B5 ( Ben's, size: 256 x 256 ) Resize trained for 25 epochs on DRD 2015 w/o validation trained w/ validation 5 folds CV on only APTOS Ben's Processing Ben's Processing TTA with Dihedral (8 times) Preprocessing Simple Blending Predict Predict 均一化された前処理(Type 2 transformation) 過学習を防ぐための画像サイズとモデルの対応関係 (複雑なモデルほど,入力画像の解像度が低い) Psuedo Labeling
腎臓の糸球体組織の segmentation task (https://www.kaggle.com/c/hubmap-kidney-segmentation/overview/description) 開催元: HuBMAP,Indiana Univ,Google など 開催期間: Nov
17, 2020 - Feb 2, 2021 データサイズ: 13枚の巨大画像(30,000 x 30,000 等) コードコンペ: 推論は Kaggle Kernel 上でコード実行(<= GPU 9h) 開催中の医療画像系コンペ (2020.12.07 現在)