luggage baggage

Machine learning, data analysis, web technologies and things around me.

Albumentations で TypeError: __init__() got an unexpected keyword argument 'keypoint_params' が出る場合の対処

深層学習で画像認識系のタスクを解くとき、画像データセットに対する augmentation が重要となる場合が多いです。ランダムクロップ、フリップ、リサイズ、回転、ブラーリング等々。このような定型的な処理をする際、私は Albumentations をよく使います。

GitHub - albu/albumentations: fast image augmentation library and easy to use wrapper around other libraries
Arxiv: https://arxiv.org/pdf/1809.06839.pdf


最近 keypoint detection 系のモデルを学習させる際に使おうとしたのですが、TypeError: __init__() got an unexpected keyword argument 'keypoint_params' が出てしまいちょっと困りました。この原因は、おそらく conda 経由でのインストールをしていたことのようです。確認してみると、

In [1]: import albumentations

In [2]: albumentations.__version__
Out[2]: '0.1.8'

ということで、記事執筆時点の最新版と比べてかなり古いものでした(keypoint 対応されたのが 0.2.0)。そこでこちらを remove して改めて pip install したところ、バージョンは 0.3.0 となり問題は解消しました。