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
Happywhale - Whale and Dolphin Identification 2...
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Rist Inc.
March 27, 2025
Technology
280
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Happywhale - Whale and Dolphin Identification 2nd place solution
Rist Inc.
March 27, 2025
More Decks by Rist Inc.
See All by Rist Inc.
CMI - Detect Behavior with Sensor Data
rist
0
170
大規模言語モデル (LLM) 入門
rist
2
700
Drawing with LLMs
rist
0
610
Eedi - Mining Misconceptions in Mathematics 4th place solution
rist
1
420
モンテカルロ木探索のパフォーマンスを予測する Kaggleコンペ解説 〜生成AIによる未知のゲーム生成〜
rist
4
2k
HMSコンペ解説
rist
0
300
Other Decks in Technology
See All in Technology
レガシーな広告配信システムでのAI駆動開発/運用の挑戦
i16fujimoto
0
120
AIに障害切り分けを全部やってもらった。 。 。 。
estie
0
150
データレイクの「見えない問題」を可視化する
sansantech
PRO
1
200
水を運ぶ人としてのリーダーシップ
izumii19
4
1k
アジャイルな経理と Claude Code と経営の未来
kawaguti
PRO
3
190
WebGIS AI Agentの紹介
_shimizu
0
560
AIをフル活用してオンコール機能のプロトタイプを2日で作った話 / Building an AI-Powered On-Call Prototype in Just Two Days
nari_ex
0
130
PostgreSQL 19 新機能概要 OSC Hokkaido 2026
nori_shinoda
0
240
ロボティクスの技術 / Robotics Technology
ks91
PRO
0
130
「勝手に広まる」人気 AI エージェントを爆速で作ろう!(AWS Summit Japan 2026講演資料)
minorun365
PRO
10
2.5k
新しいUbuntu/GNOMEが使いたいからXからWaylandへ移行頑張ってるの巻 2026-06-20
nobutomurata
0
160
從開發到部署全都交給 AI:實作 AI 驅動的自動化流程
appleboy
0
160
Featured
See All Featured
The World Runs on Bad Software
bkeepers
PRO
72
12k
RailsConf 2023
tenderlove
30
1.5k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.5k
The Spectacular Lies of Maps
axbom
PRO
1
820
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.7k
Claude Code のすすめ
schroneko
67
230k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
400
How Software Deployment tools have changed in the past 20 years
geshan
0
34k
My Coaching Mixtape
mlcsv
0
150
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
420
Transcript
Happywhale - Whale and Dolphin Identification 2nd place solution 株式会社Rist
©Rist Inc. 02 1. Competition概要 2. 2nd place solution 3.
上位解法の紹介 目次
©Rist Inc. 03 Competition概要
©Rist Inc. 04 • 開催情報: ◦ 期間: 2022/2 ~ 2022/4
◦ 主催: Happywhale ◦ 結果: 2位 / 1589チーム • 課題: ◦ クジラとイルカの個体識別 ◦ 海洋保全への活用が目的 • 評価指標: ◦ MAP@5 • Data: ◦ 画像枚数:train=51033 / test=27956 ◦ testには、trainに存在しない個体 “new_individual”があり、 これも予測する必要がある ◦ 2019年にも同様のコンペが開催されていた Happywhale - Whale and Dolphin Identification
©Rist Inc. 05 • クジラ、イルカ合計で25種類(ザトウクジラ、シロイルカ...etc) • trainにのみ付与されており、補助的に使える情報 Data|Species Species分布 •
分布の偏り大 • 尾ひれがない、体表の色など、 speciesごとに様々な特徴を持つ
©Rist Inc. 06 • 個体識別id • 15587の既知のid + new_individual の、合計15588クラス
• ただし、9258個のidがtrainに1枚ずつしかなかったり、逆に一部のidは400枚以上あったりと、不均衡なデータ Data|Individual_id (target)
©Rist Inc. 07 • testデータの各画像に対して、最大5つまでの individual_id を予測 → MAPで評価 •
trainに存在しないと思われる個体には、 “new_individual” の予測を挿入する Submission形式 name predictions (確信度:降順) image_0 id_1, id_2, id_0, id_4, id_3 image_1 new_individual, id_0, id_3, id_1, id_4 image_2 id_1, id_2, id_0, new_individual, id_3 … …
©Rist Inc. 08 • Mean Average Precision / DetectionタスクなどのMAPと考え方は同じ •
idがヒットした時点を閾値として、その時点でのPrecisionを計算、平均することでAPとする (今回は画像ごとにGTが1つしかないので、idが出てきた時点での 1/ (index+1) を返すだけ) Metrics|MAP@5 index predictions 0 id_1 1 id_2 2 id_0 3 id_3 4 id_5 |GT=id_0の場合 hit !! precision = 1 / 3
©Rist Inc. 09 • 前回のコンペとの比較は下記 • top solutionの範囲では、前回コンペデータを使ったチームはなかった 前回のコンペデータ使えないの? 項目
クジラコンペ2019 クジラコンペ2022 対象 ザトウクジラ クジラ/イルカ 25種 撮影部位 尾ひれ 尾ひれ / 背びれ / 全身..etc 撮影環境 well aligned 低品質なものもある
©Rist Inc. 010 前回のコンペデータ使えないの? クジラコンペ2019 クジラコンペ2022
©Rist Inc. 011 Result Public 1st Private 2nd
©Rist Inc. 012 1. まず初めに、物体検出モデルでクジラ/イルカだけを切り抜くdetectorを作成 a. すでに公開されているdetector, cropped datasetを使うチームが多かった b.
弊チームでも、コンペ最終日まで fullbody dataset (公開dataset) を使っていた c. LB topの人たちは独自にannotationした画像でdetectorを作り直したりしていた 2. cropped imageを使って、metric learning (Arcfaceなど) で学習 3. 上記で学習したモデルを使い train, testのembeddingを取得 4. Cosine similarityなどで検索 → Top5 idを作成 5. post processで “new_individual” を挿入 Basic Approach
©Rist Inc. 013 Public datasets backfin dataset fullbody dataset detic
dataset remove background
©Rist Inc. 014 2nd place solution
©Rist Inc. 015 • efficientnet_l2 + pseudo labeling 5round +α
• 最終日に YOLOX detectorを学習、上記のモデルをfine-tuning • 最終subはバリエーションを持たせた4つのefficientnet_l2のensemble 2nd place solution|Overview
©Rist Inc. 016 2種類のdatasetを使用した • fullbody (YOLOv5): ◦ public dataset
クジラ/イルカの全身が映るようにアノテーション、YOLOv5で学習 • fullbody (YOLOX): ◦ 上記のアノテーションを使って、YOLOXで学習(最終日に作成) Single model|Dataset
©Rist Inc. 017 YOLOシリーズ(v1 〜 v5, X)は、single stageの物体検出モデル(およびライブラリ)であり、高速な学習、推論 を特徴とする(なお、YOLOv5については論文が存在しない(Githubのみ)ため、本ページではYOLOXについての み特徴を記載します)
YOLOX YOLOv1を除くYOLOシリーズでは、RCNN系モデルと同じくアンカーベースの手法となっていたが、YOLOXではこ れをアンカーフリーに戻し、Decoupled Head, Multi positive, SimOTAなどさまざまな学習時の工夫を導入している • Decoupled Head:classificationとregressionを別々のブランチで学習する • Multi positive:前景、背景のデータ不均衡対策。GTの近傍3x3のアンカーもPositiveとして評価 • SimOTA:Loss計算時のGT_bboxとpred_bboxの割り当てを、最適輸送問題として解く手法(OTA)を高速化 YOLO (v5, X)
©Rist Inc. 018 • Keypoint:Large model (efficientnet_l2), Strong augmentation (RandAugment)
• mixed precision, gradient checkpointingを使うと single RTX3090でもimg_size=768で batch_size=16が可能 • Pytorch buildの違いで学習速度に影響が出ていた。NVIDIAからリリースされているものが一番 高速だった Single model|Architecture Training Configs - backbone = tf_efficientnet_l2_ns - img_size = 768 - loss = Arcface with adaptive margin - augmentation = Horizontal flip, RandAugment - optimizer = SGD - scheduler = Cosine Decay with warmup - batch_size = 16 per GPU - n_epoch = 20 Pytorch build (docker image) cudnn benchmark training throughput (imgs/sec) pytorch/pytorch:1.11.0-cuda11. 3-cudnn8-devel False 2.5 pytorch/pytorch:1.11.0-cuda11. 3-cudnn8-devel True 3.4 nvcr.io/nvidia/pytorch:22.02-py3 False 4.0 nvcr.io/nvidia/pytorch:22.02-py3 True 4.1
©Rist Inc. 019 • サンプル間の距離 (metric) に基づいてクラスごとに分離されるよう、入力→特徴量空間への変換を 学習させる手法 • 同一クラスのサンプル間距離を小さくしながら、異なるクラスのサンプル間距離を大きくする
• このように学習した特徴空間上で、どのクラスのサンプルとも距離が遠いものは “未知” のクラス だと予測できる Metric Learning
©Rist Inc. 020 Arcface • 通常のクラス分類の手法に、異なるクラス間の距離を遠ざけるペナルティ項としてmarginを導入 Adaptive margin • 通常のArcfaceは、すべてのクラスに対して同じmarginを設定する
• しかし、今回のコンペのようにclass imbalanceな問題では、上記のmarginをクラスごとに調整した 方が良いことがある = Adaptive margin • 今回は、画像枚数が少ないクラスほど大きなmarginを使用するように調整 Arcface with Adaptive margin
©Rist Inc. 021 • NAS (Neural Architecture Search) により取得したベースモデル (Efficientnet
B0) を、ある一定 のScaling raw に従い Up scaling したモデル群 • Efficientnet L2はその中でも一番大規模なモデル Efficientnet 単一のパラメータ φ に従い、モデルをup scaling
©Rist Inc. 022 • 様々なaugmentからランダムにN個サンプリングし、それぞれを強度Mでsequentialに適用する • 本コンペでは上記のN, Mは、 mmclassification における
ImageNet学習時のパラメータを使用 (N=2, M=9) • サンプリングするaugmentation ◦ identity / autoContrast / equalize / rotate / solarize / color / posterize / contrast / brightness / sharpness / shear-x / shear-y / translate-x / translate-y RandAugment
©Rist Inc. 023 • pseudo labelを繰り返すことでPublic, Privateともに精度が向上していった • round5まで繰り返すことで Public=0.88745
/ Private=0.86320 (4th) • 上記のcheckpointからdatasetを fullbody (YOLOX) に切り替えて5epoch fine-tuningすること で、single modelでPublic=0.89176 / Private=0.87028 (2nd) Single model|Pseudo labeling Pseudo label round Dataset Public score Private score initial model (round1) fullbody (YOLOv5) 0.84642 0.81233 round2 fullbody (YOLOv5) 0.87558 0.84965 round3 fullbody (YOLOv5) 0.88548 0.86017 round4 fullbody (YOLOv5) 0.88909 0.86257 round5 fullbody (YOLOv5) 0.88745 0.86320 round5 (fine-tuning) fullbody (YOLOX) 0.89176 0.87028
©Rist Inc. 024 方法 1. 通常通り train dataを使用してmodelを学習 2. test
dataに対して上記のmodelでidを予測 3. 確信度0.8の固定閾値で、上記の予測されたidをpseudo labelとして採用 4. train data + pseudo labeled test data で再度学習 5. 2〜4を繰り返す Single model|Pseudo labeling
©Rist Inc. 025 Submission • embedding取得 → sample間でcosine類似度計算 → 類似度Top5の
id を取得 Post process • cosine類似度=0.5の固定閾値で “new_individual” を挿入 Single model|Submission & Post process input: - scores=[0.7, 0.3, 0.2, 0.1, 0.05] - preds=[“id_1”, “id_2”, “id_3”, “id_4”, “id_5”] - thr=0.4 output: - new_preds=[“id_1”, “new_individual”, “id_2”, “id_3”, “id_4”]
©Rist Inc. 026 • 下記の4model-ensemble (すべてbackbone = efficientnet_l2) • Public=0.89758
/ Private=0.87262 (2nd) Last Ensemble Pseudo label round Image size Dataset round3 (1024, 1024) fullbody (YOLOv5) round4 (768, 768) fullbody (YOLOv5) round5 (768, 768) fullbody (YOLOX) round5 (768x2, 768) vertical concatenated original dataset and fullbody (YOLOX)
©Rist Inc. 027 上位解法の紹介
©Rist Inc. 028 • Bounding box mixing augmentation ◦ fullbody,
fullbody_charmq, backfin など様々なbboxでcropした画像で学習 ◦ 特にbackfinを組み合わせることで背びれを持つ種類の精度が向上した ◦ 自分たちのチームとの一番の差分 • adaptive marginの値をOptunaで最適化 • pseudo labeling 2round 上位解法|1st place
©Rist Inc. 029 • publicアノテーションを元に、いくつかを修正しつつYOLOv5を学習 これを繰り返してbboxの 精度を上げていく • DOLG x ConvNeXt
• speciesごとに “new_individual” の閾値を変える:public 0.82 → 0.88 ◦ (この後処理は他の上位チームでも散見された) 上位解法|4th place
©Rist Inc. 030 Appendix 2nd place solution + bbox mixing
augmentation
©Rist Inc. 031 弊チームのsolutionに対して、1stが使用していた bbox mixing augmentationの要素を取り入れ、 どの程度精度が改善するか検証 方法 •
モデルの学習時に、入力画像のcropを下記のように確率的に切り替える ◦ fullbody crop: p=0.75, backfin crop: p=0.25 ◦ その他の設定は2nd place solutionの通り • inference時はfullbody cropを使用(これまでと変わらず) • 上記設定で pseudo labeling を round-5 まで繰り返す 2nd place solution + bbox mixing augmentation
©Rist Inc. 032 • bbox mixing augmentationを取り入れることでSingle modelのスコアが大幅に改善 • 特にprivateでのスコアの向上幅が大きい
◦ おそらく、private datasetに背びれがあるクジラが多かったため 2nd place solution + bbox mixing augmentation|Result Model Pseudo label round 2nd place solution (public / private) 2nd place + bbox mixing (public / private) single model initial model (round1) 0.84642 / 0.81233 0.86092 / 0.82946 single model round2 0.87558 / 0.84965 0.88492 / 0.86288 single model round3 0.88548 / 0.86017 0.88999 / 0.87120 single model round4 0.88909 / 0.86257 0.89357 / 0.87362 single model round5 0.88745 / 0.86320 0.89427 / 0.87436 ensemble best score 0.89758 / 0.87262 (4-model ensemble) 0.89535 / 0.87666 (2-model ensemble)
©Rist Inc. 033 以上
©Rist Inc. 034 以下、回答用スライド
©Rist Inc. 035 • 3weeks ago:チームで参加開始, base model探索 (dataset, architecture..)
◦ 256x256などの画像サイズで検証サイクルをできるだけ多く回す • 2weeks ago:pseudo labeling / post-process / ensemble 方法検討 ◦ 周辺テクニックを試す。pseudo labelingの有効性をここで確認 • 1weeks ago:final model作成 ◦ これまでの結果とリソースなどを元にfinal modelの方向性を固め、学習をひたすら回す コンペ期間中の取り組み